diff options
Diffstat (limited to 'sysdeps/unix')
76 files changed, 874 insertions, 274 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 415aa1f14d..ae66590e91 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -200,6 +200,7 @@ tests += \ tst-clone2 \ tst-clone3 \ tst-epoll \ + tst-epoll-ioctls \ tst-fanotify \ tst-fdopendir-o_path \ tst-getauxval \ diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h b/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h index f82bde5d30..8dceaa1a52 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h @@ -103,3 +103,18 @@ #define HWCAP2_SVE_B16B16 (1UL << 45) #define HWCAP2_LRCPC3 (1UL << 46) #define HWCAP2_LSE128 (1UL << 47) +#define HWCAP2_FPMR (1UL << 48) +#define HWCAP2_LUT (1UL << 49) +#define HWCAP2_FAMINMAX (1UL << 50) +#define HWCAP2_F8CVT (1UL << 51) +#define HWCAP2_F8FMA (1UL << 52) +#define HWCAP2_F8DP4 (1UL << 53) +#define HWCAP2_F8DP2 (1UL << 54) +#define HWCAP2_F8E4M3 (1UL << 55) +#define HWCAP2_F8E5M2 (1UL << 56) +#define HWCAP2_SME_LUTV2 (1UL << 57) +#define HWCAP2_SME_F8F16 (1UL << 58) +#define HWCAP2_SME_F8F32 (1UL << 59) +#define HWCAP2_SME_SF8FMA (1UL << 60) +#define HWCAP2_SME_SF8DP4 (1UL << 61) +#define HWCAP2_SME_SF8DP2 (1UL << 62) diff --git a/sysdeps/unix/sysv/linux/aarch64/clone3.S b/sysdeps/unix/sysv/linux/aarch64/clone3.S index 92d69a5430..e28aaa5083 100644 --- a/sysdeps/unix/sysv/linux/aarch64/clone3.S +++ b/sysdeps/unix/sysv/linux/aarch64/clone3.S @@ -82,4 +82,3 @@ thread_start: .size thread_start, .-thread_start libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/aarch64/libm.abilist b/sysdeps/unix/sysv/linux/aarch64/libm.abilist index f0da228fbb..a4bb539670 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libm.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libm.abilist @@ -1149,3 +1149,11 @@ GLIBC_2.35 hypotf F GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/aarch64/libmvec.abilist b/sysdeps/unix/sysv/linux/aarch64/libmvec.abilist index 26c3fbf18b..b685106954 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libmvec.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libmvec.abilist @@ -79,6 +79,8 @@ GLIBC_2.40 _ZGVnN2v_asinh F GLIBC_2.40 _ZGVnN2v_asinhf F GLIBC_2.40 _ZGVnN2v_atanh F GLIBC_2.40 _ZGVnN2v_atanhf F +GLIBC_2.40 _ZGVnN2v_cbrt F +GLIBC_2.40 _ZGVnN2v_cbrtf F GLIBC_2.40 _ZGVnN2v_cosh F GLIBC_2.40 _ZGVnN2v_coshf F GLIBC_2.40 _ZGVnN2v_erf F @@ -89,20 +91,29 @@ GLIBC_2.40 _ZGVnN2v_sinh F GLIBC_2.40 _ZGVnN2v_sinhf F GLIBC_2.40 _ZGVnN2v_tanh F GLIBC_2.40 _ZGVnN2v_tanhf F +GLIBC_2.40 _ZGVnN2vv_hypot F +GLIBC_2.40 _ZGVnN2vv_hypotf F +GLIBC_2.40 _ZGVnN2vv_pow F +GLIBC_2.40 _ZGVnN2vv_powf F GLIBC_2.40 _ZGVnN4v_acoshf F GLIBC_2.40 _ZGVnN4v_asinhf F GLIBC_2.40 _ZGVnN4v_atanhf F +GLIBC_2.40 _ZGVnN4v_cbrtf F GLIBC_2.40 _ZGVnN4v_coshf F GLIBC_2.40 _ZGVnN4v_erfcf F GLIBC_2.40 _ZGVnN4v_erff F GLIBC_2.40 _ZGVnN4v_sinhf F GLIBC_2.40 _ZGVnN4v_tanhf F +GLIBC_2.40 _ZGVnN4vv_hypotf F +GLIBC_2.40 _ZGVnN4vv_powf F GLIBC_2.40 _ZGVsMxv_acosh F GLIBC_2.40 _ZGVsMxv_acoshf F GLIBC_2.40 _ZGVsMxv_asinh F GLIBC_2.40 _ZGVsMxv_asinhf F GLIBC_2.40 _ZGVsMxv_atanh F GLIBC_2.40 _ZGVsMxv_atanhf F +GLIBC_2.40 _ZGVsMxv_cbrt F +GLIBC_2.40 _ZGVsMxv_cbrtf F GLIBC_2.40 _ZGVsMxv_cosh F GLIBC_2.40 _ZGVsMxv_coshf F GLIBC_2.40 _ZGVsMxv_erf F @@ -113,3 +124,7 @@ GLIBC_2.40 _ZGVsMxv_sinh F GLIBC_2.40 _ZGVsMxv_sinhf F GLIBC_2.40 _ZGVsMxv_tanh F GLIBC_2.40 _ZGVsMxv_tanhf F +GLIBC_2.40 _ZGVsMxvv_hypot F +GLIBC_2.40 _ZGVsMxvv_hypotf F +GLIBC_2.40 _ZGVsMxvv_pow F +GLIBC_2.40 _ZGVsMxvv_powf F diff --git a/sysdeps/unix/sysv/linux/alpha/libm.abilist b/sysdeps/unix/sysv/linux/alpha/libm.abilist index f5d8023d62..8ff65e3f7e 100644 --- a/sysdeps/unix/sysv/linux/alpha/libm.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libm.abilist @@ -1308,3 +1308,11 @@ GLIBC_2.4 truncl F GLIBC_2.4 y0l F GLIBC_2.4 y1l F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/arc/clone3.S b/sysdeps/unix/sysv/linux/arc/clone3.S index d9a2dfff3e..38a27063fb 100644 --- a/sysdeps/unix/sysv/linux/arc/clone3.S +++ b/sysdeps/unix/sysv/linux/arc/clone3.S @@ -87,4 +87,3 @@ thread_start_clone3: .size thread_start_clone3, .-thread_start_clone3 libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/arc/libm.abilist b/sysdeps/unix/sysv/linux/arc/libm.abilist index f2169f8f57..af9df2673c 100644 --- a/sysdeps/unix/sysv/linux/arc/libm.abilist +++ b/sysdeps/unix/sysv/linux/arc/libm.abilist @@ -757,3 +757,9 @@ GLIBC_2.35 fminimumf64 F GLIBC_2.35 fminimuml F GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/arm/be/libm.abilist b/sysdeps/unix/sysv/linux/arm/be/libm.abilist index f020a8a904..0e460259f3 100644 --- a/sysdeps/unix/sysv/linux/arm/be/libm.abilist +++ b/sysdeps/unix/sysv/linux/arm/be/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.4 y1l F GLIBC_2.4 yn F GLIBC_2.4 ynf F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/arm/clone3.S b/sysdeps/unix/sysv/linux/arm/clone3.S index e759de9730..094efc2f40 100644 --- a/sysdeps/unix/sysv/linux/arm/clone3.S +++ b/sysdeps/unix/sysv/linux/arm/clone3.S @@ -77,4 +77,3 @@ PSEUDO_END (__clone3) .fnend libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/arm/le/libm.abilist b/sysdeps/unix/sysv/linux/arm/le/libm.abilist index f020a8a904..0e460259f3 100644 --- a/sysdeps/unix/sysv/linux/arm/le/libm.abilist +++ b/sysdeps/unix/sysv/linux/arm/le/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.4 y1l F GLIBC_2.4 yn F GLIBC_2.4 ynf F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 86444f0018..5ab19a8c08 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -181,7 +181,7 @@ typedef __socklen_t socklen_t; #include <bits/sockaddr.h> /* Structure describing a generic socket address. */ -struct sockaddr +struct __attribute_struct_may_alias__ sockaddr { __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ char sa_data[14]; /* Address data. */ @@ -194,7 +194,7 @@ struct sockaddr #define _SS_PADSIZE \ (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) -struct sockaddr_storage +struct __attribute_struct_may_alias__ sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ char __ss_padding[_SS_PADSIZE]; diff --git a/sysdeps/unix/sysv/linux/csky/libm.abilist b/sysdeps/unix/sysv/linux/csky/libm.abilist index 225a5e9b81..4c1216044d 100644 --- a/sysdeps/unix/sysv/linux/csky/libm.abilist +++ b/sysdeps/unix/sysv/linux/csky/libm.abilist @@ -823,3 +823,9 @@ GLIBC_2.35 fminimumf64 F GLIBC_2.35 fminimuml F GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/dl-execstack.c b/sysdeps/unix/sysv/linux/dl-execstack.c index 3d8f3938da..b986898598 100644 --- a/sysdeps/unix/sysv/linux/dl-execstack.c +++ b/sysdeps/unix/sysv/linux/dl-execstack.c @@ -27,35 +27,30 @@ #include <sysdep.h> #include <unistd.h> -extern int __stack_prot attribute_relro attribute_hidden; - static int make_main_stack_executable (void **stack_endp) { /* This gives us the highest/lowest page that needs to be changed. */ uintptr_t page = ((uintptr_t) *stack_endp & -(intptr_t) GLRO(dl_pagesize)); - int result = 0; - if (__builtin_expect (__mprotect ((void *) page, GLRO(dl_pagesize), - __stack_prot) == 0, 1)) - goto return_success; - result = errno; - goto out; + if (__mprotect ((void *) page, GLRO(dl_pagesize), + PROT_READ | PROT_WRITE | PROT_EXEC +#if _STACK_GROWS_DOWN + | PROT_GROWSDOWN +#elif _STACK_GROWS_UP + | PROT_GROWSUP +#endif + ) != 0) + return errno; - return_success: /* Clear the address. */ *stack_endp = NULL; /* Remember that we changed the permission. */ GL(dl_stack_flags) |= PF_X; - out: -#ifdef check_consistency - check_consistency (); -#endif - - return result; + return 0; } int diff --git a/sysdeps/unix/sysv/linux/hppa/libm.abilist b/sysdeps/unix/sysv/linux/hppa/libm.abilist index 450ac03223..3ea5b611eb 100644 --- a/sysdeps/unix/sysv/linux/hppa/libm.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F GLIBC_2.4 exp2l F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/i386/clone3.S b/sysdeps/unix/sysv/linux/i386/clone3.S index abb7356b1f..6803e59644 100644 --- a/sysdeps/unix/sysv/linux/i386/clone3.S +++ b/sysdeps/unix/sysv/linux/i386/clone3.S @@ -120,4 +120,3 @@ L(thread_start): PSEUDO_END (__clone3) libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist index 5d89aaa08e..696e52e65a 100644 --- a/sysdeps/unix/sysv/linux/i386/libm.abilist +++ b/sysdeps/unix/sysv/linux/i386/libm.abilist @@ -1188,3 +1188,11 @@ GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F GLIBC_2.35 hypot F GLIBC_2.35 hypotf F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/loongarch/clone3.S b/sysdeps/unix/sysv/linux/loongarch/clone3.S index 20eaf4adc2..dfffb1f3d6 100644 --- a/sysdeps/unix/sysv/linux/loongarch/clone3.S +++ b/sysdeps/unix/sysv/linux/loongarch/clone3.S @@ -80,4 +80,3 @@ L (thread_start3): END (__thread_start3) libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist b/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist index b3dbd00001..1c6f02ac5a 100644 --- a/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist +++ b/sysdeps/unix/sysv/linux/loongarch/lp64/libm.abilist @@ -1028,3 +1028,11 @@ GLIBC_2.36 ynf32x F GLIBC_2.36 ynf64 F GLIBC_2.36 ynf64x F GLIBC_2.36 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist index f020a8a904..0e460259f3 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.4 y1l F GLIBC_2.4 yn F GLIBC_2.4 ynf F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist index e7cd739a54..be8262bb48 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist @@ -884,3 +884,9 @@ GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F GLIBC_2.35 hypot F GLIBC_2.35 hypotf F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libm.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libm.abilist index 1f7f63f60c..cc091b2d4e 100644 --- a/sysdeps/unix/sysv/linux/microblaze/be/libm.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/be/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.35 hypotf F GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libm.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libm.abilist index 1f7f63f60c..cc091b2d4e 100644 --- a/sysdeps/unix/sysv/linux/microblaze/le/libm.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/le/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.35 hypotf F GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list index 878ce7e6a2..5760c657a6 100644 --- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list +++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list @@ -1,5 +1,3 @@ # File name Caller Syscall name Args Strong name Weak names -cacheflush EXTRA cacheflush i:iiii __cacheflush cacheflush - personality EXTRA personality Ei:i __personality personality diff --git a/sysdeps/unix/sysv/linux/mips/clone3.S b/sysdeps/unix/sysv/linux/mips/clone3.S index 481b8ae963..58925d6b41 100644 --- a/sysdeps/unix/sysv/linux/mips/clone3.S +++ b/sysdeps/unix/sysv/linux/mips/clone3.S @@ -158,4 +158,3 @@ L(thread_start_clone3): END(__thread_start_clone3) libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist index 797071aee8..4d442a989d 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F GLIBC_2.4 exp2l F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist index 14758703cf..ae7b4a7558 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist @@ -1149,3 +1149,11 @@ GLIBC_2.35 hypotf F GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/net/if_packet.h b/sysdeps/unix/sysv/linux/net/if_packet.h index 9ffb69b508..c17e1c23c5 100644 --- a/sysdeps/unix/sysv/linux/net/if_packet.h +++ b/sysdeps/unix/sysv/linux/net/if_packet.h @@ -26,7 +26,7 @@ From Linux 2.1 the AF_PACKET interface is preferred and you should consider using it in place of this one. */ -struct sockaddr_pkt +struct __attribute_struct_may_alias__ sockaddr_pkt { __SOCKADDR_COMMON (spkt_); unsigned char spkt_device[14]; diff --git a/sysdeps/unix/sysv/linux/netash/ash.h b/sysdeps/unix/sysv/linux/netash/ash.h index 7d885d17cc..7a6ff50b17 100644 --- a/sysdeps/unix/sysv/linux/netash/ash.h +++ b/sysdeps/unix/sysv/linux/netash/ash.h @@ -22,7 +22,7 @@ #include <features.h> #include <bits/sockaddr.h> -struct sockaddr_ash +struct __attribute_struct_may_alias__ sockaddr_ash { __SOCKADDR_COMMON (sash_); /* Common data: address family etc. */ int sash_ifindex; /* Interface to use. */ diff --git a/sysdeps/unix/sysv/linux/neteconet/ec.h b/sysdeps/unix/sysv/linux/neteconet/ec.h index b07a107961..f3132f06ff 100644 --- a/sysdeps/unix/sysv/linux/neteconet/ec.h +++ b/sysdeps/unix/sysv/linux/neteconet/ec.h @@ -28,7 +28,7 @@ struct ec_addr unsigned char net; /* Network number. */ }; -struct sockaddr_ec +struct __attribute_struct_may_alias__ sockaddr_ec { __SOCKADDR_COMMON (sec_); unsigned char port; /* Port number. */ diff --git a/sysdeps/unix/sysv/linux/netiucv/iucv.h b/sysdeps/unix/sysv/linux/netiucv/iucv.h index f5fad81751..27151e8bbe 100644 --- a/sysdeps/unix/sysv/linux/netiucv/iucv.h +++ b/sysdeps/unix/sysv/linux/netiucv/iucv.h @@ -23,7 +23,7 @@ __BEGIN_DECLS -struct sockaddr_iucv +struct __attribute_struct_may_alias__ sockaddr_iucv { __SOCKADDR_COMMON (siucv_); unsigned short siucv_port; /* Reserved */ diff --git a/sysdeps/unix/sysv/linux/nios2/libm.abilist b/sysdeps/unix/sysv/linux/nios2/libm.abilist index c0ebe119dc..9ed3fbdee4 100644 --- a/sysdeps/unix/sysv/linux/nios2/libm.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.35 hypotf F GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/or1k/Versions b/sysdeps/unix/sysv/linux/or1k/Versions new file mode 100644 index 0000000000..c1299de116 --- /dev/null +++ b/sysdeps/unix/sysv/linux/or1k/Versions @@ -0,0 +1,14 @@ +libc { + GLIBC_2.35 { + getcontext; + setcontext; + swapcontext; + makecontext; + } + GLIBC_2.40 { + getcontext; + setcontext; + swapcontext; + makecontext; + } +} diff --git a/sysdeps/unix/sysv/linux/or1k/getcontext-common.S b/sysdeps/unix/sysv/linux/or1k/getcontext-common.S new file mode 100644 index 0000000000..9187749615 --- /dev/null +++ b/sysdeps/unix/sysv/linux/or1k/getcontext-common.S @@ -0,0 +1,88 @@ +/* Save current context. OpenRISC common version. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* This common getcontext template helps define different + implementations using control macros. Before including + this file in another file define the following: + + __CONTEXT_FUNC_NAME + __CONTEXT_ENABLE_FPCSR + __CONTEXT_SIGMASK_OFFSET + */ + +/* int getcontext (ucontext_t *ucp) + + Returns 0 on success -1 and errno on failure. + */ + .text +ENTRY(__CONTEXT_FUNC_NAME) + /* Store r1, the stack pointer. */ + l.sw (UCONTEXT_MCONTEXT + 1*4)(r3), r1 + /* Store r2, the frame pointer. */ + l.sw (UCONTEXT_MCONTEXT + 2*4)(r3), r2 + /* Store r9, the link register. */ + l.sw (UCONTEXT_MCONTEXT + 9*4)(r3), r9 + /* Store r9 to reg[11] too, as we need two links for makecontext. */ + l.sw (UCONTEXT_MCONTEXT + 11*4)(r3), r9 + /* Store r10, the TLS register. */ + l.sw (UCONTEXT_MCONTEXT + 10*4)(r3), r10 + /* Store r14-r30 even, callee saved registers. */ + l.sw (UCONTEXT_MCONTEXT + 14*4)(r3), r14 + l.sw (UCONTEXT_MCONTEXT + 16*4)(r3), r16 + l.sw (UCONTEXT_MCONTEXT + 18*4)(r3), r18 + l.sw (UCONTEXT_MCONTEXT + 20*4)(r3), r20 + l.sw (UCONTEXT_MCONTEXT + 22*4)(r3), r22 + l.sw (UCONTEXT_MCONTEXT + 24*4)(r3), r24 + l.sw (UCONTEXT_MCONTEXT + 26*4)(r3), r26 + l.sw (UCONTEXT_MCONTEXT + 28*4)(r3), r28 + l.sw (UCONTEXT_MCONTEXT + 30*4)(r3), r30 + +#ifdef __CONTEXT_ENABLE_FPCSR +# ifdef __or1k_hard_float__ + /* Store the floating point state. */ + l.mfspr r4, r0, 20 + l.sw (MCONTEXT_FPCSR)(r3), r4 +# else + /* Store zero to indicate default rounding as per softfloat. */ + l.sw (MCONTEXT_FPCSR)(r3), r0 +# endif /* __or1k_hard_float__ */ +#endif /* __CONTEXT_ENABLE_FPCSR */ + + /* Get signal mask. */ + /* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */ + l.ori r6, r0, _NSIG8 + l.addi r5, r3, __CONTEXT_SIGMASK_OFFSET + l.ori r4, r0, 0 + l.ori r3, r0, SIG_BLOCK + l.ori r11, r0, SYS_ify (rt_sigprocmask) + /* Do the syscall. */ + l.sys 1 + l.nop + + /* if -4096 < ret < 0 holds, it's an error */ + l.sfgeui r11, 0xf001 + l.bf 1f + l.nop + + l.jr r9 + l.ori r11, r0, 0 + +1: l.j __syscall_error + l.ori r3, r11, 0 + +END(__CONTEXT_FUNC_NAME) diff --git a/sysdeps/unix/sysv/linux/or1k/getcontext.S b/sysdeps/unix/sysv/linux/or1k/getcontext.S index a25b377bda..da69e6999c 100644 --- a/sysdeps/unix/sysv/linux/or1k/getcontext.S +++ b/sysdeps/unix/sysv/linux/or1k/getcontext.S @@ -17,56 +17,35 @@ <https://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <shlib-compat.h> #include "ucontext_i.h" -/* int getcontext (ucontext_t *ucp) +#define __CONTEXT_FUNC_NAME __getcontext +#define __CONTEXT_ENABLE_FPCSR 1 +#define __CONTEXT_SIGMASK_OFFSET UCONTEXT_SIGMASK - Returns 0 on success -1 and errno on failure. - */ - .text -ENTRY(__getcontext) - /* Store r1, the stack pointer. */ - l.sw (UCONTEXT_MCONTEXT + 1*4)(r3), r1 - /* Store r2, the frame pointer. */ - l.sw (UCONTEXT_MCONTEXT + 2*4)(r3), r2 - /* Store r9, the link register. */ - l.sw (UCONTEXT_MCONTEXT + 9*4)(r3), r9 - /* Store r9 to reg[11] too, as we need two links for makecontext. */ - l.sw (UCONTEXT_MCONTEXT + 11*4)(r3), r9 - /* Store r10, the TLS register. */ - l.sw (UCONTEXT_MCONTEXT + 10*4)(r3), r10 - /* Store r14-r30 even, callee saved registers. */ - l.sw (UCONTEXT_MCONTEXT + 14*4)(r3), r14 - l.sw (UCONTEXT_MCONTEXT + 16*4)(r3), r16 - l.sw (UCONTEXT_MCONTEXT + 18*4)(r3), r18 - l.sw (UCONTEXT_MCONTEXT + 20*4)(r3), r20 - l.sw (UCONTEXT_MCONTEXT + 22*4)(r3), r22 - l.sw (UCONTEXT_MCONTEXT + 24*4)(r3), r24 - l.sw (UCONTEXT_MCONTEXT + 26*4)(r3), r26 - l.sw (UCONTEXT_MCONTEXT + 28*4)(r3), r28 - l.sw (UCONTEXT_MCONTEXT + 30*4)(r3), r30 +#include "getcontext-common.S" - /* Get signal mask. */ - /* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */ - l.ori r6, r0, _NSIG8 - l.addi r5, r3, UCONTEXT_SIGMASK - l.ori r4, r0, 0 - l.ori r3, r0, SIG_BLOCK - l.ori r11, r0, SYS_ify (rt_sigprocmask) - /* Do the syscall. */ - l.sys 1 - l.nop +versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_40) - /* if -4096 < ret < 0 holds, it's an error */ - l.sfgeui r11, 0xf001 - l.bf 1f - l.nop +#if SHLIB_COMPAT (libc, GLIBC_2_35, GLIBC_2_40) - l.jr r9 - l.ori r11, r0, 0 +/* Define a compat version of getcontext for glibc's before the fpcsr + field was added to mcontext_t. The offset sigmask changed with this + introduction, the change was done because glibc's definition of + ucontext_t was initially defined incompatible with the Linux + definition of ucontext_t. We keep the compatability definition to + allow getcontext, setcontext and swapcontext to work in older + binaries. */ -1: l.j __syscall_error - l.ori r3, r11, 0 +# undef __CONTEXT_FUNC_NAME +# undef __CONTEXT_ENABLE_FPCSR +# undef __CONTEXT_SIGMASK_OFFSET +# define __CONTEXT_FUNC_NAME __getcontext_nofpcsr +# define __CONTEXT_SIGMASK_OFFSET (UCONTEXT_SIGMASK - 4) -END(__getcontext) -weak_alias(__getcontext, getcontext) +# include "getcontext-common.S" + +compat_symbol (libc, __getcontext_nofpcsr, getcontext, GLIBC_2_35) + +#endif diff --git a/sysdeps/unix/sysv/linux/or1k/libc.abilist b/sysdeps/unix/sysv/linux/or1k/libc.abilist index c40c843aaf..959e59e7e7 100644 --- a/sysdeps/unix/sysv/linux/or1k/libc.abilist +++ b/sysdeps/unix/sysv/linux/or1k/libc.abilist @@ -2255,3 +2255,7 @@ GLIBC_2.39 stdc_trailing_zeros_ui F GLIBC_2.39 stdc_trailing_zeros_ul F GLIBC_2.39 stdc_trailing_zeros_ull F GLIBC_2.39 stdc_trailing_zeros_us F +GLIBC_2.40 getcontext F +GLIBC_2.40 makecontext F +GLIBC_2.40 setcontext F +GLIBC_2.40 swapcontext F diff --git a/sysdeps/unix/sysv/linux/or1k/libm.abilist b/sysdeps/unix/sysv/linux/or1k/libm.abilist index 9d26508ff5..69655f7d23 100644 --- a/sysdeps/unix/sysv/linux/or1k/libm.abilist +++ b/sysdeps/unix/sysv/linux/or1k/libm.abilist @@ -757,3 +757,9 @@ GLIBC_2.35 ynf32 F GLIBC_2.35 ynf32x F GLIBC_2.35 ynf64 F GLIBC_2.35 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/or1k/makecontext.c b/sysdeps/unix/sysv/linux/or1k/makecontext.c index fa6626e7de..7e131bae41 100644 --- a/sysdeps/unix/sysv/linux/or1k/makecontext.c +++ b/sysdeps/unix/sysv/linux/or1k/makecontext.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#include <shlib-compat.h> #include <sysdep.h> #include <stdarg.h> #include <stdint.h> @@ -36,12 +37,11 @@ r1 : stack pointer r2 : frame pointer, set to NULL */ -void -__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) +static void +do_makecontext (ucontext_t *ucp, void (*startcontext) (void), + void (*func) (void), int argc, va_list ap) { - extern void __startcontext (void); unsigned long int *sp; - va_list ap; int i; sp = (unsigned long int *) @@ -55,8 +55,8 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) /* Keep uc_link in r14. */ ucp->uc_mcontext.__gprs[14] = (uintptr_t) ucp->uc_link; - /* Return address points to function __startcontext. */ - ucp->uc_mcontext.__gprs[9] = (uintptr_t) &__startcontext; + /* Return address points to function startcontext. */ + ucp->uc_mcontext.__gprs[9] = (uintptr_t) startcontext; /* Frame pointer is null. */ ucp->uc_mcontext.__gprs[2] = (uintptr_t) 0; /* Restart in user-space starting at 'func'. */ @@ -64,14 +64,47 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) /* Set stack pointer. */ ucp->uc_mcontext.__gprs[1] = (uintptr_t) sp; - va_start (ap, argc); for (i = 0; i < argc; ++i) if (i < 6) ucp->uc_mcontext.__gprs[i + 3] = va_arg (ap, unsigned long int); else sp[i - 6] = va_arg (ap, unsigned long int); +} +void +__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) +{ + extern void __startcontext (void); + va_list ap; + + va_start (ap, argc); + do_makecontext (ucp, &__startcontext, func, argc, ap); va_end (ap); } -weak_alias (__makecontext, makecontext) +versioned_symbol (libc, __makecontext, makecontext, GLIBC_2_40); + +#if SHLIB_COMPAT (libc, GLIBC_2_35, GLIBC_2_40) + +/* Define a compat version of makecontext for glibc's before the fpcsr + field was added to mcontext_t. The offset sigmask changed with this + introduction, the change was done because glibc's definition of + ucontext_t was initially defined incompatible with the Linux + definition of ucontext_t. We keep the compatability definition to + allow getcontext, setcontext and swapcontext to work in older + binaries. */ + +void +__makecontext_nofpcsr (ucontext_t *ucp, void (*func) (void), int argc, ...) +{ + extern void __startcontext_nofpcsr (void); + va_list ap; + + va_start (ap, argc); + do_makecontext (ucp, &__startcontext_nofpcsr, func, argc, ap); + va_end (ap); +} + +compat_symbol (libc, __makecontext_nofpcsr, makecontext, GLIBC_2_35); + +#endif diff --git a/sysdeps/unix/sysv/linux/or1k/setcontext-common.S b/sysdeps/unix/sysv/linux/or1k/setcontext-common.S new file mode 100644 index 0000000000..8a4f147513 --- /dev/null +++ b/sysdeps/unix/sysv/linux/or1k/setcontext-common.S @@ -0,0 +1,120 @@ +/* Set current context. OpenRISC common version. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* This common setcontext and startcontext template helps define + different implementations using control macros. Before including + this file in another file define the following: + + __CONTEXT_FUNC_NAME + __CONTEXT_ENABLE_FPCSR + __CONTEXT_SIGMASK_OFFSET + __STARTCONTEXT_FUNC_NAME + */ + +/* int setcontext (const ucontext_t *ucp) */ + .text +ENTRY(__CONTEXT_FUNC_NAME) + l.ori r30, r3, 0 + + /* Restore signal mask. */ + /* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */ + l.ori r6, r0, _NSIG8 + l.ori r5, r0, 0 + l.addi r4, r3, __CONTEXT_SIGMASK_OFFSET + l.ori r3, r0, SIG_SETMASK + l.ori r11, r0, SYS_ify (rt_sigprocmask) + /* Do the syscall. */ + l.sys 1 + l.nop + + /* if -4096 < ret < 0 holds, it's an error */ + l.sfgeui r11, 0xf001 + l.bf 1f + l.nop +#ifdef __CONTEXT_ENABLE_FPCSR +# ifdef __or1k_hard_float__ + /* Restore the floating point state. */ + l.lwz r28, (MCONTEXT_FPCSR)(r30) + l.mtspr r0, r28, 20 +# endif /* __or1k_hard_float__ */ +#endif /* __CONTEXT_ENABLE_FPCSR */ + /* Restore argument registers, for the makecontext case. */ + l.lwz r3, (UCONTEXT_MCONTEXT + 3*4)(r30) + l.lwz r4, (UCONTEXT_MCONTEXT + 4*4)(r30) + l.lwz r5, (UCONTEXT_MCONTEXT + 5*4)(r30) + l.lwz r6, (UCONTEXT_MCONTEXT + 6*4)(r30) + l.lwz r7, (UCONTEXT_MCONTEXT + 7*4)(r30) + l.lwz r8, (UCONTEXT_MCONTEXT + 8*4)(r30) + + /* Restore registers stored in getcontext. */ + l.lwz r1, (UCONTEXT_MCONTEXT + 1*4)(r30) + l.lwz r2, (UCONTEXT_MCONTEXT + 2*4)(r30) + l.lwz r9, (UCONTEXT_MCONTEXT + 9*4)(r30) + l.lwz r10, (UCONTEXT_MCONTEXT + 10*4)(r30) + l.lwz r11, (UCONTEXT_MCONTEXT + 11*4)(r30) + /* Restore r14-r30 even, callee saved registers. */ + l.lwz r14, (UCONTEXT_MCONTEXT + 14*4)(r30) + l.lwz r16, (UCONTEXT_MCONTEXT + 16*4)(r30) + l.lwz r18, (UCONTEXT_MCONTEXT + 18*4)(r30) + l.lwz r20, (UCONTEXT_MCONTEXT + 20*4)(r30) + l.lwz r22, (UCONTEXT_MCONTEXT + 22*4)(r30) + l.lwz r24, (UCONTEXT_MCONTEXT + 24*4)(r30) + l.lwz r26, (UCONTEXT_MCONTEXT + 26*4)(r30) + l.lwz r28, (UCONTEXT_MCONTEXT + 28*4)(r30) + l.lwz r30, (UCONTEXT_MCONTEXT + 30*4)(r30) + + l.jr r11 + l.ori r11, r0, 0 + +1: l.j __syscall_error + l.ori r3, r11, 0 + +END (__CONTEXT_FUNC_NAME) + + /* We add a NOP here because when the unwinder is looking for the + enclosing function of the link register (r9) address FDE lookup will + use '$r9 - 1' finding setcontext which is wrong. This is because in + makecontext we have set r9 to the start of &__startcontext. + + If this NOP did not exist the unwinder would repeatedly find + __setcontext's FDE in an infinite loop. Modifying/deleting the below + __startcontext's FDE has no help on this. */ + l.nop + +ENTRY(__STARTCONTEXT_FUNC_NAME) + + l.ori r3, r14, 0 + l.sfeq r3, r0 + /* If uc_link is not 0 resume there, otherwise exit. */ + l.bnf __CONTEXT_FUNC_NAME + l.nop + +#ifdef SHARED + /* Obtain a pointer to .got in r16 */ + l.jal 0x8 + l.movhi r16, gotpchi(_GLOBAL_OFFSET_TABLE_-4) + l.ori r16, r16, gotpclo(_GLOBAL_OFFSET_TABLE_+0) + l.add r16, r16, r9 + l.lwz r16, got(exit)(r16) + l.jr r16 +#else + l.j exit +#endif + l.nop + +END(__STARTCONTEXT_FUNC_NAME) diff --git a/sysdeps/unix/sysv/linux/or1k/setcontext.S b/sysdeps/unix/sysv/linux/or1k/setcontext.S index d28a0ac0aa..a49a5c51c3 100644 --- a/sysdeps/unix/sysv/linux/or1k/setcontext.S +++ b/sysdeps/unix/sysv/linux/or1k/setcontext.S @@ -16,93 +16,39 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#include <shlib-compat.h> #include <sysdep.h> #include "ucontext_i.h" -/* int setcontext (const ucontext_t *ucp) */ - .text -ENTRY(__setcontext) - l.ori r30, r3, 0 +#define __CONTEXT_FUNC_NAME __setcontext +#define __CONTEXT_ENABLE_FPCSR 1 +#define __CONTEXT_SIGMASK_OFFSET UCONTEXT_SIGMASK +#define __STARTCONTEXT_FUNC_NAME __startcontext - /* Restore signal mask. */ - /* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */ - l.ori r6, r0, _NSIG8 - l.ori r5, r0, 0 - l.addi r4, r3, UCONTEXT_SIGMASK - l.ori r3, r0, SIG_SETMASK - l.ori r11, r0, SYS_ify (rt_sigprocmask) - /* Do the syscall. */ - l.sys 1 - l.nop +#include "setcontext-common.S" - /* if -4096 < ret < 0 holds, it's an error */ - l.sfgeui r11, 0xf001 - l.bf 1f - l.nop +versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_40) - /* Restore argument registers, for the makecontext case. */ - l.lwz r3, (UCONTEXT_MCONTEXT + 3*4)(r30) - l.lwz r4, (UCONTEXT_MCONTEXT + 4*4)(r30) - l.lwz r5, (UCONTEXT_MCONTEXT + 5*4)(r30) - l.lwz r6, (UCONTEXT_MCONTEXT + 6*4)(r30) - l.lwz r7, (UCONTEXT_MCONTEXT + 7*4)(r30) - l.lwz r8, (UCONTEXT_MCONTEXT + 8*4)(r30) +#if SHLIB_COMPAT (libc, GLIBC_2_35, GLIBC_2_40) - /* Restore registers stored in getcontext. */ - l.lwz r1, (UCONTEXT_MCONTEXT + 1*4)(r30) - l.lwz r2, (UCONTEXT_MCONTEXT + 2*4)(r30) - l.lwz r9, (UCONTEXT_MCONTEXT + 9*4)(r30) - l.lwz r10, (UCONTEXT_MCONTEXT + 10*4)(r30) - l.lwz r11, (UCONTEXT_MCONTEXT + 11*4)(r30) - /* Restore r14-r30 even, callee saved registers. */ - l.lwz r14, (UCONTEXT_MCONTEXT + 14*4)(r30) - l.lwz r16, (UCONTEXT_MCONTEXT + 16*4)(r30) - l.lwz r18, (UCONTEXT_MCONTEXT + 18*4)(r30) - l.lwz r20, (UCONTEXT_MCONTEXT + 20*4)(r30) - l.lwz r22, (UCONTEXT_MCONTEXT + 22*4)(r30) - l.lwz r24, (UCONTEXT_MCONTEXT + 24*4)(r30) - l.lwz r26, (UCONTEXT_MCONTEXT + 26*4)(r30) - l.lwz r28, (UCONTEXT_MCONTEXT + 28*4)(r30) - l.lwz r30, (UCONTEXT_MCONTEXT + 30*4)(r30) +/* Define a compat version of setcontext for glibc's before the fpcsr + field was added to mcontext_t. The offset sigmask changed with this + introduction, the change was done because glibc's definition of + ucontext_t was initially defined incompatible with the Linux + definition of ucontext_t. We keep the compatability definition to + allow getcontext, setcontext and swapcontext to work in older + binaries. */ - l.jr r11 - l.ori r11, r0, 0 +# undef __CONTEXT_FUNC_NAME +# undef __CONTEXT_ENABLE_FPCSR +# undef __CONTEXT_SIGMASK_OFFSET +# undef __STARTCONTEXT_FUNC_NAME +# define __CONTEXT_FUNC_NAME __setcontext_nofpcsr +# define __CONTEXT_SIGMASK_OFFSET (UCONTEXT_SIGMASK - 4) +# define __STARTCONTEXT_FUNC_NAME __startcontext_nofpcsr -1: l.j __syscall_error - l.ori r3, r11, 0 +# include "setcontext-common.S" -END (__setcontext) -weak_alias (__setcontext, setcontext) +compat_symbol (libc, __setcontext_nofpcsr, setcontext, GLIBC_2_35) - /* We add a NOP here because when the unwinder is looking for the - enclosing function of the link register (r9) address FDE lookup will - use '$r9 - 1' finding setcontext which is wrong. This is because in - makecontext we have set r9 to the start of &__startcontext. - - If this NOP did not exist the unwinder would repeatedly find - __setcontext's FDE in an infinite loop. Modifying/deleting the below - __startcontext's FDE has no help on this. */ - l.nop - -ENTRY(__startcontext) - - l.ori r3, r14, 0 - l.sfeq r3, r0 - /* If uc_link is not 0 resume there, otherwise exit. */ - l.bnf __setcontext - l.nop - -#ifdef SHARED - /* Obtain a pointer to .got in r16 */ - l.jal 0x8 - l.movhi r16, gotpchi(_GLOBAL_OFFSET_TABLE_-4) - l.ori r16, r16, gotpclo(_GLOBAL_OFFSET_TABLE_+0) - l.add r16, r16, r9 - l.lwz r16, got(exit)(r16) - l.jr r16 -#else - l.j exit #endif - l.nop - -END(__startcontext) diff --git a/sysdeps/unix/sysv/linux/or1k/swapcontext-common.S b/sysdeps/unix/sysv/linux/or1k/swapcontext-common.S new file mode 100644 index 0000000000..b7e2d4c820 --- /dev/null +++ b/sysdeps/unix/sysv/linux/or1k/swapcontext-common.S @@ -0,0 +1,139 @@ +/* Swap two contexts. OpenRISC version. + Copyright (C) 2022-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* This common swapcontext template helps define different + implementations using control macros. Before including this file + in another file define the following: + + __CONTEXT_FUNC_NAME + __CONTEXT_ENABLE_FPCSR + __CONTEXT_SIGMASK_OFFSET + */ + +/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */ + .text +ENTRY(__CONTEXT_FUNC_NAME) + + /* Same as getcontext. */ + /* Store r1, the stack pointer. */ + l.sw (UCONTEXT_MCONTEXT + 1*4)(r3), r1 + /* Store r2, the frame pointer. */ + l.sw (UCONTEXT_MCONTEXT + 2*4)(r3), r2 + /* Store r9, the link register. */ + l.sw (UCONTEXT_MCONTEXT + 9*4)(r3), r9 + /* Store r9 to reg[11] too, as we need two links for makecontext. */ + l.sw (UCONTEXT_MCONTEXT + 11*4)(r3), r9 + /* Store r10, the TLS register. */ + l.sw (UCONTEXT_MCONTEXT + 10*4)(r3), r10 + /* Store r14-r30 even, callee saved registers. */ + l.sw (UCONTEXT_MCONTEXT + 14*4)(r3), r14 + l.sw (UCONTEXT_MCONTEXT + 16*4)(r3), r16 + l.sw (UCONTEXT_MCONTEXT + 18*4)(r3), r18 + l.sw (UCONTEXT_MCONTEXT + 20*4)(r3), r20 + l.sw (UCONTEXT_MCONTEXT + 22*4)(r3), r22 + l.sw (UCONTEXT_MCONTEXT + 24*4)(r3), r24 + l.sw (UCONTEXT_MCONTEXT + 26*4)(r3), r26 + l.sw (UCONTEXT_MCONTEXT + 28*4)(r3), r28 + l.sw (UCONTEXT_MCONTEXT + 30*4)(r3), r30 + +#ifdef __CONTEXT_ENABLE_FPCSR +# ifdef __or1k_hard_float__ + /* Store the floating point state. */ + l.mfspr r6, r0, 20 + l.sw (MCONTEXT_FPCSR)(r3), r6 +# else + /* Store zero to indicate default rounding as per softfloat. */ + l.sw (MCONTEXT_FPCSR)(r3), r0 +# endif /* __or1k_hard_float__ */ +#endif /* __CONTEXT_ENABLE_FPCSR */ + /* Store ucp to non-argument syscall preserved register. */ + l.ori r30, r4, 0 + + /* Get signal mask. */ + /* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */ + l.ori r6, r0, _NSIG8 + l.addi r5, r3, __CONTEXT_SIGMASK_OFFSET + l.ori r4, r0, 0 + l.ori r3, r0, SIG_BLOCK + l.ori r11, r0, SYS_ify (rt_sigprocmask) + /* Do the syscall. */ + l.sys 1 + l.nop + + /* if -4096 < ret < 0 holds, it's an error */ + l.sfgeui r11, 0xf001 + l.bf 1f + l.nop + + /* Same as setcontext. */ + + /* Restore signal mask. */ + /* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */ + l.ori r6, r0, _NSIG8 + l.ori r5, r0, 0 + l.addi r4, r30, __CONTEXT_SIGMASK_OFFSET + l.ori r3, r0, SIG_SETMASK + l.ori r11, r0, SYS_ify (rt_sigprocmask) + /* Do the syscall. */ + l.sys 1 + l.nop + + /* if -4096 < ret < 0 holds, it's an error */ + l.sfgeui r11, 0xf001 + l.bf 1f + l.nop + +#ifdef __CONTEXT_ENABLE_FPCSR +# ifdef __or1k_hard_float__ + /* Restore the floating point state. */ + l.lwz r28, (MCONTEXT_FPCSR)(r30) + l.mtspr r0, r28, 20 +# endif /* __or1k_hard_float__ */ +#endif /* __CONTEXT_ENABLE_FPCSR */ + + /* Restore argument registers, for the makecontext case. */ + l.lwz r3, (UCONTEXT_MCONTEXT + 3*4)(r30) + l.lwz r4, (UCONTEXT_MCONTEXT + 4*4)(r30) + l.lwz r5, (UCONTEXT_MCONTEXT + 5*4)(r30) + l.lwz r6, (UCONTEXT_MCONTEXT + 6*4)(r30) + l.lwz r7, (UCONTEXT_MCONTEXT + 7*4)(r30) + l.lwz r8, (UCONTEXT_MCONTEXT + 8*4)(r30) + + /* Restore registers stored in getcontext. */ + l.lwz r1, (UCONTEXT_MCONTEXT + 1*4)(r30) + l.lwz r2, (UCONTEXT_MCONTEXT + 2*4)(r30) + l.lwz r9, (UCONTEXT_MCONTEXT + 9*4)(r30) + l.lwz r10, (UCONTEXT_MCONTEXT + 10*4)(r30) + l.lwz r11, (UCONTEXT_MCONTEXT + 11*4)(r30) + l.lwz r14, (UCONTEXT_MCONTEXT + 14*4)(r30) + l.lwz r16, (UCONTEXT_MCONTEXT + 16*4)(r30) + l.lwz r18, (UCONTEXT_MCONTEXT + 18*4)(r30) + l.lwz r20, (UCONTEXT_MCONTEXT + 20*4)(r30) + l.lwz r22, (UCONTEXT_MCONTEXT + 22*4)(r30) + l.lwz r24, (UCONTEXT_MCONTEXT + 24*4)(r30) + l.lwz r26, (UCONTEXT_MCONTEXT + 26*4)(r30) + l.lwz r28, (UCONTEXT_MCONTEXT + 28*4)(r30) + l.lwz r30, (UCONTEXT_MCONTEXT + 30*4)(r30) + + l.jr r11 + l.ori r11, r0, 0 + +1: l.j __syscall_error + l.ori r3, r11, 0 + +END (__CONTEXT_FUNC_NAME) diff --git a/sysdeps/unix/sysv/linux/or1k/swapcontext.S b/sysdeps/unix/sysv/linux/or1k/swapcontext.S index d09651a5b2..861c1e26ba 100644 --- a/sysdeps/unix/sysv/linux/or1k/swapcontext.S +++ b/sysdeps/unix/sysv/linux/or1k/swapcontext.S @@ -16,101 +16,36 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#include <shlib-compat.h> #include <sysdep.h> #include "ucontext_i.h" -/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */ - .text -ENTRY(__swapcontext) +#define __CONTEXT_FUNC_NAME __swapcontext +#define __CONTEXT_ENABLE_FPCSR 1 +#define __CONTEXT_SIGMASK_OFFSET UCONTEXT_SIGMASK - /* Same as getcontext. */ - /* Store r1, the stack pointer. */ - l.sw (UCONTEXT_MCONTEXT + 1*4)(r3), r1 - /* Store r2, the frame pointer. */ - l.sw (UCONTEXT_MCONTEXT + 2*4)(r3), r2 - /* Store r9, the link register. */ - l.sw (UCONTEXT_MCONTEXT + 9*4)(r3), r9 - /* Store r9 to reg[11] too, as we need two links for makecontext. */ - l.sw (UCONTEXT_MCONTEXT + 11*4)(r3), r9 - /* Store r10, the TLS register. */ - l.sw (UCONTEXT_MCONTEXT + 10*4)(r3), r10 - /* Store r14-r30 even, callee saved registers. */ - l.sw (UCONTEXT_MCONTEXT + 14*4)(r3), r14 - l.sw (UCONTEXT_MCONTEXT + 16*4)(r3), r16 - l.sw (UCONTEXT_MCONTEXT + 18*4)(r3), r18 - l.sw (UCONTEXT_MCONTEXT + 20*4)(r3), r20 - l.sw (UCONTEXT_MCONTEXT + 22*4)(r3), r22 - l.sw (UCONTEXT_MCONTEXT + 24*4)(r3), r24 - l.sw (UCONTEXT_MCONTEXT + 26*4)(r3), r26 - l.sw (UCONTEXT_MCONTEXT + 28*4)(r3), r28 - l.sw (UCONTEXT_MCONTEXT + 30*4)(r3), r30 +#include "swapcontext-common.S" - /* Store ucp to non-argument syscall preserved register. */ - l.ori r30, r4, 0 +versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_40) - /* Get signal mask. */ - /* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */ - l.ori r6, r0, _NSIG8 - l.addi r5, r3, UCONTEXT_SIGMASK - l.ori r4, r0, 0 - l.ori r3, r0, SIG_BLOCK - l.ori r11, r0, SYS_ify (rt_sigprocmask) - /* Do the syscall. */ - l.sys 1 - l.nop +#if SHLIB_COMPAT (libc, GLIBC_2_35, GLIBC_2_40) - /* if -4096 < ret < 0 holds, it's an error */ - l.sfgeui r11, 0xf001 - l.bf 1f - l.nop +/* Define a compat version of swapcontext for glibc's before the fpcsr + field was added to mcontext_t. The offset sigmask changed with this + introduction, the change was done because glibc's definition of + ucontext_t was initially defined incompatible with the Linux + definition of ucontext_t. We keep the compatability definition to + allow getcontext, setcontext and swapcontext to work in older + binaries. */ - /* Same as setcontext. */ +# undef __CONTEXT_FUNC_NAME +# undef __CONTEXT_ENABLE_FPCSR +# undef __CONTEXT_SIGMASK_OFFSET +# define __CONTEXT_FUNC_NAME __swapcontext_nofpcsr +# define __CONTEXT_SIGMASK_OFFSET (UCONTEXT_SIGMASK - 4) - /* Restore signal mask. */ - /* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */ - l.ori r6, r0, _NSIG8 - l.ori r5, r0, 0 - l.addi r4, r30, UCONTEXT_SIGMASK - l.ori r3, r0, SIG_SETMASK - l.ori r11, r0, SYS_ify (rt_sigprocmask) - /* Do the syscall. */ - l.sys 1 - l.nop +# include "swapcontext-common.S" - /* if -4096 < ret < 0 holds, it's an error */ - l.sfgeui r11, 0xf001 - l.bf 1f - l.nop +compat_symbol (libc, __swapcontext_nofpcsr, swapcontext, GLIBC_2_35) - /* Restore argument registers, for the makecontext case. */ - l.lwz r3, (UCONTEXT_MCONTEXT + 3*4)(r30) - l.lwz r4, (UCONTEXT_MCONTEXT + 4*4)(r30) - l.lwz r5, (UCONTEXT_MCONTEXT + 5*4)(r30) - l.lwz r6, (UCONTEXT_MCONTEXT + 6*4)(r30) - l.lwz r7, (UCONTEXT_MCONTEXT + 7*4)(r30) - l.lwz r8, (UCONTEXT_MCONTEXT + 8*4)(r30) - - /* Restore registers stored in getcontext. */ - l.lwz r1, (UCONTEXT_MCONTEXT + 1*4)(r30) - l.lwz r2, (UCONTEXT_MCONTEXT + 2*4)(r30) - l.lwz r9, (UCONTEXT_MCONTEXT + 9*4)(r30) - l.lwz r10, (UCONTEXT_MCONTEXT + 10*4)(r30) - l.lwz r11, (UCONTEXT_MCONTEXT + 11*4)(r30) - l.lwz r14, (UCONTEXT_MCONTEXT + 14*4)(r30) - l.lwz r16, (UCONTEXT_MCONTEXT + 16*4)(r30) - l.lwz r18, (UCONTEXT_MCONTEXT + 18*4)(r30) - l.lwz r20, (UCONTEXT_MCONTEXT + 20*4)(r30) - l.lwz r22, (UCONTEXT_MCONTEXT + 22*4)(r30) - l.lwz r24, (UCONTEXT_MCONTEXT + 24*4)(r30) - l.lwz r26, (UCONTEXT_MCONTEXT + 26*4)(r30) - l.lwz r28, (UCONTEXT_MCONTEXT + 28*4)(r30) - l.lwz r30, (UCONTEXT_MCONTEXT + 30*4)(r30) - - l.jr r11 - l.ori r11, r0, 0 - -1: l.j __syscall_error - l.ori r3, r11, 0 - -END (__swapcontext) -weak_alias (__swapcontext, swapcontext) +#endif diff --git a/sysdeps/unix/sysv/linux/or1k/sys/ucontext.h b/sysdeps/unix/sysv/linux/or1k/sys/ucontext.h index b17e919154..1b428592ee 100644 --- a/sysdeps/unix/sysv/linux/or1k/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/or1k/sys/ucontext.h @@ -38,6 +38,7 @@ typedef struct unsigned long int __gprs[__NGREG]; unsigned long int __pc; unsigned long int __sr; + unsigned long int __fpcsr; } mcontext_t; /* Userlevel context. */ diff --git a/sysdeps/unix/sysv/linux/or1k/ucontext_i.sym b/sysdeps/unix/sysv/linux/or1k/ucontext_i.sym index a8d4db080f..45cd72527d 100644 --- a/sysdeps/unix/sysv/linux/or1k/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/or1k/ucontext_i.sym @@ -13,6 +13,7 @@ _NSIG8 (_NSIG / 8) -- Offsets of the fields in the ucontext_t structure. #define ucontext(member) offsetof (ucontext_t, member) #define stack(member) ucontext (uc_stack.member) +#define mcontext(member) ucontext (uc_mcontext.member) UCONTEXT_LINK ucontext (uc_link) UCONTEXT_STACK ucontext (uc_stack) @@ -23,4 +24,6 @@ STACK_SP stack (ss_sp) STACK_SIZE stack (ss_size) STACK_FLAGS stack (ss_flags) +MCONTEXT_FPCSR mcontext (__fpcsr) + UCONTEXT_SIZE sizeof (ucontext_t) diff --git a/sysdeps/unix/sysv/linux/pidfd_getpid.c b/sysdeps/unix/sysv/linux/pidfd_getpid.c index 8567b413dd..6967477fab 100644 --- a/sysdeps/unix/sysv/linux/pidfd_getpid.c +++ b/sysdeps/unix/sysv/linux/pidfd_getpid.c @@ -74,8 +74,10 @@ parse_fdinfo (const char *l, void *arg) /* Ignore invalid large values. */ if (INT_MULTIPLY_WRAPV (10, n, &n) - || INT_ADD_WRAPV (n, *l++ - '0', &n)) + || INT_ADD_WRAPV (n, *l - '0', &n)) return -1; + + l++; } /* -1 indicates that the process is terminated. */ @@ -105,7 +107,7 @@ pidfd_getpid (int fd) *_fitoa_word (fd, p, 10, 0) = '\0'; struct parse_fdinfo_t fdinfo = { .found = false, .pid = -1 }; - if (!procutils_read_file (fdinfoname, parse_fdinfo, &fdinfo)) + if (!__libc_procutils_read_file (fdinfoname, parse_fdinfo, &fdinfo)) /* The fdinfo contains an invalid 'Pid:' value. */ return INLINE_SYSCALL_ERROR_RETURN_VALUE (EBADF); diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist index 4f88e0af9c..564eb87d4b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist @@ -995,3 +995,9 @@ GLIBC_2.4 truncl F GLIBC_2.4 y0l F GLIBC_2.4 y1l F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist index edc26140dc..a57eedb779 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist @@ -994,3 +994,9 @@ GLIBC_2.4 truncl F GLIBC_2.4 y0l F GLIBC_2.4 y1l F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist index 0a8a1433d7..7564069a37 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist @@ -988,3 +988,9 @@ GLIBC_2.4 truncl F GLIBC_2.4 y0l F GLIBC_2.4 y1l F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone3.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone3.S index 6fdb4a6073..900c354c9c 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone3.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone3.S @@ -154,4 +154,3 @@ L(parent): PSEUDO_END (__clone3) libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist index 5174d20032..b02a7115af 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist @@ -1321,3 +1321,12 @@ GLIBC_2.35 hypotf F GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F +GLIBC_2.40 __log2p1ieee128 F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/procutils.c b/sysdeps/unix/sysv/linux/procutils.c index 25666ec0cb..86d3d37329 100644 --- a/sysdeps/unix/sysv/linux/procutils.c +++ b/sysdeps/unix/sysv/linux/procutils.c @@ -71,8 +71,9 @@ next_line (char **r, int fd, char *const buffer, char **cp, char **re, } bool -procutils_read_file (const char *filename, procutils_closure_t closure, - void *arg) +__libc_procutils_read_file (const char *filename, + procutils_closure_t closure, + void *arg) { enum { buffer_size = PROCUTILS_MAX_LINE_LEN }; char buffer[buffer_size]; diff --git a/sysdeps/unix/sysv/linux/procutils.h b/sysdeps/unix/sysv/linux/procutils.h index 73ef3e5f5b..acf1ec587a 100644 --- a/sysdeps/unix/sysv/linux/procutils.h +++ b/sysdeps/unix/sysv/linux/procutils.h @@ -37,7 +37,8 @@ typedef int (*procutils_closure_t) (const char *line, void *arg); It returns true in case the file is fully read or false if CLOSURE returns a value diferent than 0. */ -bool procutils_read_file (const char *filename, procutils_closure_t closure, - void *arg) attribute_hidden; +bool __libc_procutils_read_file (const char *filename, + procutils_closure_t closure, + void *arg) attribute_hidden; #endif diff --git a/sysdeps/unix/sysv/linux/riscv/clone3.S b/sysdeps/unix/sysv/linux/riscv/clone3.S index 29264be054..c81ee2ab51 100644 --- a/sysdeps/unix/sysv/linux/riscv/clone3.S +++ b/sysdeps/unix/sysv/linux/riscv/clone3.S @@ -76,4 +76,3 @@ L(thread_start): END(__thread_start_clone3) libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist index 45ca5c677a..7bf0bd7c7a 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libm.abilist @@ -1028,3 +1028,11 @@ GLIBC_2.35 fminimumf64x F GLIBC_2.35 fminimuml F GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist index 4838edf991..c22d9bb7c6 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist @@ -1125,3 +1125,11 @@ GLIBC_2.35 fminimumf64x F GLIBC_2.35 fminimuml F GLIBC_2.35 fsqrt F GLIBC_2.35 fsqrtl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile index 6b6d59b7dd..2a5b4fbb6f 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile +++ b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile @@ -3,6 +3,7 @@ default-abi := 32 ifeq ($(subdir),login) sysdep_routines += utmp32 utmpx32 login32 +shared-only-routines += utmp32 utmpx32 login32 endif ifeq ($(subdir),misc) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/clone3.S b/sysdeps/unix/sysv/linux/s390/s390-32/clone3.S index d344c2cf36..1ea633aabb 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/clone3.S +++ b/sysdeps/unix/sysv/linux/s390/s390-32/clone3.S @@ -75,4 +75,3 @@ thread_start: ASM_SIZE_DIRECTIVE (thread_start) libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist index 5ff11fb54f..2fb712ec71 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist @@ -1252,3 +1252,11 @@ GLIBC_2.4 truncl F GLIBC_2.4 y0l F GLIBC_2.4 y1l F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone3.S b/sysdeps/unix/sysv/linux/s390/s390-64/clone3.S index ca382d903c..70ae7f1532 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/clone3.S +++ b/sysdeps/unix/sysv/linux/s390/s390-64/clone3.S @@ -75,4 +75,3 @@ thread_start: ASM_SIZE_DIRECTIVE (thread_start) libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist index 0e246c2c54..40489589a7 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist @@ -1252,3 +1252,11 @@ GLIBC_2.4 truncl F GLIBC_2.4 y0l F GLIBC_2.4 y1l F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/sh/be/libm.abilist b/sysdeps/unix/sysv/linux/sh/be/libm.abilist index 7b43a866e2..a5363e90d6 100644 --- a/sysdeps/unix/sysv/linux/sh/be/libm.abilist +++ b/sysdeps/unix/sysv/linux/sh/be/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F GLIBC_2.4 exp2l F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/sh/le/libm.abilist b/sysdeps/unix/sysv/linux/sh/le/libm.abilist index 7b43a866e2..a5363e90d6 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libm.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libm.abilist @@ -848,3 +848,9 @@ GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F GLIBC_2.4 exp2l F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist index e3dcf3d4e7..9bda9bdeb5 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist @@ -1259,3 +1259,11 @@ GLIBC_2.4 truncl F GLIBC_2.4 y0l F GLIBC_2.4 y1l F GLIBC_2.4 ynl F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist index 20fef20c8b..61d2aa05a9 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist @@ -1149,3 +1149,11 @@ GLIBC_2.35 hypotf F GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h index fc8dce45c8..45e546fa44 100644 --- a/sysdeps/unix/sysv/linux/sys/epoll.h +++ b/sysdeps/unix/sysv/linux/sys/epoll.h @@ -19,6 +19,7 @@ #define _SYS_EPOLL_H 1 #include <stdint.h> +#include <sys/ioctl.h> #include <sys/types.h> #include <bits/types/sigset_t.h> @@ -87,6 +88,19 @@ struct epoll_event epoll_data_t data; /* User data variable */ } __EPOLL_PACKED; +struct epoll_params +{ + uint32_t busy_poll_usecs; + uint16_t busy_poll_budget; + uint8_t prefer_busy_poll; + + /* pad the struct to a multiple of 64bits */ + uint8_t __pad; +}; + +#define EPOLL_IOC_TYPE 0x8A +#define EPIOCSPARAMS _IOW(EPOLL_IOC_TYPE, 0x01, struct epoll_params) +#define EPIOCGPARAMS _IOR(EPOLL_IOC_TYPE, 0x02, struct epoll_params) __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/pidfd.h b/sysdeps/unix/sysv/linux/sys/pidfd.h index 1078322062..9f88d297e8 100644 --- a/sysdeps/unix/sysv/linux/sys/pidfd.h +++ b/sysdeps/unix/sysv/linux/sys/pidfd.h @@ -22,12 +22,14 @@ #include <bits/types/siginfo_t.h> #define PIDFD_NONBLOCK O_NONBLOCK +#define PIDFD_THREAD O_EXCL -/* Returns a file descriptor that refers to the process PID. The - close-on-exec is set on the file descriptor. +#define PIDFD_SIGNAL_THREAD (1UL << 0) +#define PIDFD_SIGNAL_THREAD_GROUP (1UL << 1) +#define PIDFD_SIGNAL_PROCESS_GROUP (1UL << 2) - The FLAGS argument is reserved for future use, it must be specified - as 0. */ +/* Returns a file descriptor that refers to the process PID. The + close-on-exec is set on the file descriptor. */ extern int pidfd_open (__pid_t __pid, unsigned int __flags) __THROW; /* Duplicates an existing file descriptor TARGETFD in the process referred @@ -39,10 +41,7 @@ extern int pidfd_getfd (int __pidfd, int __targetfd, unsigned int __flags) __THROW; /* Sends the signal SIG to the target process referred by the PIDFD. If - INFO points to a siginfo_t buffer, it will be populated. - - The FLAGS argument is reserved for future use, it must be specified - as 0. */ + INFO points to a siginfo_t buffer, it will be populated. */ extern int pidfd_send_signal (int __pidfd, int __sig, siginfo_t *__info, unsigned int __flags) __THROW; diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list index 6557bcfde4..672d39eaad 100644 --- a/sysdeps/unix/sysv/linux/syscall-names.list +++ b/sysdeps/unix/sysv/linux/syscall-names.list @@ -21,8 +21,8 @@ # This file can list all potential system calls. The names are only # used if the installed kernel headers also provide them. -# The list of system calls is current as of Linux 6.8. -kernel 6.8 +# The list of system calls is current as of Linux 6.9. +kernel 6.9 FAST_atomic_update FAST_cmpxchg diff --git a/sysdeps/unix/sysv/linux/timespec_get.c b/sysdeps/unix/sysv/linux/timespec_get.c index c6e5e66289..778d1e3354 100644 --- a/sysdeps/unix/sysv/linux/timespec_get.c +++ b/sysdeps/unix/sysv/linux/timespec_get.c @@ -5,7 +5,7 @@ The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 2.1 of the License. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/sysdeps/unix/sysv/linux/timespec_getres.c b/sysdeps/unix/sysv/linux/timespec_getres.c index 5acebe2a2c..2eef9e512c 100644 --- a/sysdeps/unix/sysv/linux/timespec_getres.c +++ b/sysdeps/unix/sysv/linux/timespec_getres.c @@ -5,7 +5,7 @@ The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 2.1 of the License. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/sysdeps/unix/sysv/linux/tst-epoll-ioctls.c b/sysdeps/unix/sysv/linux/tst-epoll-ioctls.c new file mode 100644 index 0000000000..618ecc4e86 --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-epoll-ioctls.c @@ -0,0 +1,92 @@ +/* Basic tests for Linux epoll ioctls. + Copyright (C) 2022-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <intprops.h> +#include <stdlib.h> +#include <string.h> +#include <support/check.h> +#include <support/process_state.h> +#include <support/support.h> +#include <support/test-driver.h> +#include <support/xsignal.h> +#include <support/xunistd.h> +#include <sys/ioctl.h> +#include <sys/epoll.h> + +static void +test_epoll_ioctl (void) +{ + int efd = epoll_create1 (0); + TEST_VERIFY_EXIT (efd != -1); + + struct epoll_params params; + + TEST_COMPARE (ioctl (efd, EPIOCGPARAMS, ¶ms), 0); + + /* parameters are all 0 by default */ + TEST_COMPARE (params.busy_poll_usecs, 0); + TEST_COMPARE (params.busy_poll_budget, 0); + TEST_COMPARE (params.prefer_busy_poll, 0); + TEST_COMPARE (params.__pad, 0); + + /* set custom parameters */ + params.busy_poll_usecs = 40; + params.busy_poll_budget = 8; + params.prefer_busy_poll = 1; + params.__pad = 0; + + TEST_COMPARE (ioctl (efd, EPIOCSPARAMS, ¶ms), 0); + + memset (¶ms, 0, sizeof (params)); + + TEST_COMPARE (ioctl (efd, EPIOCGPARAMS, ¶ms), 0); + + /* check custom values were retrieved after being set */ + TEST_COMPARE (params.busy_poll_usecs, 40); + TEST_COMPARE (params.busy_poll_budget, 8); + TEST_COMPARE (params.prefer_busy_poll, 1); + TEST_COMPARE (params.__pad, 0); + + xclose (efd); +} + +static bool +ioctl_supported (void) +{ + int efd = epoll_create1 (0); + TEST_VERIFY_EXIT (efd != -1); + + struct epoll_params params; + int r = ioctl (efd, EPIOCGPARAMS, ¶ms); + xclose (efd); + + return (r == 0); +} + +static int +do_test (void) +{ + if (ioctl_supported ()) + test_epoll_ioctl (); + else + return EXIT_UNSUPPORTED; + + return 0; +} + +#include <support/test-driver.c> diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py index 56c0cf3e22..4a8f4e8919 100644 --- a/sysdeps/unix/sysv/linux/tst-mman-consts.py +++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py @@ -33,7 +33,7 @@ def main(): help='C compiler (including options) to use') args = parser.parse_args() linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) - linux_version_glibc = (6, 8) + linux_version_glibc = (6, 9) sys.exit(glibcextract.compare_macro_consts( '#define _GNU_SOURCE 1\n' '#include <sys/mman.h>\n', diff --git a/sysdeps/unix/sysv/linux/tst-mount-consts.py b/sysdeps/unix/sysv/linux/tst-mount-consts.py index 8613db96d7..c4a67221c1 100755 --- a/sysdeps/unix/sysv/linux/tst-mount-consts.py +++ b/sysdeps/unix/sysv/linux/tst-mount-consts.py @@ -39,10 +39,10 @@ def main(): sys.exit (77) linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) - # Constants in glibc were updated to match Linux v6.8. When glibc + # Constants in glibc were updated to match Linux v6.9. When glibc # constants are updated this value should be updated to match the # released kernel version from which the constants were taken. - linux_version_glibc = (6, 8) + linux_version_glibc = (6, 9) def check(cte, exclude=None): return glibcextract.compare_macro_consts( '#include <sys/mount.h>\n', diff --git a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py index 96875ac266..6f05291949 100644 --- a/sysdeps/unix/sysv/linux/tst-pidfd-consts.py +++ b/sysdeps/unix/sysv/linux/tst-pidfd-consts.py @@ -39,7 +39,7 @@ def main(): sys.exit (77) linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) - linux_version_glibc = (6, 8) + linux_version_glibc = (6, 9) sys.exit(glibcextract.compare_macro_consts( '#include <sys/pidfd.h>\n', '#include <asm/fcntl.h>\n' diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist index c1c5c76e26..bbf646fe7f 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist @@ -1182,3 +1182,11 @@ GLIBC_2.35 hypotf F GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F diff --git a/sysdeps/unix/sysv/linux/x86_64/clone3.S b/sysdeps/unix/sysv/linux/x86_64/clone3.S index 5a2d42234e..4cc19e066c 100644 --- a/sysdeps/unix/sysv/linux/x86_64/clone3.S +++ b/sysdeps/unix/sysv/linux/x86_64/clone3.S @@ -86,4 +86,3 @@ L(thread_start): PSEUDO_END (__clone3) libc_hidden_def (__clone3) -weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist index fac219d45a..7c7b884dde 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist @@ -1182,3 +1182,11 @@ GLIBC_2.35 hypotf F GLIBC_2.38 fmod F GLIBC_2.38 fmodf F GLIBC_2.39 exp10 F +GLIBC_2.40 log2p1 F +GLIBC_2.40 log2p1f F +GLIBC_2.40 log2p1f128 F +GLIBC_2.40 log2p1f32 F +GLIBC_2.40 log2p1f32x F +GLIBC_2.40 log2p1f64 F +GLIBC_2.40 log2p1f64x F +GLIBC_2.40 log2p1l F |