| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines fromfp functions (fromfp, fromfpx, ufromfp,
ufromfpx, and float and long double variants) to convert from
floating-point to an integer type with any signedness and any given
width up to that of intmax_t, in any of the five IEEE rounding modes
(the usual four for binary floating point, plus rounding to nearest
with ties rounding away from zero), with control of whether in-range
non-integer values should result in the "inexact" exception being
raised. This patch implements these functions for glibc.
These implementations are (apart from raising exceptions) pure integer
implementations; it's entirely possible optimized versions could be
devised for some architectures. A common math/fromfp.h header
provides various common helper code that can readily be shared between
the implementations for different types. For each type, the bulk of
the implementation is also shared between the four functions, with
wrappers that define UNSIGNED and INEXACT macros appropriately before
including the main implementation.
As the functions return intmax_t and uintmax_t without math.h being
allowed to expose those typedef names, they are declared using
__intmax_t and __uintmax_t as obtained from <bits/types.h>.
The FP_INT_* rounding direction macros are defined as ascending
integers in the order the names are listed in the TS; I see no
significant value in allowing architectures to vary the values of
them.
The libm-test machinery is duly adapted to handle unsigned int
arguments, and intmax_t and uintmax_t results. Because each test
input is generally tested for four functions, five rounding modes and
several different widths, the libm-test.inc additions are very large.
Thus, the diffs in the body of this message exclude the libm-test.inc
changes, with the full patch being attached gzipped. The bulk of the
new tests were generated (expanded from a test input plus rounding
results and information about where it lies in the relevant interval
between integers, to libm-test tests for all relevant combinations of
function, rounding direction and width) by a script that's included in
the patch as math/gen-fromfp-tests.py (input data
math/gen-fromfp-tests-inputs); as an ad hoc script that's not really
expected to be rerun, it's not very polished, but it's at least
plausibly useful for adding any further tests for these functions in
future. I may split the libm-test tests up by function in future (so
both libm-test.inc and auto-libm-test-out are split into separate
files, and the tests for each function are also built and run
separately), but not for 2.25.
For no obvious reason, adding tgmath tests for the new functions
resulted in -Wuninitialized errors from test-tgmath.c about the
variable i being used uninitialized. Those errors were correct - the
variable is read by the frexp version in test-tgmath.c (where real
frexp would write through that pointer instead of reading it) - but I
don't know why this patch would result in the pre-existing issue being
newly detected. The patch initializes the variable to avoid those
errors.
With these changes, glibc 2.25 should have all the library features
from TS 18661-1 other than the functions that round result to narrower
type (and constant rounding directions, but I'm considering those
mainly a compiler feature not a library one).
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(fromfp): New declaration.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise.
* math/tgmath.h (__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): New macro.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfp): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfp): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fromfpx): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (ufromfpx): Likewise.
* math/math.h: Include <bits/types.h>.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_INT_UPWARD): New enum
constant and macro.
(FP_INT_DOWNWARD): Likewise.
(FP_INT_TOWARDZERO): Likewise.
(FP_INT_TONEARESTFROMZERO): Likewise.
(FP_INT_TONEAREST): Likewise.
* math/Versions (fromfp): New libm symbol at version GLIBC_2.25.
(fromfpf): Likewise.
(fromfpl): Likewise.
(ufromfp): Likewise.
(ufromfpf): Likewise.
(ufromfpl): Likewise.
(fromfpx): Likewise.
(fromfpxf): Likewise.
(fromfpxl): Likewise.
(ufromfpx): Likewise.
(ufromfpxf): Likewise.
(ufromfpxl): Likewise.
* math/Makefile (libm-calls): Add s_fromfpF, s_ufromfpF,
s_fromfpxF and s_ufromfpxF.
* math/gen-fromfp-tests.py: New file.
* math/gen-fromfp-tests-inputs: Likewise.
* math/libm-test.inc: Include <stdint.h>
(check_intmax_t): New function.
(check_uintmax_t): Likewise.
(struct test_fiu_M_data): New type.
(struct test_fiu_U_data): Likewise.
(RUN_TEST_fiu_M): New macro.
(RUN_TEST_LOOP_fiu_M): Likewise.
(RUN_TEST_fiu_U): Likewise.
(RUN_TEST_LOOP_fiu_U): Likewise.
(fromfp_test_data): New array.
(fromfp_test): New function.
(fromfpx_test_data): New array.
(fromfpx_test): New function.
(ufromfp_test_data): New array.
(ufromfp_test): New function.
(ufromfpx_test_data): New array.
(ufromfpx_test): New function.
(main): Call fromfp_test, fromfpx_test, ufromfp_test and
ufromfpx_test.
* math/gen-libm-test.pl (parse_args): Handle u, M and U descriptor
characters.
* math/test-tgmath-ret.c: Include <stdint.h>.
(rm): New variable.
(width): Likewise.
(CHECK_RET_CONST_TYPE): Take extra arguments and pass them to
called function.
(CHECK_RET_CONST_FLOAT): Take extra arguments and pass them to
CHECK_RET_CONST_TYPE.
(CHECK_RET_CONST_DOUBLE): Likewise.
(CHECK_RET_CONST_LDOUBLE): Likewise.
(CHECK_RET_CONST): Take extra arguments and pass them to calls
macros.
(fromfp): New CHECK_RET_CONST call.
(ufromfp): Likewise.
(fromfpx): Likewise.
(ufromfpx): Likewise.
(do_test): Call check_return_fromfp, check_return_ufromfp,
check_return_fromfpx and check_return_ufromfpx.
* math/test-tgmath.c: Include <stdint.h>
(NCALLS): Increase to 138.
(F(compile_test)): Initialize i. Call fromfp functions.
(F(fromfp)): New function.
(F(fromfpx)): Likewise.
(F(ufromfp)): Likewise.
(F(ufromfpx)): Likewise.
* manual/arith.texi (Rounding Functions): Document FP_INT_UPWARD,
FP_INT_DOWNWARD, FP_INT_TOWARDZERO, FP_INT_TONEARESTFROMZERO,
FP_INT_TONEAREST, fromfp, fromfpf, fromfpl, ufromfp, ufromfpf,
ufromfpl, fromfpx, fromfpxf, fromfpxl, ufromfpx, ufromfpxf and
ufromfpxl.
* manual/libm-err-tab.pl (@all_functions): Add fromfp, fromfpx,
ufromfp and ufromfpx.
* math/fromfp.h: New file.
* sysdeps/ieee754/dbl-64/s_fromfp.c: Likewise.
* sysdeps/ieee754/dbl-64/s_fromfp_main.c: Likewise.
* sysdeps/ieee754/dbl-64/s_fromfpx.c: Likewise.
* sysdeps/ieee754/dbl-64/s_ufromfp.c: Likewise.
* sysdeps/ieee754/dbl-64/s_ufromfpx.c: Likewise.
* sysdeps/ieee754/flt-32/s_fromfpf.c: Likewise.
* sysdeps/ieee754/flt-32/s_fromfpf_main.c: Likewise.
* sysdeps/ieee754/flt-32/s_fromfpxf.c: Likewise.
* sysdeps/ieee754/flt-32/s_ufromfpf.c: Likewise.
* sysdeps/ieee754/flt-32/s_ufromfpxf.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_fromfpl.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_fromfpl_main.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_fromfpxl.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_ufromfpl.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_ufromfpxl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_fromfpl_main.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_fromfpl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_fromfpl_main.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_fromfpxl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_ufromfpl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_ufromfpxl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fromfp,
ufromfp, fromfpx and ufromfpx.
(CFLAGS-nldbl-fromfp.c): New variable.
(CFLAGS-nldbl-fromfpx.c): Likewise.
(CFLAGS-nldbl-ufromfp.c): Likewise.
(CFLAGS-nldbl-ufromfpx.c): Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.h: Include <stdint.h>.
* sysdeps/ieee754/ldbl-opt/nldbl-fromfp.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-fromfpx.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-ufromfp.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-ufromfpx.c: Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
this patch add a direct call to shmget syscall if it is supported by
kernel features.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmget): Likewise.
* sysdeps/unix/sysv/linux/shmget.c (shmget): Use shmget syscall if it
is defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
this patch add a direct call to shmdt syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmdt): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmdt):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmdt):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/shmdt.c (shmdt): Use shmdt syscall if it is
defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch consolidates the shmctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/shmctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldshmctl.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmctl): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmctl):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/alpha/shmctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/shmctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/shmctl.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/shmctl.c: Use default
implementation.
* sysdeps/unix/sysv/linux/shmctl.c (__new_shmctl): Use shmctl syscall
if it is defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to shmat syscall if it is supported by
kernel features.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmat): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmat):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmat):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat):
Define to __NR_osf_shmat.
* sysdeps/unix/sysv/linux/shmat.c (shmat): Use shmat syscall if it is
defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch consolidates the semtimedop Linux implementation in only
one default file, sysdeps/unix/sysv/linux/semtimedop.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semtimedop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/m68k/semtimedop.S: Remove file.
* sysdeps/unix/sysv/linux/s390/semtimedop.c: Reorganize headers and
add a comment about s390 syscall difference from default one.
* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use semtimedop
syscall if it is defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to semop syscall if it is supported by
kernel headers.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semop):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semop):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/semop.c (semop): Use semop syscall if it is
defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to semget syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/semget.c (semget): Use semget syscall
if it is defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch consolidates the semctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/semctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldsemctl.
* sysdeps/unix/sysv/linux/alpha/semctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/semctl.c: Use defaulf
implementation.
* sysdeps/unix/sysv/linux/semctl.c (__new_semctl): Use semctl
syscall if it is defined.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semctl): Remove.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semctl): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to msgget syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/msgget.c (msgget): Use msgget syscall if
define.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add a direct call to msgsnd syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgsnd): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgsnd):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgsnd):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Use msgsnd syscall
if defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch consolidates the msgrcv Linux implementation in only
one default file, sysdeps/unix/sysv/linux/msgrcv.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgctl): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise,
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Use msgrcv syscall
if defined.
* sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c: Remove file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch consolidates the msgctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/msgctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldmsgctl.
* sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (oldmsgctl): Remove.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/msgctl.c: Use default
implementation.
* sysdeps/unix/sysv/linux/msgctl.c (__new_msgctl): Use msgctl syscall
if defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines roundeven functions that round a floating-point
number to the nearest integer, in that floating-point type, with ties
rounding to even (whereas the round functions round ties away from
zero). As with other such functions, they raise no exceptions apart
from "invalid" for signaling NaNs. There was a previous user request
for this functionality in glibc in
<https://sourceware.org/ml/libc-help/2015-02/msg00005.html>.
This patch implements these functions for glibc. The implementations
use integer bit-manipulation (or roundeven on the high and low parts,
in the IBM long double case). It's possible that there may be faster
approaches on some architectures (in particular, on AArch64 the frintn
instruction should do exactly what's required); I'll leave it to
architecture maintainers or others interested to implement such
architecture-specific versions if desired. (Where architectures have
instructions to round to nearest integer in the current rounding mode,
implementations saving and restoring the rounding mode - and dealing
with exceptions if those instructions generate "inexact" - are also
possible, though their performance depends on the cost of manipulating
exceptions / rounding mode state.)
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(roundeven): New declaration.
* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (roundeven): New
macro.
* math/Versions (roundeven): New libm symbol at version
GLIBC_2.25.
(roundevenf): Likewise.
(roundevenl): Likewise.
* math/Makefile (libm-calls): Add s_roundevenF.
* math/libm-test.inc (roundeven_test_data): New array.
(roundeven_test): New function.
(main): Call roundeven_test.
* math/test-tgmath.c (NCALLS): Increase to 134.
(F(compile_test)): Call roundeven.
(F(roundeven)): New function.
* manual/arith.texi (Rounding Functions): Document roundeven,
roundevenf and roundevenl.
* manual/libm-err-tab.pl (@all_functions): Add roundeven.
* include/math.h (roundeven): Use libm_hidden_proto.
* sysdeps/ieee754/dbl-64/s_roundeven.c: New file.
* sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c: Likewise.
* sysdeps/ieee754/flt-32/s_roundevenf.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_roundevenl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_roundevenl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
roundeven.
(CFLAGS-nldbl-roundeven.c): New variable.
* sysdeps/ieee754/ldbl-opt/nldbl-roundeven.c: New file.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines fmaxmag and fminmag functions that return the
argument with maximum / minimum magnitude (acting like fmax / fmin if
the arguments have the same magnitude or either argument is a NaN).
These correspond to the IEEE 754-2008 operations maxNumMag and
minNumMag. This patch implements these functions for glibc. They are
implemented with type-generic templates. Tests are based on those for
fmax and fmin.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(fmaxmag): New declaration.
(fminmag): Likewise.
* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New
macro.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fminmag): Likewise.
* math/Versions (fmaxmag): New libm symbol at version GLIBC_2.25.
(fmaxmagf): Likewise.
(fmaxmagl): Likewise.
(fminmag): Likewise.
(fminmagf): Likewise.
(fminmagl): Likewise.
* math/Makefile (gen-libm-calls): Add s_fmaxmagF and s_fminmagF.
* math/s_fmaxmag_template.c: New file.
* math/s_fminmag_template.c: Likewise.
* math/libm-test.inc (fmaxmag_test_data): New array.
(fmaxmag_test): New function.
(fminmag_test_data): New array.
(fminmag_test): New function.
(main): Call fmaxmag_test and fminmag_test.
* math/test-tgmath.c (NCALLS): Increase to 132.
(F(compile_test)): Call fmaxmag and fminmag.
(F(fminmag)): New function.
(F(fmaxmag)): Likewise.
* manual/arith.texi (Misc FP Arithmetic): Document fminmag,
fminmagf, fminmagl, fmaxmag, fmaxmagf and fmaxmagl.
* manual/libm-err-tab.pl (@all_functions): Add fmaxmag and
fminmag.
* sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmaxmag
and fminmag.
(CFLAGS-nldbl-fmaxmag.c): New variable.
(CFLAGS-nldbl-fminmag.c): Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
explicit_bzero(s, n) is the same as memset(s, 0, n), except that the
compiler is not allowed to delete a call to explicit_bzero even if the
memory pointed to by 's' is dead after the call. Right now, this effect
is achieved externally by having explicit_bzero be a function whose
semantics are unknown to the compiler, and internally, with a no-op
asm statement that clobbers memory. This does mean that small
explicit_bzero operations cannot be expanded inline as small memset
operations can, but on the other hand, small memset operations do get
deleted by the compiler. Hopefully full compiler support for
explicit_bzero will happen relatively soon.
There are two new tests: test-explicit_bzero.c verifies the
visible semantics in the same way as the existing test-bzero.c,
and tst-xbzero-opt.c verifies the not-being-optimized-out property.
The latter is conceptually based on a test written by Matthew Dempsky
for the OpenBSD regression suite.
The crypt() implementation has an immediate use for this new feature.
We avoid having to add a GLIBC_PRIVATE alias for explicit_bzero
by running all of libcrypt's calls through the fortified variant,
__explicit_bzero_chk, which is in the impl namespace anyway. Currently
I'm not aware of anything in libc proper that needs this, but the
glue is all in place if it does become necessary. The legacy DES
implementation wasn't bothering to clear its buffers, so I added that,
mostly for consistency's sake.
* string/explicit_bzero.c: New routine.
* string/test-explicit_bzero.c, string/tst-xbzero-opt.c: New tests.
* string/Makefile (routines, strop-tests, tests): Add them.
* string/test-memset.c: Add ifdeffage for testing explicit_bzero.
* string/string.h [__USE_MISC]: Declare explicit_bzero.
* debug/explicit_bzero_chk.c: New routine.
* debug/Makefile (routines): Add it.
* debug/tst-chk1.c: Test fortification of explicit_bzero.
* string/bits/string3.h: Fortify explicit_bzero.
* manual/string.texi: Document explicit_bzero.
* NEWS: Mention addition of explicit_bzero.
* crypt/crypt-entry.c (__crypt_r): Clear key-dependent intermediate
data before returning, using explicit_bzero.
* crypt/md5-crypt.c (__md5_crypt_r): Likewise.
* crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
* crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
* include/string.h: Redirect internal uses of explicit_bzero
to __explicit_bzero_chk[_internal].
* string/Versions [GLIBC_2.25]: Add explicit_bzero.
* debug/Versions [GLIBC_2.25]: Add __explicit_bzero_chk.
* sysdeps/arm/nacl/libc.abilist
* sysdeps/unix/sysv/linux/aarch64/libc.abilist
* sysdeps/unix/sysv/linux/alpha/libc.abilist
* sysdeps/unix/sysv/linux/arm/libc.abilist
* sysdeps/unix/sysv/linux/hppa/libc.abilist
* sysdeps/unix/sysv/linux/i386/libc.abilist
* sysdeps/unix/sysv/linux/ia64/libc.abilist
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
* sysdeps/unix/sysv/linux/microblaze/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
* sysdeps/unix/sysv/linux/nios2/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
* sysdeps/unix/sysv/linux/sh/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
Add entries for explicit_bzero and __explicit_bzero_chk.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines llogb functions that are like ilogb except that
they return long int instead of int. Corresponding FP_LLOGB* macros
are defined, whose values are required to have the obvious
correspondence to those of the FP_ILOGB* macros.
This patch implements these functions and macros for glibc. llogb
uses the type-generic infrastructure, with an implementation similar
to the wrapper for ilogb but with additional conversion from FP_ILOGB*
to FP_LLOGB*; this approach avoids needing to modify or duplicate any
of the architecture-specific ilogb implementations. Tests are also
based on those for ilogb.
Ideally the llogb functions would alias the ilogb ones when long is
32-bit, but such aliasing requires the associated header declarations
of the different-type alias to be hidden, typically by defining macros
before including the header (see e.g. how
sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c defines lround to
__hidden_lround before including <math.h>). The infrastructure for
type-generic function implementations does not support defining such
macros at present (since C code can't define a macro whose name is
determined by other macros). So this patch leaves them as separate
functions (similar to e.g. scalbln and scalbn being separate in such a
case as well), but with the remapping of FP_ILOGB* to FP_LLOGB*
conditioned out in the case where it would be the identity map.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb):
New declaration.
* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (llogb): New
macro.
* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (__FP_LONG_MAX):
New macro.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGB0): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FP_LLOGBNAN): Likewise.
* math/Versions (llogb): New libm symbol at version GLIBC_2.25.
(llogbf): Likewise.
(llogbl): Likewise.
* math/Makefile (gen-libm-calls): Add w_llogbF.
(tests): Add test-fp-llogb-constants.
* math/w_llogb_template.c: New file. Based on
math/w_ilogb_template.c.
* math/libm-test.inc (llogb_test_data): New array.
(llogb_test): New function.
(main): Call llogb_test.
* math/test-fp-llogb-constants.c: New file. Based on
math/test-fp-ilogb-constants.c.
* math/test-tgmath-ret.c (llogb): New CHECK_RET_CONST call.
(do_test): Call check_return_llogb.
* math/test-tgmath.c (NCALLS): Increase to 126.
(F(compile_test)): Call llogb.
(F(llogb)): New function.
* manual/math.texi (Exponents and Logarithms): Document llogb,
llogbf, llogbl, FP_LLOGB0 and FP_LLOGBNAN.
* manual/libm-err-tab.pl (@all_functions): Add llogb.
* sysdeps/ieee754/ldbl-opt/nldbl-llogb.c: New file.
* sysdeps/ieee754/ldbl-opt/w_llogbl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add llogb.
(CFLAGS-nldbl-llogb.c): New variable.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
| |
It is no longer needed since commit 6c444ad6e953dbdf9c7be065308a0a777
(elf: Do not use memalign for TCB/TLS blocks allocation [BZ #17730]).
Applications do not link against ld.so and will use the definition in
libc.so, so there is no ABI impact.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change moves the main implementation of _dl_catch_error,
_dl_signal_error to libc.so, where TLS variables can be used
directly. This removes a writable function pointer from the
rtld_global variable.
For use during initial relocation, minimal implementations of these
functions are provided in ld.so. These are eventually interposed
by the libc.so implementations. This is implemented by compiling
elf/dl-error-skeleton.c twice, via elf/dl-error.c and
elf/dl-error-minimal.c.
As a side effect of this change, the static version of dl-error.c
no longer includes support for the
_dl_signal_cerror/_dl_receive_error mechanism because it is only
used in ld.so.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Building tests for IA64 runs into a build failure compiling
stdlib/tst-setcontext2.c:
tst-setcontext2.c: In function 'do_test':
tst-setcontext2.c:210:20: error: passing argument 1 of 'sigismember' from incompatible pointer type [-Werror=incompatible-pointer-types]
if (sigismember (&oldctx.uc_sigmask, SIGUSR2) != 1)
^
Indeed, the IA64 uc_sigmask as unsigned long rather than the larger
userspace sigset_t. Fixing this might be hard; this patch works
around the build failure by making IA64 wrap the test with a version
that #defines sigismember to add a cast (I'd welcome a better approach
for fixing this).
Tested (compilation only) for ia64.
* sysdeps/unix/sysv/linux/ia64/tst-setcontext2.c: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines functions for manipulating the payloads of NaNs.
This patch implements the setpayloadsig functions for glibc; these are
like the setpayload functions, but produce a signaling NaN instead of
a quiet NaN.
The substance of the implementation was included with the setpayload
implementation, so the new files here just need to wrap the main files
with different defines to build the new functions.
Because the functions store a signaling NaN via a pointer and the
libm-test macros choose a suitable initial value for the variable in
such a case by comparing with the expected value, the relevant macro
needs to clear exceptions after FE_INVALID may have been raised by
that comparison.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(setpayloadsig): New declaration.
* math/Versions (setpayloadsig): New libm symbol at version
GLIBC_2.25.
(setpayloadsigf): Likewise.
(setpayloadsigl): Likewise.
* math/Makefile (libm-calls): Add s_setpayloadsigF.
* math/libm-test.inc (RUN_TEST_Ff_b1): Call feclearexcept
(FE_ALL_EXCEPT) after initializing EXTRA_VAR.
(setpayloadsig_test_data): New array.
(setpayloadsig_test): New function.
(main): Call setpayloadsig_test.
* manual/arith.texi (FP Bit Twiddling): Document setpayloadsig,
setpayloadsigf and setpayloadsigl.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/dbl-64/s_setpayloadsig.c: New file.
* sysdeps/ieee754/flt-32/s_setpayloadsigf.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-setpayloadsig.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
setpayloadsig.
(CFLAGS-nldbl-setpayloadsig.c): New variable.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch remove the PID cache and usage in current GLIBC code. Current
usage is mainly used a performance optimization to avoid the syscall,
however it adds some issues:
- The exposed clone syscall will try to set pid/tid to make the new
thread somewhat compatible with current GLIBC assumptions. This cause
a set of issue with new workloads and usecases (such as BZ#17214 and
[1]) as well for new internal usage of clone to optimize other algorithms
(such as clone plus CLONE_VM for posix_spawn, BZ#19957).
- The caching complexity also added some bugs in the past [2] [3] and
requires more effort of each port to handle such requirements (for
both clone and vfork implementation).
- Caching performance gain in mainly on getpid and some specific
code paths. The getpid performance leverage is questionable [4],
either by the idea of getpid being a hotspot as for the getpid
implementation itself (if it is indeed a justifiable hotspot a
vDSO symbol could let to a much more simpler solution).
Other usage is mainly for non usual code paths, such as pthread
cancellation signal and handling.
For thread creation (on stack allocation) the code simplification in fact
adds some performance gain due the no need of transverse the stack cache
and invalidate each element pid.
Other thread usages will require a direct getpid syscall, such as
cancellation/setxid signal, thread cancellation, thread fail path (at
create_thread), and thread signal (pthread_kill and pthread_sigqueue).
However these are hardly usual hotspots and I think adding a syscall is
justifiable.
It also simplifies both the clone and vfork arch-specific implementation.
And by review each fork implementation there are some discrepancies that
this patch also solves:
- microblaze clone/vfork does not set/reset the pid/tid field
- hppa uses the default vfork implementation that fallback to fork.
Since vfork is deprecated I do not think we should bother with it.
The patch also removes the TID caching in clone. My understanding for
such semantic is try provide some pthread usage after a user program
issue clone directly (as done by thread creation with CLONE_PARENT_SETTID
and pthread tid member). However, as stated before in multiple discussions
threads, GLIBC provides clone syscalls without further supporting all this
semantics.
I ran a full make check on x86_64, x32, i686, armhf, aarch64, and powerpc64le.
For sparc32, sparc64, and mips I ran the basic fork and vfork tests from
posix/ folder (on a qemu system). So it would require further testing
on alpha, hppa, ia64, m68k, nios2, s390, sh, and tile (I excluded microblaze
because it is already implementing the patch semantic regarding clone/vfork).
[1] https://codereview.chromium.org/800183004/
[2] https://sourceware.org/ml/libc-alpha/2006-07/msg00123.html
[3] https://sourceware.org/bugzilla/show_bug.cgi?id=15368
[4] http://yarchive.net/comp/linux/getpid_caching.html
* sysdeps/nptl/fork.c (__libc_fork): Remove pid cache setting.
* nptl/allocatestack.c (allocate_stack): Likewise.
(__reclaim_stacks): Likewise.
(setxid_signal_thread): Obtain pid through syscall.
* nptl/nptl-init.c (sigcancel_handler): Likewise.
(sighandle_setxid): Likewise.
* nptl/pthread_cancel.c (pthread_cancel): Likewise.
* sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Likewise.
* sysdeps/unix/sysv/linux/pthread_sigqueue.c (pthread_sigqueue):
Likewise.
* sysdeps/unix/sysv/linux/createthread.c (create_thread): Likewise.
* sysdeps/unix/sysv/linux/getpid.c: Remove file.
* nptl/descr.h (struct pthread): Change comment about pid value.
* nptl/pthread_getattr_np.c (pthread_getattr_np): Remove thread
pid assert.
* sysdeps/unix/sysv/linux/pthread-pids.h (__pthread_initialize_pids):
Do not set pid value.
* nptl_db/td_ta_thr_iter.c (iterate_thread_list): Remove thread
pid cache check.
* nptl_db/td_thr_validate.c (td_thr_validate): Likewise.
* sysdeps/aarch64/nptl/tcb-offsets.sym: Remove pid offset.
* sysdeps/alpha/nptl/tcb-offsets.sym: Likewise.
* sysdeps/arm/nptl/tcb-offsets.sym: Likewise.
* sysdeps/hppa/nptl/tcb-offsets.sym: Likewise.
* sysdeps/i386/nptl/tcb-offsets.sym: Likewise.
* sysdeps/ia64/nptl/tcb-offsets.sym: Likewise.
* sysdeps/m68k/nptl/tcb-offsets.sym: Likewise.
* sysdeps/microblaze/nptl/tcb-offsets.sym: Likewise.
* sysdeps/mips/nptl/tcb-offsets.sym: Likewise.
* sysdeps/nios2/nptl/tcb-offsets.sym: Likewise.
* sysdeps/powerpc/nptl/tcb-offsets.sym: Likewise.
* sysdeps/s390/nptl/tcb-offsets.sym: Likewise.
* sysdeps/sh/nptl/tcb-offsets.sym: Likewise.
* sysdeps/sparc/nptl/tcb-offsets.sym: Likewise.
* sysdeps/tile/nptl/tcb-offsets.sym: Likewise.
* sysdeps/x86_64/nptl/tcb-offsets.sym: Likewise.
* sysdeps/unix/sysv/linux/aarch64/clone.S: Remove pid and tid caching.
* sysdeps/unix/sysv/linux/alpha/clone.S: Likewise.
* sysdeps/unix/sysv/linux/arm/clone.S: Likewise.
* sysdeps/unix/sysv/linux/hppa/clone.S: Likewise.
* sysdeps/unix/sysv/linux/i386/clone.S: Likewise.
* sysdeps/unix/sysv/linux/ia64/clone2.S: Likewise.
* sysdeps/unix/sysv/linux/mips/clone.S: Likewise.
* sysdeps/unix/sysv/linux/nios2/clone.S: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/clone.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Likewise.
* sysdeps/unix/sysv/linux/sh/clone.S: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.
* sysdeps/unix/sysv/linux/tile/clone.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise.
* sysdeps/unix/sysv/linux/aarch64/vfork.S: Remove pid set and reset.
* sysdeps/unix/sysv/linux/alpha/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/arm/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/i386/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/ia64/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/m68k/clone.S: Likewise.
* sysdeps/unix/sysv/linux/m68k/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/mips/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/nios2/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/sh/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/tile/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/vfork.S: Likewise.
* sysdeps/unix/sysv/linux/tst-clone2.c (f): Remove direct pthread
struct access.
(clone_test): Remove function.
(do_test): Rewrite to take in consideration pid is not cached anymore.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysdeps/unix/sysv/linux/fstatfs64.c: Hide prototypes for fstatfs
and __fstatfs. Make them aliases of __fstatfs64 if
STATFS_IS_STATFS64 is set to non-zero.
* sysdeps/unix/sysv/linux/statfs64.c: Ditto for __statfs, statfs,
and __statfs64.
* sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c: Do not
define __fstatfs and fstatfs if STATFS_IS_STATFS64 is non-zero.
* sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c: Ditto
for __statfs and statfs.
* sysdeps/unix/sysv/linux/alpha/kernel_stat.h: Set STATFS_IS_STATFS64
to 0.
* sysdeps/unix/sysv/linux/generic/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/hppa/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/ia64/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/microblaze/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/mips/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h: Ditto.
* sysdeps/unix/sysv/linux/x86_64/kernel_stat.h: Ditto.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines functions for manipulating the payloads of NaNs.
This patch implements the setpayload functions for glibc; these set a
number (pointed to by a function argument) to a quiet NaN with the
given payload, or to +0 if the given payload is not valid. The
implementations are structured to allow the substance of the
implementation to be shared with the setpayloadsig functions when
those are added.
The semantics in the TS are not entirely clear in the case where the
payload passed to the function is zero (see discussion on the WG14
reflector last month). This patch implements what seems the most
sensible interpretation, that -0 is never valid to give as the
payload, but +0 is valid in the case where the kind of NaN being
generated has its high mantissa bit set so payload 0 is actually
possible in such a NaN.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(setpayload): New declaration.
* math/Versions (setpayload): New libm symbol at version
GLIBC_2.25.
(setpayloadf): Likewise.
(setpayloadl): Likewise.
* math/Makefile (libm-calls): Add s_setpayloadF.
* math/libm-test.inc (struct test_Ffp_b1_data): Rename to struct
test_Ff_b1_data.
(RUN_TEST_Ff_b1): New macro.
(RUN_TEST_LOOP_Ff_b1): Likewise.
(canonicalize_test_data): Update type.
(setpayload_test_data): New array.
(setpayload_test): New function.
(main): Call setpayload_test.
* manual/arith.texi (FP Bit Twiddling): Document setpayload,
setpayloadf and setpayloadl.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/dbl-64/s_setpayload.c: New file.
* sysdeps/ieee754/dbl-64/s_setpayload_main.c: Likewise.
* sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c:
Likewise.
* sysdeps/ieee754/flt-32/s_setpayloadf.c: Likewise.
* sysdeps/ieee754/flt-32/s_setpayloadf_main.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_setpayloadl.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_setpayloadl_main.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_setpayloadl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_setpayloadl_main.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-setpayload.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
setpayload.
(CFLAGS-nldbl-setpayload.c): New variable.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines canonicalize functions to produce a canonical
version of a floating-point representation. This patch implements
these functions for glibc.
As with the iscanonical macro, these functions are oriented to the
decimal floating-point case, where some values have both canonical and
noncanonical representations. However, the functions have a return
value that says whether they succeeded in storing a canonical result;
thus, they can fail for the case of an invalid representation (while
still not making any particular choice from among multiple equally
canonical valid representations of the same value). Since no
floating-point formats in glibc actually have noncanonical valid
representations, a type-generic implementation of these functions can
be used that expects iscanonical to return 0 only for invalid
representations. Now that iscanonical is used within libm.so,
libm_hidden_proto / libm_hidden_def are added for __iscanonicall.
The definition of these functions is intended to correspond to a
convertFormat operation to the same floating-point format. Thus, they
convert signaling NaNs to quiet NaNs, raising the "invalid" exception.
Such a conversion "should" produce "the canonical version of that
signaling NaN made quiet".
libm-test.inc is made to check NaN payloads for the output of these
functions, a new feature (at some point manipulation functions such as
fabs and copysign should have tests added that verify payload
preservation for them). As however some architectures may not follow
the recommended practice of preserving NaN payloads when converting a
signaling NaN to quiet, a new math-tests.h macro
SNAN_TESTS_PRESERVE_PAYLOAD is added, and defined to 0 for non-NAN2008
MIPS; any other architectures seeing test failures for lack of payload
preservation in this case should also define this macro to 0. (If any
cases arise where the sign isn't preserved either, those should have a
similar macro added.)
The ldbl-96 and ldbl-128ibm tests of iscanonical are renamed and
adapted to test canonicalizel as well on the same representations.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(canonicalize): New declaration.
* math/Versions (canonicalize): New libm symbol at version
GLIBC_2.25.
(canonicalizef): Likewise.
(canonicalizel): Likewise.
* math/Makefile (gen-libm-calls): Add s_canonicalizeF.
* math/s_canonicalize_template.c: New file.
* math/libm-test.inc: Update comment on functions tested and
testing of NaN payloads.
(TEST_NAN_PAYLOAD): New macro.
(NO_TEST_INLINE): Update value.
(XFAIL_TEST): Likewise.
(ERRNO_UNCHANGED): Likewise.
(ERRNO_EDOM): Likewise.
(ERRNO_ERANGE): Likewise.
(IGNORE_RESULT): Likewise.
(NON_FINITE): Likewise.
(TEST_SNAN): Likewise.
(NO_TEST_MATHVEC): Likewise.
(TEST_NAN_PAYLOAD_CANONICALIZE): New macro.
(check_float_internal): Check NaN payloads if TEST_NAN_PAYLOAD.
(struct test_Ffp_b1_data): New type.
(RUN_TEST_Ffp_b1): New macro.
(RUN_TEST_LOOP_Ffp_b1): Likewise.
(canonicalize_test_data): New array.
(canonicalize_test): New function.
(main): Call canonicalize_test.
* manual/arith.texi (FP Bit Twiddling): Document canonicalize,
canonicalizef and canonicalizel.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/ldbl-opt/nldbl-canonicalize.c: New file.
* sysdeps/ieee754/ldbl-opt/s_canonicalizel.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
canonicalize.
(CFLAGS-nldbl-canonicalize.c): New variable.
* sysdeps/ieee754/ldbl-128ibm/test-iscanonical-ldbl-128ibm.c: Move
to ...
* sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c:
... here.
(do_test): Also test canonicalizel.
* sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Change
test-iscanonical-ldbl-128ibm to test-canonical-ldbl-128ibm.
* sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h: New
file.
* sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c (__iscanonicall):
Use libm_hidden_def.
* sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c: Move to ...
* sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c: ... here.
(do_test): Also test canonicalizel.
* sysdeps/ieee754/ldbl-96/Makefile (tests): Change
test-iscanonical-ldbl-96 to test-canonical-ldbl-96.
* sysdeps/ieee754/ldbl-96/include/bits/iscanonical.h: New file.
* sysdeps/ieee754/ldbl-96/s_iscanonicall.c (__iscanonicall): Use
libm_hidden_def.
* sysdeps/generic/math-tests.h (SNAN_TESTS_PRESERVE_PAYLOAD): New
macro.
* sysdeps/mips/math-tests.h [__mips_hard_float && !__mips_nan2008]
(SNAN_TESTS_PRESERVE_PAYLOAD): Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
| |
ISO/IEC TS 18661-1 adds several functions in the strfrom family to stdlib.
This patch adds strfromd, strfromf, and strfroml. This is being done in
preparation for the new floating-point type, float128. The added functions
convert a floating-point value into a string, with configurable format.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines functions for manipulating the payloads of NaNs.
This patch implements the getpayload functions for glibc; these
extract the NaN payload (from an argument passed as a pointer, for
which corresponding libm-test support is added) and return it in the
same floating-point type. The return value of these functions is
unspecified for non-NaN arguments; the patch does the simplest thing
to implement, which is that the functions do not check whether the
argument is a NaN and just treat the relevant bits of the
representation as a payload regardless. A conversion from integer to
floating-point is used to produce the required return value, except in
the ldbl-128 case; as 128-bit integers are not supported for all
configurations using ldbl-128, the code constructs the required
floating-point representation of the return value directly instead.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(getpayload): New declaration.
* math/Versions (getpayload): New libm symbol at version
GLIBC_2.25.
(getpayloadf): Likewise.
(getpayloadl): Likewise.
* math/Makefile (libm-calls): Add s_getpayloadF.
* math/libm-test.inc: Include <nan-high-order-bit.h>.
(struct test_f_f_data): Add comment.
(RUN_TEST_fp_f): New macro.
(RUN_TEST_LOOP_fp_f): Likewise.
(getpayload_test_data): New array.
(getpayload_test): New function.
(main): Call getpayload_test.
* math/gen-libm-test.pl (parse_args): Handle 'p' in argument
descriptor.
* manual/arith.texi (FP Bit Twiddling): Document getpayload,
getpayloadf and getpayloadl.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/dbl-64/s_getpayload.c: New file.
* sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c: Likewise.
* sysdeps/ieee754/flt-32/s_getpayloadf.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_getpayloadl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_getpayloadl.c: Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In addition to the totalorder functions, TS 18661-1 defines
totalordermag functions, which do the same comparison but on the
absolute values of the arguments. This patch implements these
functions for glibc, including the type-generic macro in <tgmath.h>.
In general the implementations are similar to but simpler than those
for the totalorder functions.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(totalordermag): New declaration.
* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag):
New macro.
* math/Versions (totalordermag): New libm symbol at version
GLIBC_2.25.
(totalordermagf): Likewise.
(totalordermagl): Likewise.
* math/Makefile (libm-calls): Add s_totalordermagF.
* math/libm-test.inc (totalordermag_test_data): New array.
(totalordermag_test): New function.
(main): Call totalordermag_test.
* math/test-tgmath.c (NCALLS): Increase to 125.
(F(compile_test)): Call totalordermag.
(F(totalordermag)): New function.
* manual/arith.texi (FP Comparison Functions): Document
totalordermag, totalordermagf and totalordermagl.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/dbl-64/s_totalordermag.c: New file.
* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Likewise.
* sysdeps/ieee754/flt-32/s_totalordermagf.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-totalordermag.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
totalordermag.
(CFLAGS-nldbl-totalordermag.c): New variable.
* sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c
(do_test): Also test totalordermagl.
* sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c (do_test):
Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines totalorder functions implementing the totalOrder
comparison operation from IEEE 754-2008. This patch implements these
functions for glibc, including the type-generic macro in <tgmath.h>.
(The totalordermag functions will be added in a separate patch.)
The description of the totalOrder operation is complicated. However,
for IEEE interchange binary formats and the preferred quiet NaN
convention, what that complicated description means is that you
interpret the representation as a sign-magnitude integer (with -0
coming before +0) and do a <= comparison on that interpretation. For
finite values and infinities the ordering of the sign-magnitude
integers is just the same as the ordering of floating-point values, so
this extends that to all representations. (Different representations
of the same floating-point value - which includes same quantum in the
decimal case - must still be considered equal by this operation, but
that issue doesn't arise for IEEE interchange binary formats.) So the
complications are:
* When MIPS quiet NaN conventions are in use, the representation of
NaNs needs adjusting before making such an integer comparison. This
patch does this adjustment only when both arguments are NaNs, as
there's no need for it if only one is a NaN, and as long as both are
NaNs you can just flip the relevant bits without any problems from
this turning a NaN into an infinity.
* For the m68k version of ldbl-96, where the high mantissa bit is
"don't care" for infinities and NaNs, representations where it
differs must compare the same. Note: although the testcase for this
compiles, I have not actually tested on m68k.
* For ldbl-128ibm, the low part must be ignored when the high part is
NaN, and low parts of +0 and -0 must be considered the same whatever
the high part.
The new tests in libm-test.inc are the first tests there specifying
particular payloads for input NaNs. Separate tests are also added for
the ldbl-96 and ldbl-128ibm special cases where there are different
representations of the same value that must compare equal (which can't
be covered in libm-test.inc as that only specifies values, not
representations).
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(totalorder): New declaration.
* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (totalorder):
New macro.
* math/Versions (totalorder): New libm symbol at version
GLIBC_2.25.
(totalorderf): Likewise.
(totalorderl): Likewise.
* math/Makefile (libm-calls): Add s_totalorderF.
* math/gen-libm-test.pl (parse_args): Escape quotes in test name
string.
* math/libm-test.inc (PAYLOAD_DIG): New macro.
(qnan_value_pl): Likewise.
(snan_value_pl): Likewise.
(qnan_value): Define using qnan_value_pl.
(snan_value): Define using snan_value_pl.
(struct test_ff_i_data): Add comment about which tests use this
structure.
(RUN_TEST_ff_b): New macro.
(RUN_TEST_LOOP_ff_b): Likewise.
(totalorder_test_data): New array.
(totalorder_test): New function.
(main): Call totalorder_test.
* math/test-tgmath.c (NCALLS): Increase to 122.
(F(compile_test)): Call totalorder.
(F(totalorder)): New function.
* manual/arith.texi (FP Comparison Functions): Document
totalorder, totalorderf and totalorderl.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/dbl-64/s_totalorder.c: New file.
* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Likewise.
* sysdeps/ieee754/flt-32/s_totalorderf.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_totalorderl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c: Likewise.
* sysdeps/ieee754/ldbl-96/s_totalorderl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-totalorder.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
totalorder.
(CFLAGS-nldbl-totalorder.c): New variable.
* sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c: New
file.
* sysdeps/ieee754/ldbl-128ibm/Makefile [$(subdir) = math] (tests):
Add test-totalorderl-ldbl-128ibm.
* sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c: New file.
* sysdeps/ieee754/ldbl-96/Makefile [$(subdir) = math] (tests): Add
test-totalorderl-ldbl-96.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 adds an iseqsig type-generic comparison macro to <math.h>.
This macro is like the == operator except that unordered operands
result in the "invalid" exception and errno being set to EDOM.
This patch implements this macro for glibc. Given the need to set
errno, this is implemented with out-of-line functions __iseqsigf,
__iseqsig and __iseqsigl (of which the last only exists at all if long
double is ABI-distinct from double, so no function aliases or compat
support are needed). The present patch ignores excess precision
issues; I intend to deal with those in a followup patch. (Like
comparison operators, type-generic comparison macros should *not*
convert operands to their semantic types but should preserve excess
range and precision, meaning that for some argument types and values
of FLT_EVAL_METHOD, an underlying function should be called for a
wider type than that of the arguments.)
The underlying functions are implemented with the type-generic
template machinery. Comparing x <= y && x >= y is sufficient in ISO C
to achieve an equality comparison with "invalid" raised for unordered
operands (and the results of those two comparisons can also be used to
tell whether errno needs to be set). However, some architectures have
GCC bugs meaning that unordered comparison instructions are used
instead of ordered ones. Thus, a mechanism is provided for
architectures to use an explicit call to feraiseexcept to raise
exceptions if required. If your architecture has such a bug you
should add a fix-fp-int-compare-invalid.h header for it, with a
comment pointing to the relevant GCC bug report; if such a GCC bug is
fixed, that header's contents should have a __GNUC_PREREQ conditional
added so that the workaround can eventually be removed for that
architecture.
Tested for x86_64, x86, mips64, arm and powerpc.
* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (iseqsig): New
macro.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(__iseqsig): New declaration.
* math/s_iseqsig_template.c: New file.
* math/Versions (__iseqsigf): New libm symbol at version
GLIBC_2.25.
(__iseqsig): Likewise.
(__iseqsigl): Likewise.
* math/libm-test.inc (iseqsig_test_data): New array.
(iseqsig_test): New function.
(main): Call iseqsig_test.
* math/Makefile (gen-libm-calls): Add s_iseqsigF.
* manual/arith.texi (FP Comparison Functions): Document iseqsig.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/generic/fix-fp-int-compare-invalid.h: New file.
* sysdeps/powerpc/fpu/fix-fp-int-compare-invalid.h: Likewise.
* sysdeps/x86/fpu/fix-fp-int-compare-invalid.h: Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 adds an iscanonical classification macro to <math.h>.
The motivation for this is decimal floating-point, where some values
have both canonical and noncanonical encodings. For IEEE binary
interchange formats, all encodings are canonical. For x86/m68k
ldbl-96, and for ldbl-128ibm, there are encodings that do not
represent any valid value of the type; although formally iscanonical
does not need to handle trap representations (and so could just always
return 1), it seems useful, and in line with the description in the TS
of "representations that are extraneous to the floating-point model"
as being non-canonical (as well as "redundant representations of some
or all of its values"), for it to detect those representations and
return 0 for them.
This patch adds iscanonical to glibc. It goes in a header
<bits/iscanonical.h>, included under appropriate conditions in
<math.h>. The default header version just evaluates the argument
(converted to its semantic type, though current GCC will probably
discard that conversion and any exceptions resulting from it) and
returns 1. ldbl-96 and ldbl-128ibm then have versions of the header
that call a function __iscanonicall for long double (the sizeof-based
tests will of course need updating for float128 support, like other
such type-generic macro implementations). The ldbl-96 version of
__iscanonicall has appropriate conditionals to reflect the differences
in the m68k version of that format (where the high mantissa bit may be
either 0 or 1 when the exponent is 0 or 0x7fff). Corresponding tests
for those formats are added as well. Other architectures do not have
any new functions added because just returning 1 is correct for all
their floating-point formats.
Tested for x86_64, x86, mips64 (to test the default macro version) and
powerpc.
* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Include
<bits/iscanonical.h>.
* bits/iscanonical.h: New file.
* math/s_iscanonicall.c: Likewise.
* math/Versions (__iscanonicall): New libm symbol at version
GLIBC_2.25.
* math/libm-test.inc (iscanonical_test_data): New array.
(iscanonical_test): New function.
(main): Call iscanonical_test.
* math/Makefile (headers): Add bits/iscanonical.h.
(type-ldouble-routines): Add s_iscanonicall.
* manual/arith.texi (Floating Point Classes): Document
iscanonical.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h: New file.
* sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/test-iscanonical-ldbl-128ibm.c:
Likewise.
* sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Add
test-iscanonical-ldbl-128ibm.
* sysdeps/ieee754/ldbl-96/bits/iscanonical.h: New file.
* sysdeps/ieee754/ldbl-96/s_iscanonicall.c: Likewise.
* sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c: Likewise.
* sysdeps/ieee754/ldbl-96/Makefile: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Update.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sys/ucontext.h unconditionally uses stack_t, and it does not make
sense to change that. But signal.h only declares stack_t under
__USE_XOPEN_EXTENDED || __USE_XOPEN2K8. The actual definition is
already in a bits header, bits/sigstack.h, but that header insists on
only being included by signal.h, so we have to change that as well as
all of the sys/ucontext.h variants. (Some but not all variants of
bits/sigcontext.h, which sys/ucontext.h may also need, had already
received this adjustment; for consistency, I made them all the same,
even if that's not strictly necessary in some configurations.)
bits/sigcontext.h and bits/sigstack.h also all need to receive
multiple inclusion guards.
* sysdeps/generic/sys/ucontext.h
* sysdeps/arm/sys/ucontext.h
* sysdeps/i386/sys/ucontext.h
* sysdeps/m68k/sys/ucontext.h
* sysdeps/mips/sys/ucontext.h
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h:
Include both bits/sigcontext.h and bits/sigstack.h.
Fix grammar error in comment, if present.
* bits/sigstack.h
* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
* sysdeps/unix/sysv/linux/alpha/bits/sigstack.h
* sysdeps/unix/sysv/linux/bits/sigstack.h
* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
* sysdeps/unix/sysv/linux/mips/bits/sigstack.h
* sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
* sysdeps/unix/sysv/linux/sparc/bits/sigstack.h
* bits/sigcontext.h
* sysdeps/mach/hurd/i386/bits/sigcontext.h
* sysdeps/unix/sysv/linux/bits/sigcontext.h
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h:
Add multiple inclusion guard. Permit inclusion by sys/ucontext.h
as well as signal.h, if this was not already allowed. Request
definition of size_t if necessary. Minimize semantically-null
differences across files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines a type femode_t to represent the set of dynamic
floating-point control modes (such as the rounding mode and trap
enablement modes), and functions fegetmode and fesetmode to manipulate
those modes (without affecting other state such as the raised
exception flags) and a corresponding macro FE_DFL_MODE.
This patch series implements those interfaces for glibc. This first
patch adds the architecture-independent pieces, the x86 and x86_64
implementations, and the <bits/fenv.h> and ABI baseline updates for
all architectures so glibc keeps building and passing the ABI tests on
all architectures. Subsequent patches add the fegetmode and fesetmode
implementations for other architectures.
femode_t is generally an integer type - the same type as fenv_t, or as
the single element of fenv_t where fenv_t is a structure containing a
single integer (or the single relevant element, where it has elements
for both status and control registers) - except where architecture
properties or consistency with the fenv_t implementation indicate
otherwise. FE_DFL_MODE follows FE_DFL_ENV in whether it's a magic
pointer value (-1 cast to const femode_t *), a value that can be
distinguished from valid pointers by its high bits but otherwise
contains a representation of the desired register contents, or a
pointer to a constant variable (the powerpc case; __fe_dfl_mode is
added as an exported constant object, an alias to __fe_dfl_env).
Note that where architectures (that share a register between control
and status bits) gain definitions of new floating-point control or
status bits in future, the implementations of fesetmode for those
architectures may need updating (depending on whether the new bits are
control or status bits and what the implementation does with
previously unknown bits), just like existing implementations of
<fenv.h> functions that take care not to touch reserved bits may need
updating when the set of reserved bits changes. (As any new bits are
outside the scope of ISO C, that's just a quality-of-implementation
issue for supporting them, not a conformance issue.)
As with fenv_t, femode_t should properly include any software DFP
rounding mode (and for both fenv_t and femode_t I'd consider that
fragment of DFP support appropriate for inclusion in glibc even in the
absence of the rest of libdfp; hardware DFP rounding modes should
already be included if the definitions of which bits are status /
control bits are correct).
Tested for x86_64, x86, mips64 (hard float, and soft float to test the
fallback version), arm (hard float) and powerpc (hard float, soft
float and e500). Other architecture versions are untested.
* math/fegetmode.c: New file.
* math/fesetmode.c: Likewise.
* sysdeps/i386/fpu/fegetmode.c: Likewise.
* sysdeps/i386/fpu/fesetmode.c: Likewise.
* sysdeps/x86_64/fpu/fegetmode.c: Likewise.
* sysdeps/x86_64/fpu/fesetmode.c: Likewise.
* math/fenv.h: Update comment on inclusion of <bits/fenv.h>.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fegetmode): New function
declaration.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fesetmode): Likewise.
* bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (femode_t): New
typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/aarch64/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/alpha/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/arm/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/hppa/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/ia64/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/m68k/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/microblaze/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/mips/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/nios2/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/powerpc/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (__fe_dfl_mode): New variable
declaration.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/s390/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/sh/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/sparc/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/tile/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* sysdeps/x86/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(femode_t): New typedef.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
* manual/arith.texi (FE_DFL_MODE): Document macro.
(fegetmode): Document function.
(fesetmode): Likewise.
* math/Versions (fegetmode): New libm symbol at version
GLIBC_2.25.
(fesetmode): Likewise.
* math/Makefile (libm-support): Add fegetmode and fesetmode.
(tests): Add test-femode and test-femode-traps.
* math/test-femode-traps.c: New file.
* math/test-femode.c: Likewise.
* sysdeps/powerpc/fpu/fenv_const.c (__fe_dfl_mode): Declare as
alias for __fe_dfl_env.
* sysdeps/powerpc/nofpu/fenv_const.c (__fe_dfl_mode): Likewise.
* sysdeps/powerpc/powerpc32/e500/nofpu/fenv_const.c
(__fe_dfl_mode): Likewise.
* sysdeps/powerpc/Versions (__fe_dfl_mode): New libm symbol at
version GLIBC_2.25.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines an fetestexceptflag function to test the exception
state saved in an fexcept_t object by fegetexceptflag.
This patch implements this function for glibc. Almost all
architectures save exception state in such a way that it can be
directly ANDed with exception flag bits, so rather than having lots of
fetestexceptflag implementations that all do the same thing, the math/
implementation is made to use this generic logic (which is also OK in
the fallback case where FE_ALL_EXCEPT is zero). The only architecture
that seems to need anything different is s390.
(fegetexceptflag and fesetexceptflag use abbreviated filenames
fgetexcptflg.c and fsetexcptflg.c. Because we are no longer concerned
by 14-character filename limits, fetestexceptflag uses the obvious
filename fetestexceptflag.c.)
The NEWS entry is intended to be expanded along the lines given in
<https://sourceware.org/ml/libc-alpha/2016-08/msg00356.html> when
fegetmode and fesetmode are added.
Tested for x86_64, x86, mips64 and powerpc.
* math/fetestexceptflag.c: New file.
* sysdeps/s390/fpu/fetestexceptflag.c: Likewise. Comment by
Stefan Liebler.
* math/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(fetestexceptflag): New function declaration.
* manual/arith.texi (fetestexceptflag): Document function.
* math/Versions (fetestexceptflag): New libm symbol at version
GLIBC_2.25.
* math/Makefile (libm-support): Add fetestexceptflag.
(tests): Add test-fetestexceptflag.
* math/test-fetestexceptflag.c: New file.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
| |
With this change, we no longer add sysdep.o and similar objects which
are present in libc.a to other static libraries.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661-1 defines an fesetexcept function for setting floating-point
exception flags without the side-effect of causing enabled traps to be
taken.
This patch series implements this function for glibc. The present
patch adds the fallback stub implementation, x86 and x86_64
implementations, documentation, tests and ABI baseline updates. The
remaining patches, some of them untested, add implementations for
other architectures. The implementations generally follow those of
the fesetexceptflag function.
As for fesetexceptflag, the approach taken for architectures where
setting flags causes enabled traps to be taken is to set the flags
(and potentially cause traps) rather than refusing to set the flags
and returning an error. Since ISO C and TS 18661 provide no way to
enable traps, this is formally in accordance with the standards.
The NEWS entry should be considered a placeholder, since this patch
series is intended to be followed by further such series adding other
TS 18661-1 features, so that the NEWS entry would end up looking more
like
* New <fenv.h> features from TS 18661-1:2014 are added to libm: the
fesetexcept, fetestexceptflag, fegetmode and fesetmode functions,
the femode_t type and the FE_DFL_MODE macro.
with hopefully more such entries for other features, rather than
having an entry for a single function in the end.
I believe we have consensus for adding TS 18661-1 interfaces as per
<https://sourceware.org/ml/libc-alpha/2016-06/msg00421.html>.
Tested for x86_64, x86, mips64 (hard float, and soft float to test the
fallback version), arm (hard float) and powerpc (hard float, soft
float and e500).
* math/fesetexcept.c: New file.
* sysdeps/i386/fpu/fesetexcept.c: Likewise.
* sysdeps/x86_64/fpu/fesetexcept.c: Likewise.
* math/fenv.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fesetexcept): New function
declaration.
* manual/arith.texi (fesetexcept): Document function.
* math/Versions (fesetexcept): New libm symbol at version
GLIBC_2.25.
* math/Makefile (libm-support): Add fesetexcept.
(tests): Add test-fesetexcept and test-fesetexcept-traps.
* math/test-fesetexcept.c: New file.
* math/test-fesetexcept-traps.c: Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Presently sys/sysmacros.h is entirely defined in sysdeps. This would
mean that the deprecation logic coming up in the next patch would have
to be written twice (in generic/ and unix/sysv/linux/). To avoid that,
hoist all but the unavoidably system-dependent logic to misc/, leaving a
bits/ header behind. This also promotes the Linux-specific encoding of
dev_t, which accommodates 32-bit major and minor numbers in a 64-bit dev_t,
to generic, as glibc's dev_t is always 64 bits wide.
The former Linux implementation used inline functions to avoid evaluating
arguments more than once. After this change, all platforms use inline
functions, which means that three new symbols are added to the generic ABI.
(These symbols are in the user namespace, which is how they have always
been on Linux. They begin with "gnu_dev_", so collisions with user code
are pretty unlikely.)
New ports henceforth need only provide a bits/sysmacros.h defining
internal macros __SYSMACROS_{DECLARE,DEFINE}_{MAJOR,MINOR,MAKEDEV}.
This is only necessary if the kernel encoding is incompatible with
the now-generic encoding (for instance, it would be necessary for
FreeBSD).
While I was at it, I added a basic round-trip test for these functions.
* sysdeps/generic/sys/sysmacros.h: Delete file.
* sysdeps/unix/sysv/linux/makedev.c: Delete file.
* sysdeps/unix/sysv/linux/sys/sysmacros.h: Move file ...
* bits/sysmacros.h: ... here; this encoding is now the generic
encoding. Now defines only the following macros:
__SYSMACROS_DECLARE_MAJOR, __SYSMACROS_DEFINE_MAJOR,
__SYSMACROS_DECLARE_MINOR, __SYSMACROS_DEFINE_MINOR,
__SYSMACROS_DECLARE_MAKEDEV, __SYSMACROS_DEFINE_MAKEDEV.
* misc/sys/sysmacros.h, misc/makedev.c: New files that use
bits/sysmacros.h and the above new macros to generate the
public implementations of major, minor, and makedev.
* misc/tst-makedev.c: New test.
* include/sys/sysmacros.h: New wrapper.
* misc/Makefile (headers): Add sys/sysmacros.h, bits/sysmacros.h.
(routines): Add makedev.
(tests): Add tst-makedev.
* misc/Versions [GLIBC_2.25]: Add gnu_dev_major, gnu_dev_minor,
gnu_dev_makedev.
* posix/Makefile (headers): Remove sys/sysmacros.h.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove makedev.
* sysdeps/arm/nacl/libc.abilist: Add GLIBC_2.25,
gnu_dev_major, gnu_dev_makedev, gnu_dev_minor.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist
* sysdeps/unix/sysv/linux/alpha/libc.abilist
* sysdeps/unix/sysv/linux/arm/libc.abilist
* sysdeps/unix/sysv/linux/hppa/libc.abilist
* sysdeps/unix/sysv/linux/i386/libc.abilist
* sysdeps/unix/sysv/linux/ia64/libc.abilist
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
* sysdeps/unix/sysv/linux/microblaze/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
* sysdeps/unix/sysv/linux/nios2/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
* sysdeps/unix/sysv/linux/sh/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
Add GLIBC_2.25.
|
|
|
|
|
|
|
|
|
|
|
| |
TS 18661 adds nextup and nextdown functions alongside nextafter to provide
support for float128 equivalent to it. This patch adds nextupl, nextup,
nextupf, nextdownl, nextdown and nextdownf to libm before float128 support.
The nextup functions return the next representable value in the direction of
positive infinity and the nextdown functions return the next representable
value in the direction of negative infinity. These are currently enabled
as GNU extensions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After some discussion in libc-alpha about this POSIX compliance fix, I see
that GLIBC should indeed revert back to previous definition of msghdr and
cmsghdr and implementation of sendmsg, recvmsg, sendmmsg, recvmmsg due some
reasons:
* The possible issue where the syscalls wrapper add the compatibility
layer is quite limited in scope and range. And kernel current
also add some limits to the values on the internal msghdr and
cmsghdr fields:
- msghdr::msg_iovlen larger than UIO_MAXIOV (1024) returns
EMSGSIZE.
- msghdr::msg_controllen larger than INT_MAX returns ENOBUFS.
* There is a small performance hit for recvmsg/sendmsg/recmmsg which
is neglectable, but it is a big hit for sendmmsg since now instead
of calling the syscall for the packed structure, GLIBC is calling
multiple sendmsg. This defeat the very existence of the syscall.
* It currently breaks libsanitizer build on GCC [1] (I fixed on compiler-rt).
However the fix is incomplete because it does add any runtime check
since libsanitizer currently does not have any facility to intercept
symbols with multiple version [2].
This, along with incorret dlsym/dlvsym return for versioned symbol due
another bug [3], makes hard to interpose versioned symbols.
Also, current approach of fixing GCC PR#71445 leads to half-baked
solutions without versioned symbol interposing.
This patch basically reverts commits 2f0dc39029ae08, 222c2d7f4357d66,
af7f7c7ec8dea1. I decided to not revert abf29edd4a3918 (Adjust
kernel-features.h defaults for recvmsg and sendmsg) mainly because it
does not really address the POSIX compliance original issue and also
adds some cleanups.
Tested on x86, i386, s390, s390x, aarch64, and powerpc64le.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71445
[2] https://github.com/google/sanitizers/issues/628
[3] https://sourceware.org/bugzilla/show_bug.cgi?id=14932
* conform/data/sys/socket.h-data (msghdr.msg_iovlen): Add xfail-.
(msghdr.msg_controllen): Likewise.
(cmsghdr.cmsg_len): Likewise.
* nptl/Makefile (libpthread-routines): Remove ptw-oldrecvmsg and
ptw-oldsendmsg.
(CFLAGS-oldrecvmsg.c): Remove rule.
(CFLAGS-oldsendmsg.c): Likewise.
(CFLAGS-recvmsg.c): Add rule.
(CFLAGS-sendmsg.c): Likewise.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
oldrecvmsg, oldsendmsg, oldrecvmmsg, oldsendmmsg.
(CFLAGS-recvmsg.c): Remove rule.
(CFLAGS-sendmsg.c): Likewise.
(CFLAGS-oldrecvmsg.c): Likewise.
(CFLAGS-oldsendmsg.c): Likewise.
(CFLAGS-recvmmsg.c): Likewise.
* sysdeps/unix/sysv/linux/bits/socket.h (msghdr.msg_iovlen): Revert
to kernel defined interfaces.
(msghdr.msg_controllen): Likewise.
(cmsghdr.cmsg_len): Likewise.
(msghdr.__glibc_reserved1): Remove member.
(msghdr.__glibc_reserved2): Likewise.
(cmsghdr.__glibc_reserved1): Likewise.
* sysdeps/unix/sysv/linux/oldrecvmmsg.c: Remove file.
* sysdeps/unix/sysv/linux/oldrecvmsg.c: Likewise.
* sysdeps/unix/sysv/linux/oldsendmmsg.c: Likewise.
* sysdeps/unix/sysv/linux/oldsendmsg.c: Likewise.
* sysdeps/unix/sysv/linux/recvmmsg.c: Revert back to previous
version.
* sysdeps/unix/sysv/linux/recvmsg.c: Likewise.
* sysdeps/unix/sysv/linux/sendmmsg.c: Likewise.
* sysdeps/unix/sysv/linux/sendmsg.c: Likewise.
* sysdeps/unix/sysv/linux/aarch64/Versions [libc] (GLIBC_2.24):
Remove recvmsg and sendmsg.
* sysdeps/unix/sysv/linux/alpha/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/hppa/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/i386/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/m68k/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/microblaze/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/Versions
[libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/nios2/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions
[libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/sh/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/sparc/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/tile/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions: Remove file
* sysdeps/unix/sysv/linux/x86_64/64/Versions: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/Versions: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Remove new 2.24
version for {recv,send,recm,sendm}msg.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In C++11 18.5.12 says "Objects shall not be destroyed as a
result of calling quick_exit." In C11 quick_exit is silent
about thread object destruction. Therefore to make glibc
C++ compliant we do not call any thread local destructors.
A new regression test verifies the fix.
I will note that C++11 18.5.3 makes it clear that C++
defines additional requirements for _Exit() to prevent it
from executing destructors.
Given that the point of _Exit() is to terminate the process
immediately it makes sense the C and C++ should line up
and avoid calling destructors.
No failures. New regtest passes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen
to be of size int and socklen_t respectively, however Linux implements
it as a size_t. So for 64-bits architecture where sizeof of size_t is
larger than socklen_t, both sendmmsg and recvmmsg need to adjust the
mmsghdr::msg_hdr internal fields before issuing the syscall itself.
This patch fixes it by operating on the padding if it the case.
For recvmmsg, the most straightfoward case, only zero padding the fields
is suffice. However, for sendmmsg, where adjusting the buffer is out
of the contract (since it may point to a read-only data), the function
is rewritten to use sendmsg instead (which from previous patch
allocates a temporary msghdr to operate on).
Also for 64-bit ports that requires it, a new recvmmsg and sendmmsg
compat version is created (which uses size_t for both cmsghdr::cmsg_len
and internal
Tested on x86_64, i686, aarch64, armhf, and powerpc64le.
* sysdeps/unix/sysv/linux/Makefile
[$(subdir) = socket] (sysdep_routines): Add oldrecvmmsg and
oldsendmmsg.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add recvmmsg and
sendmmsg.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/oldrecvmmsg.c: New file.
* sysdeps/unix/sysv/linux/oldsendmmsg.c: Likewise.
* sysdeps/unix/sysv/linux/recvmmsg.c (__recvmmsg): Adjust msghdr
iovlen and controllen fields to adjust to POSIX specification.
* sysdeps/unix/sysv/linux/sendmmsg.c (__sendmmsg): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen
to be of size int and socklen_t respectively. However Linux defines it as
both size_t and for 64-bit it requires some adjustments to make the
functions standard compliance.
This patch fixes it by creating a temporary header and zeroing the pad
fields for 64-bits architecture where size of size_t exceeds the size of
the int.
Also the new recvmsg and sendmsg implementation is only added on libc,
with libpthread only containing a compat symbol.
Tested on x86_64, i686, aarch64, armhf, and powerpc64le.
* conform/data/sys/socket.h-data (msghdr.msg_iovlen): Remove xfail-
and change to correct expected type.
(msghdr.msg_controllen): Likewise.
(cmsghdr.cmsg_len): Likewise.
* sysdeps/unix/sysv/linux/bits/socket.h (msghdr.msg_iovlen): Fix
expected POSIX assumption about the size.
(msghdr.msg_controllen): Likewise.
(msghdr.__glibc_reserved1): Likewise.
(msghdr.__glibc_reserved2): Likewise.
(cmsghdr.cmsg_len): Likewise.
(cmsghdr.__glibc_reserved1): Likewise.
* nptl/Makefile (libpthread-routines): Remove ptw-recvmsg and ptw-sendmsg.
Add ptw-oldrecvmsg and ptw-oldsendmsg.
(CFLAGS-sendmsg.c): Remove rule.
(CFLAGS-recvmsg.c): Likewise.
(CFLAGS-oldsendmsg.c): Add rule.
(CFLAGS-oldrecvmsg.c): Likewise.
* sysdeps/unix/sysv/linux/alpha/Versions [libc] (GLIBC_2.24): Add
recvmsg and sendmsg.
* sysdeps/unix/sysv/linux/aarch64/Version [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/arm/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/hppa/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/i386/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/ia64/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/m68k/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/microblaze/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/nios2/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions [libc]
(GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/sh/Versions [libc] (GLIBC_2.24): Likewise.
* sysdeps/unix/sysv/linux/sparc/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/Versions [libc] (GLIBC_2.24):
Likewise.
( sysdeps/unix/sysv/linux/tile/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions [libc]
(GLIBC_2.24): Likewise.
( sysdeps/unix/sysv/linux/x86_64/64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/x84_64/Versions [libc] (GLIBC_2.24):
Likewise.
* sysdeps/unix/sysv/linux/Makefile
[$(subdir) = socket)] (sysdep_headers): Add oldrecvmsg and oldsendmsg.
(CFLAGS-sendmsg.c): Add rule.
(CFLAGS-recvmsg.c): Likewise.
(CFLAGS-oldsendmsg.c): Likewise.
(CFLAGS-oldrecvmsg.c): Likewise.
* sysdeps/unix/sysv/linux/check_native.c (__check_native): Fix msghdr
initialization.
* sysdeps/unix/sysv/linux/check_pf.c (make_request): Likewise.
* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Likewise.
* sysdeps/unix/sysv/linux/oldrecvmsg.c: New file.
* sysdeps/unix/sysv/linux/oldsendmsg.c: Likewise.
* sysdeps/unix/sysv/linux/recvmsg.c (__libc_recvmsg): Adjust msghdr
iovlen and controllen fields to adjust to POSIX specification.
* sysdeps/unix/sysv/linux/sendmsg.c (__libc_sendmsg): Likewise.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: New version and
added recvmsg and sendmsg.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
Likewise.
* sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
* sysdepe/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
Likewise.
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch removes the auto-generation for recvmsg and sendmsg syscall
and adjust the kernel-features.h for all architectures supported on
Linux. This patch follows the idea of 'Adjust kernel-features.h defaults
for socket syscalls.' (35ade9f11b9007ee9683529f2d33698ff35255c8) by define
__ASSUME_SENDMSG_SYSCALL and __ASSUME_RECVMSG_SYSCALL as supported by
default and undefine it for the architecture that do not support it
directly.
The main rationale is to make is easier add code wrapper over the syscall
to fix BZ#16919 (recvmsg standard compliance).
Tested on x86_64, i686, aarch64, armhf, and powerpc64le.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (recvmsg): Remove
from auto-generation.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/arm/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list (recvmsg):
Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (recvmsg): Likewise.
(sendmsg): Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Remove.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Undefine.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_SENDMSG_SYSCALL): Define.
(__ASSUME_RECVMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Remove.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Undefine.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Remove.
[__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_SENDMSG_SYSCALL):
Undefine.
[__LINUX_KERNEL_VERSION < 0x040300] (__ASSUME_RECVMSG_SYSCALL):
Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_SENDMSG_SYSCALL): Undefine.
(__ASSUME_RECVMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_SENDMSG_SYSCALL): Likewise.
(__ASSUME_RECVMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_SENDMSG_SYSCALL): Likewise.
(__ASSUME_RECVMSG_SYSCALL): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As discussed in libc-alpha [1] current clone with CLONE_VM (without
CLONE_THREAD set) will reset the pthread pid/tid fields to -1. The
issue is since memory is shared between the parent and child it will
clobber parent's cached pid/tid leading to internal inconsistencies
if the value is not restored.
And even it is restored it may lead to racy conditions when between
set/restore a thread might invoke pthread function that validate the
pthread with INVALID_TD_P/INVALID_NOT_TERMINATED_TD_P and thus get
wrong results.
As stated in BZ19957, previously reports of this behaviour was close
with EWONTFIX due the fact usage of clone outside glibc is tricky
since glibc requires consistent internal pthread, while using clone
directly may not provide it. However since now posix_spawn uses
clone (CLONE_VM) to fixes various issues related to previous vfork
usage this issue requires fixing.
The vfork implementation also does something similar, but instead
it negates and restores only the *pid* field and functions that
might access its value know to handle such case (getpid, raise
and pthread ones that uses INVALID_TD_P/INVALID_NOT_TERMINATED_TD_P
macros that check only *tid* field). Also vfork does not call
__clone directly, instead calling either __NR_vfork or __NR_clone
directly.
So this patch removes this clone behavior by avoiding setting
the pthread pid/tid field for CLONE_VM. There is no need to
check for CLONE_THREAD, since the minimum supported kernel in all
architecture implies that CLONE_VM must be used with CLONE_THREAD,
otherwise clone returns EINVAL.
Instead of current approach of:
int clone(int (*fn)(void *), void *child_stack, int flags, ...)
[...]
if (flags & CLONE_THREAD)
goto do_syscall;
pid_t new_value;
if (flags & CLONE_VM)
new_value = -1;
else
new_value = getpid ();
THREAD_SETMEM (THREAD_SELF, pid, new_value);
THREAD_SETMEM (THREAD_SELF, tid, new_value);
do_syscall:
[...]
The new approach uses:
int clone(int (*fn)(void *), void *child_stack, int flags, ...)
[...]
if (flags & CLONE_VM)
goto do_syscall;
pid_t new_value = getpid ();
THREAD_SETMEM (THREAD_SELF, pid, new_value);
THREAD_SETMEM (THREAD_SELF, tid, new_value);
do_syscall:
[...]
It also removes the linux tst-getpid2.c test which expects the previous
behavior and instead add another clone test.
Tested on x86_64, i686, x32, powerpc64le, aarch64, armhf, s390, and
s390x. I also did limited check on mips32 and sparc64 (using the new
added test).
I also got reviews from both m68k, hppa, and tile. So I presume for
these architecture the patch works.
The fixes for alpha, microblaze, sh, ia64, and nio2 have not been
tested.
[1] https://sourceware.org/ml/libc-alpha/2016-04/msg00307.html
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == nptl] (test): Remove
tst-getpid2.
(test): Add tst-clone2.
* sysdeps/unix/sysv/linux/tst-clone2.c: New file.
* sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Do not change
pid/tid fields for CLONE_VM.
* sysdeps/unix/sysv/linux/arm/clone.S: Likewise.
* sysdeps/unix/sysv/linux/i386/clone.S: Likewise.
* sysdeps/unix/sysv/linux/mips/clone.S: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/clone.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise.
* sysdeps/unix/sysv/linux/tst-getpid2.c: Remove file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adjusts the defaults for kernel-features.h macros relating
to availability of accept4, recvmmsg and sendmmsg. It is not intended
to affect which macros end up getting defined in any configuration.
At present, all architectures with syscalls for those functions need
to define __ASSUME_*_SYSCALL macros; in particular, any new
architecture needs its own kernel-features.h file for that purpose,
though it may not otherwise need such a header. Those macros are then
used together with __ASSUME_SOCKETCALL to define macros for whether
the functions in question are available.
This patch changes the defaults so that the syscalls are assumed to be
available by default with recent-enough kernels, and it is the
responsibility of architecture headers to undefine the macros if they
are unavailable in supported kernels at least as recent as the version
where the architecture-independent functionality was introduced. The
__ASSUME_<function> macros are defaulted similarly instead of being
defined based on other macros (defining based on other macros would no
longer work because the #undefs appear after the generic header is
included), so where the syscall being unavailable means the function
is unavailable this means the architecture header has to undefine the
__ASSUME_<function> macro; this only affects __ASSUME_ACCEPT4 for
ia64, as other cases where the syscalls were added late enough to be
relevant with current kernel version requirements are all on
socketcall architectures.
As a consequence, the AArch64 and Nios II kernel-features.h header
files are removed, and others simplified. When the minimum kernel
version becomes 4.3 or later on all architectures, the syscalls in
question can just be assumed unconditionally, permitting further
simplification.
Tested for x86_64, x86 and powerpc (that installed shared libraries
are unchanged by the patch, and testsuite for x86_64 and x86).
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Define unconditionally.
(__ASSUME_ACCEPT4): Likewise.
[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
Define.
[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG):
Likewise.
* sysdeps/unix/sysv/linux/aarch64/kernel-features.h: Remove file.
* sysdeps/unix/sysv/linux/nios2/kernel-features.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h
(__ASSUME_RECVMMSG_SYSCALL): Do not define.
(__ASSUME_ACCEPT4_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_ACCEPT4_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/hppa/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Likewise.
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
Likewise.
(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
0x040300] instead of defining if [__LINUX_KERNEL_VERSION >=
0x040300].
* sysdeps/unix/sysv/linux/ia64/kernel-features.h
(__ASSUME_RECVMMSG_SYSCALL): Do not define.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
0x030300] instead of defining if [__LINUX_KERNEL_VERSION >=
0x030300].
[__LINUX_KERNEL_VERSION < 0x030300] (__ASSUME_ACCEPT4): Undefine.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
0x040300] instead of defining if [__LINUX_KERNEL_VERSION >=
0x040300].
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Do not define.
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
0x030300] instead of defining if [__LINUX_KERNEL_VERSION >=
0x030300].
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Do not define.
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Likewise.
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
0x040300] instead of defining if [__LINUX_KERNEL_VERSION >=
0x040300].
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Do not define.
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Likewise.
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/tile/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Likewise.
(__ASSUME_RECVMMSG_SYSCALL): Likewise.
(__ASSUME_SENDMMSG_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/x86_64/kernel-features.h
(__ASSUME_ACCEPT4_SYSCALL): Likewise.
[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements a new posix_spawn{p} implementation for Linux. The main
difference is it uses the clone syscall directly with CLONE_VM and CLONE_VFORK
flags and a direct allocated stack. The new stack and start function solves
most the vfork limitation (possible parent clobber due stack spilling). The
remaning issue are related to signal handling:
1. That no signal handlers must run in child context, to avoid corrupt
parent's state.
2. Child must synchronize with parent to enforce stack deallocation and
to possible return execv issues.
The first one is solved by blocking all signals in child, even NPTL-internal
ones (SIGCANCEL and SIGSETXID). The second issue is done by a stack allocation
in parent and a synchronization with using a pipe or waitpid (in case or error).
The pipe has the advantage of allowing the child signal an exec error (checked
with new tst-spawn2 test).
There is an inherent race condition in pipe2 usage for architectures that do not
support the syscall directly. In such cases the a pipe plus fctnl is used
instead and it may lead to file descriptor leak in parent (as decribed by fcntl
documentation).
The child process stack is allocate with a mmap with MAP_STACK flag using
default architecture stack size. Although it is slower than use a stack buffer
from parent, it allows some slack for the compatibility code to run scripts
with no shebang (which may use a buffer with size depending of argument list
count).
Performance should be similar to the vfork default posix implementation and
way faster than fork path (vfork on mostly linux ports are basically
clone with CLONE_VM plus CLONE_VFORK). The only difference is the syscalls
required for the stack allocation/deallocation.
It fixes BZ#10354, BZ#14750, and BZ#18433.
Tested on i386, x86_64, powerpc64le, and aarch64.
[BZ #14750]
[BZ #10354]
[BZ #18433]
* include/sched.h (__clone): Add hidden prototype.
(__clone2): Likewise.
* include/unistd.h (__dup): Likewise.
* posix/Makefile (tests): Add tst-spawn2.
* posix/tst-spawn2.c: New file.
* sysdeps/posix/dup.c (__dup): Add hidden definition.
* sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/arm/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/hppa/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/i386/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/ia64/clone2.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/m68k/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/microblaze/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/mips/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/nios2/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S (__clone):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S (__clone):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/sh/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/tile/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/x86_64/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/nptl-signals.h
(____nptl_is_internal_signal): New function.
* sysdeps/unix/sysv/linux/spawni.c: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch follows up on the increase in minimum kernel version by
removing conditionals in non-x86, non-x86_64 kernel-features.h headers
that are now constant for all supported kernel versions.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
[__LINUX_KERNEL_VERSION >= 0x030200]: Likewise.
[__LINUX_KERNEL_VERSION < 0x020621]: Remove conditional code.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
[__LINUX_KERNEL_VERSION >= 0x020624]: Likewise.
[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
* sysdeps/unix/sysv/linux/hppa/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020622]: Likewise.
[__LINUX_KERNEL_VERSION >= 0x030100]: Likewise.
[__LINUX_KERNEL_VERSION < 0x020625]: Remove conditional code.
* sysdeps/unix/sysv/linux/ia64/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
[__LINUX_KERNEL_VERSION < 0x030000]: Remove conditional code.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
[__LINUX_KERNEL_VERSION < 0x020621]: Remove conditional code.
[__LINUX_KERNEL_VERSION < 0x020625]: Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
[__LINUX_KERNEL_VERSION >= 0x030100]: Likewise.
[_MIPS_SIM == _ABIN32 && __LINUX_KERNEL_VERSION < 0x020623]:
Remove conditional code.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020625]: Make code unconditional.
[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020625]: Likewise.
[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
[__LINUX_KERNEL_VERSION < 0x020625]: Remove conditional code.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
* sysdeps/unix/sysv/linux/tile/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds some new header definitions from Linux 4.4:
* MCL_ONFAULT is added to bits/mman.h / bits/mman-linux.h (this was
already done for hppa).
* PTRACE_SECCOMP_GET_FILTER is added to sys/ptrace.h. Along with it,
the older PTRACE_GETSIGMASK and PTRACE_SETSIGMASK, added in Linux
3.11 but missed at the time, are also added.
Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).
* bits/mman-linux.h [!MCL_CURRENT] (MCL_ONFAULT): New macro.
* sysdeps/unix/sysv/linux/alpha/bits/mman.h (MCL_ONFAULT):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/mman.h (MCL_ONFAULT):
Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/mman.h (MCL_ONFAULT):
Likewise.
* sysdeps/unix/sysv/linux/sys/ptrace.h (PTRACE_GETSIGMASK): New
enum constant and macro.
(PTRACE_SETSIGMASK): Likewise.
(PTRACE_SECCOMP_GET_FILTER): Likewise.
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
(PTRACE_GETSIGMASK): Likewise.
(PTRACE_SETSIGMASK): Likewise.
(PTRACE_SECCOMP_GET_FILTER): Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h (PTRACE_GETSIGMASK):
Likewise.
(PTRACE_SETSIGMASK): Likewise.
(PTRACE_SECCOMP_GET_FILTER): Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
(PTRACE_GETSIGMASK): Likewise.
(PTRACE_SETSIGMASK): Likewise.
(PTRACE_SECCOMP_GET_FILTER): Likewise.
* sysdeps/unix/sysv/linux/s390/sys/ptrace.h (PTRACE_GETSIGMASK):
Likewise.
(PTRACE_SETSIGMASK): Likewise.
(PTRACE_SECCOMP_GET_FILTER): Likewise.
* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h (PTRACE_GETSIGMASK):
Likewise.
(PTRACE_SETSIGMASK): Likewise.
(PTRACE_SECCOMP_GET_FILTER): Likewise.
* sysdeps/unix/sysv/linux/tile/sys/ptrace.h (PTRACE_GETSIGMASK):
Likewise.
(PTRACE_SETSIGMASK): Likewise.
(PTRACE_SECCOMP_GET_FILTER): Likewise.
|
| |
|