Mark __ptsname_internal, __mktime_internal and __fopen_internal with
attribute_hidden to allow direct access to them within libc.so and
libc.a without using GOT nor PLT.
[BZ #18822]
* include/stdlib.h (__ptsname_internal): Add attribute_hidden.
* include/time.h (__mktime_internal): Likewise.
* libio/iolibio.h (__fopen_internal): Likewise.
__setcontext on hppa.
* sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Save return
pointer in frame.
* sysdeps/unix/sysv/linux/hppa/setcontext.S (__setcontext): Likewise.
Correct offset used to restore PIC register.
tst-tls1-static-non-pie is built with $(no-pie-ldflag) to make it a
non-PIE static executable, regardless if --enable-static-pie is used
to configure glibc.
* elf/Makefile (tests-static-internal): Add
tst-tls1-static-non-pie.
(LDFLAGS-tst-tls1-static-non-pie): New.
* elf/tst-tls1-static-non-pie.c: New file.
Continuing the move of libm aliases to common macros that can create
_FloatN / _FloatNx aliases in future, this patch converts some dbl-64
functions to using libm_alias_double, thereby eliminating the need for
some ldbl-opt wrappers.
This patch deliberately limits what functions are converted so that it
can be verified by comparison of stipped binaries. Specifically, atan
and tan are excluded because they first need converting to being weak
aliases; fma is omitted as it has additional complications with
versions in other directories (removing the ldbl-opt version can
e.g. cause the ldbl-128 version to be used instead of dbl-64); and
functions that have both dbl-64/wordsize-64 and ldbl-opt versions are
excluded because ldbl-opt currently always wraps dbl-64 function
versions, so changing those will result in platforms using both
ldbl-opt and dbl-64/wordsize-64 (i.e. alpha) starting to use the
dbl-64/wordsize-64 versions of those functions (which is good, as an
optimization, but still best separated from the present patch to get
better validation).
Tested for x86_64, and tested with build-many-glibcs.py that installed
stripped shared libraries are unchanged by the patch.
* sysdeps/ieee754/dbl-64/s_asinh.c: Include <libm-alias-double.h>.
(asinh): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_cbrt.c: Include <libm-alias-double.h>.
(cbrt): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_copysign.c: Include
<libm-alias-double.h>.
(copysign): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_erf.c: Include <libm-alias-double.h>.
(erf): Define using libm_alias_double.
(erfc): Likewise.
* sysdeps/ieee754/dbl-64/s_expm1.c: Include <libm-alias-double.h>.
(expm1): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_fabs.c: Include <libm-alias-double.h>.
(fabs): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_fromfp.c (fromfp): Define using
libm_alias_double.
* sysdeps/ieee754/dbl-64/s_fromfp_main.c: Include
<libm-alias-double.h>.
* sysdeps/ieee754/dbl-64/s_fromfpx.c (fromfpx): Define using
libm_alias_double.
* sysdeps/ieee754/dbl-64/s_getpayload.c: Include
<libm-alias-double.h>.
(getpayload): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_llrint.c: Include
<libm-alias-double.h>.
(llrint): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_lrint.c: Include <libm-alias-double.h>.
(lrint): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_nextup.c: Include
<libm-alias-double.h>.
(nextup): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_roundeven.c: Include
<libm-alias-double.h>.
(roundeven): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_setpayload.c (setpayload): Define using
libm_alias_double.
* sysdeps/ieee754/dbl-64/s_setpayload_main.c: Include
<libm-alias-double.h>.
* sysdeps/ieee754/dbl-64/s_setpayloadsig.c (setpayloadsig): Define
using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_sin.c: Include <libm-alias-double.h>.
(cos): Define using libm_alias_double.
(sin): Likewise.
* sysdeps/ieee754/dbl-64/s_sincos.c: Include
<libm-alias-double.h>.
(sincos): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_tanh.c: Include <libm-alias-double.h>.
(tanh): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_totalorder.c: Include
<libm-alias-double.h>.
(totalorder): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_totalordermag.c: Include
<libm-alias-double.h>.
(totalordermag): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_ufromfp.c (ufromfp): Define using
libm_alias_double.
* sysdeps/ieee754/dbl-64/s_ufromfpx.c (ufromfpx): Define using
libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c: Include
<libm-alias-double.h>.
(getpayload): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c: Include
<libm-alias-double.h>.
(roundeven): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c: Include
<libm-alias-double.h>.
* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Include
<libm-alias-double.h>.
(totalorder): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Include
<libm-alias-double.h>.
(totalordermag): Define using libm_alias_double.
* sysdeps/ieee754/ldbl-opt/s_copysign.c (copysignl): Only define
libc compat symbol here.
* sysdeps/ieee754/ldbl-opt/s_asinh.c: Remove file.
* sysdeps/ieee754/ldbl-opt/s_cbrt.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_erf.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_expm1.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_fabs.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_llrint.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_lrint.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_sin.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_sincos.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_tanh.c: Likewise.
When --enable-static-pie is used to configure glibc, we need to use
_dl_relocate_static_pie to compute load address in static PIE.
* sysdeps/arm/dl-machine.h (elf_machine_load_address): Use
_dl_relocate_static_pie instead of _dl_start to compute load
address in static PIE. Return 0 if _DYNAMIC is undefined for
static executable.
mips uses a local label to compute load address, which works with static
PIE. We just need to return 0 if _DYNAMIC is undefined for static
executable.
* sysdeps/mips/dl-machine.h (elf_machine_dynamic): Return 0 if
_DYNAMIC is undefined for static executable.
A few math functions still use __fabs(f/l) rather than fabs, which
means they won't be inlined. Rename them so they are inlined.
Also add -fno-builtin-fabsl to nofpu powerpc makefile to work around
BZ #29253.
* sysdeps/ieee754/dbl-64/e_lgamma_r.c
(__ieee754_lgamma_r): Use fabs rather than __fabs.
* sysdeps/ieee754/dbl-64/e_log10.c (__ieee754_log10): Likewise.
* sysdeps/ieee754/dbl-64/e_log2.c (__ieee754_log2): Likewise.
* sysdeps/ieee754/flt-32/e_lgammaf_r.c
(__ieee754_lgammaf_r): Use fabsf rather than __fabsf.
* sysdeps/ieee754/flt-32/e_log10f.c (__ieee754_log10f): Likewise.
* sysdeps/ieee754/flt-32/e_log2f.c (__ieee754_log2f): Likewise.
* sysdeps/ieee754/ldbl-128/e_lgammal_r.c
(__ieee754_lgammal_r): Use fabsl rather than __fabsl.
* sysdeps/ieee754/ldbl-128/e_log10l.c (__ieee754_log10l): Likewise.
* sysdeps/ieee754/ldbl-128/e_log2l.c (__ieee754_log2l): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
(__ieee754_lgammal_r): Use fabsl rather than __fabsl.
* sysdeps/ieee754/ldbl-128ibm/e_log10l.c (__ieee754_log10l): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_log2l.c (__ieee754_log2l): Likewise.
* sysdeps/powerpc/nofpu/Makefile: Add -fno-builtin-fabsl for BZ #29253.
Remove old cimag inlines that are only used in GCC 2.96 or older.
* math/bits/cmathcalls.h (cimag): Remove inline.
(creal): Remove inline.
(conj): Remove inline.
without wrapper on aarch64:
powf reciprocal-throughput: 4.2x faster
powf latency: 2.6x faster
old worst-case error: 1.11 ulp
new worst-case error: 0.82 ulp
aarch64 .text size: -780 bytes
aarch64 .rodata size: +144 bytes
powf(x,y) is implemented as exp2(y*log2(x)) with the same algorithms
that are used in exp2f and log2f, except that the log2f polynomial is
larger for extra precision and its output (and exp2f input) may be
scaled by a power of 2 (POWF_SCALE) to simplify the argument reduction
step of exp2 (possible when efficient round and convert toint operation
is available).
The special case handling tries to minimize the checks in the hot path.
When the input of exp2_inline is checked, int arithmetics is used as
that was faster on the tested aarch64 cores.
* math/Makefile (type-float-routines): Add e_powf_log2_data.
* sysdeps/ieee754/flt-32/e_powf.c: New implementation.
* sysdeps/ieee754/flt-32/e_powf_log2_data.c: New file.
* sysdeps/ieee754/flt-32/math_config.h (__powf_log2_data): Define.
(issignalingf_inline): Likewise.
(POWF_LOG2_TABLE_BITS): Likewise.
(POWF_LOG2_POLY_ORDER): Likewise.
(POWF_SCALE_BITS): Likewise.
(POWF_SCALE): Likewise.
* sysdeps/i386/fpu/e_powf_log2_data.c: New file.
* sysdeps/ia64/fpu/e_powf_log2_data.c: New file.
* sysdeps/m68k/m680x0/fpu/e_powf_log2_data.c: New file.
Similar to the new logf: double precision arithmetics and a small
lookup table is used. The argument reduction step is the same as in
the new logf.
without wrapper on aarch64:
log2f reciprocal-throughput: 2.3x faster
log2f latency: 2.1x faster
old worst case error: 1.72 ulp
new worst case error: 0.75 ulp
aarch64 .text size: -252 bytes
aarch64 .rodata size: +244 bytes
* math/Makefile (type-float-routines): Add e_log2f_data.
* sysdeps/ieee754/flt-32/e_log2f.c: New implementation.
* sysdeps/ieee754/flt-32/e_log2f_data.c: New file.
* sysdeps/ieee754/flt-32/math_config.h (__log2f_data): Define.
(LOG2F_TABLE_BITS, LOG2F_POLY_ORDER): Define.
* sysdeps/i386/fpu/e_log2f_data.c: New file.
* sysdeps/ia64/fpu/e_log2f_data.c: New file.
* sysdeps/m68k/m680x0/fpu/e_log2f_data.c: New file.
When --enable-static-pie is used to build static PIE, _DYNAMIC is used
to compute the load address of static PIE. But _DYNAMIC is undefined
when creating static executable. This patch makes _DYNAMIC weak in PIE
libc.a so that it can be undefined.
* sysdeps/i386/dl-machine.h (elf_machine_load_address): Allow
undefined _DYNAMIC in PIE libc.a.
* sysdeps/x86_64/dl-machine.h (elf_machine_load_address):
Likewse.
Simplify the C99 isgreater macros. Although some support was added
in GCC 2.97, not all targets added support until GCC 3.1. Therefore
only use the builtins in math.h from GCC 3.1 onwards, and defer to
generic macros otherwise. Improve the generic isunordered macro
to use compares rather than call fpclassify twice - this is not only
faster but also correct for signaling NaNs.
* math/math.h: Improve handling of C99 isgreater macros.
* sysdeps/alpha/fpu/bits/mathinline.h: Remove isgreater macros.
* sysdeps/m68k/m680x0/fpu/bits/mathinline.h: Likewise.
* sysdeps/powerpc/bits/mathinline.h: Likewise.
* sysdeps/sparc/fpu/bits/mathinline.h: Likewise.
* sysdeps/x86/fpu/bits/mathinline.h: Likewise.
In <https://sourceware.org/ml/libc-alpha/2013-05/msg00722.html> I
remarked on the possibility of arithmetic in various nearbyint
implementations being scheduled before feholdexcept calls, resulting
in spurious "inexact" exceptions.
I'm now actually observing this occurring in glibc built for ARM with
GCC 7 (in fact, both copies of the same addition/subtraction sequence
being combined and moved out before the conditionals and
feholdexcept/fesetenv pairs), resulting in test failures.
This patch makes the nearbyint implementations with this particular
feholdexcept / arithmetic / fesetenv pattern consistently use
math_opt_barrier on the function argument when first used in
arithmetic, and also consistently use math_force_eval before fesetenv
(the latter was generally already done, but the dbl-64/wordsize-64
implementation used math_opt_barrier instead, and as
math_opt_barrier's intended effect is through its output value being
used, such a use that doesn't use the return value is suspect).
Tested for x86_64 (--disable-multi-arch so more of these
implementations get used), and for ARM in a configuration where I saw
the problem scheduling.
[BZ #22225]
* sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use
math_opt_barrier on argument when doing arithmetic on it.
* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c (__nearbyint):
Likewise. Use math_force_eval not math_opt_barrier after
arithmetic.
* sysdeps/ieee754/flt-32/s_nearbyintf.c (__nearbyintf): Use
math_opt_barrier on argument when doing arithmetic on it.
* sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl):
Likewise.
from `freeaddrinfo'.
`getifaddrs' and `freeifaddrs' are not in POSIX, they should not be
exposed along `freeaddrinfo' (through `__check_pf') which is POSIX.
* include/ifaddrs.h (__getifaddrs, __freeifaddrs): New declarations,
and use libc_hidden_def on them.
* inet/ifaddrs.c (__getifaddrs, __freeifaddrs): Use libc_hidden_def on
them.
* sysdeps/gnu/ifaddrs.c (__getifaddrs, __freeifaddrs): Likewise.
* inet/check_pf.c (__check_pf): Use __getifaddrs and __freeifaddrs
instead of getifaddrs and freeifaddrs.
`seekdir' is MISC || XOPEN, it should not be exposed along `rewinddir' which
is POSIX.
* include/dirent.h (__seekdir): New declaration.
* sysdeps/mach/hurd/seekdir.c (seekdir): Rename to __seekdir and
redefine as weak alias.
* sysdeps/mach/hurd/rewinddir.c (__rewinddir): Use __seekdir instead
of seekdir.
`revoke' is MISC only, it should not be exposed along `unlockpt' which is
XOPEN.
* include/unistd.h (__revoke): New declaration.
* misc/revoke.c (revoke): Rename to __revoke, and redefine as weak
alias.
* sysdeps/mach/hurd/revoke.c (revoke): Likewise.
* sysdeps/unix/bsd/unlockpt.c (unlockpt): Use __revoke instead of
revoke.
dirfd is XOPEN2K8 only, it should not be exposed along ftw which is earlier.
* include/dirent.h (__dirfd): New declaration.
* dirent/dirfd.c (dirfd): Rename to __dirfd, and redefine as weak
alias.
* sysdeps/posix/dirfd/dirfd.c (dirfd): Likewise.
* sysdeps/mach/hurd/dirfd.c (dirfd): Likewise.
* io/ftw.c (open_dir_stream, ftw_dir): Use __dirfd instead of dirfd.
sysdeps/unix/make-syscalls.sh has support, used only by x32, for
generating IFUNCs for kernel VDSO symbols. This support creates
IFUNCs by setting symbol types manually, which is bad for debug info
and does not work with current GCC mainline because it results in
errors from the checks on types of function aliases.
This patch fixes it to use the common __ifunc macro, which uses the
ifunc attribute when available and so works with GCC mainline. Note
however that the original error resulted from an indirect inclusion of
a header declaring __gettimeofday from the generated sources, and
using __ifunc now relies on such an indirect inclusion remaining as it
means use of __typeof to determine the correct types. If glibc's
headers change in such a way as to remove that indirect inclusion, it
will become necessary to change the syscalls.list syntax for VDSO
syscalls so the name of the header to include can be specified.
Tested (compilation only) with build-many-glibcs.py that this fixes
the build for x32 with GCC mainline.
* sysdeps/unix/make-syscalls.sh: Use __ifunc to define symbols
using VDSO.
Current implementation of tunables does not set arena_max and arena_test
values. Any value provided by glibc.malloc.arena_max and
glibc.malloc.arena_test parameters is ignored.
These tunables have minval value set to 1 (see elf/dl-tunables.list file)
and undefined maxval value. In that case default value (which is 0. see
scripts/gen-tunables.awk) is being used to set maxval.
For instance, generated tunable_list[] entry for arena_max is:
(gdb) p *cur
$1 = {name = 0x7ffff7df6217 "glibc.malloc.arena_max",
type = {type_code = TUNABLE_TYPE_SIZE_T, min = 1, max = 0},
val = {numval = 0, strval = 0x0}, initialized = false,
security_level = TUNABLE_SECLEVEL_SXID_IGNORE,
env_alias = 0x7ffff7df622e "MALLOC_ARENA_MAX"}
As a result, any value of glibc.malloc.arena_max is ignored by
TUNABLE_SET_VAL_IF_VALID_RANGE macro
__type min = (__cur)->type.min; <- initialized to 1
__type max = (__cur)->type.max; <- initialized to 0!
if (min == max) <- false
{
min = __default_min;
max = __default_max;
}
if ((__type) (__val) >= min && (__type) (val) <= max) <- false
{
(__cur)->val.numval = val;
(__cur)->initialized = true;
}
Assigning correct min/max values at a build time fixes a problem.
Plus, a bit of optimization: Setting of default min/max values for the
given type at a run time might be eliminated.
* elf/dl-tunables.c (do_tunable_update_val): Range checking fix.
* scripts/gen-tunables.awk: Set unspecified minval and/or maxval
values to correct default value for given type.
ELF objects generated with "objcopy --only-keep-debug" have
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
DYNAMIC 0x0+e28 0x0+200e40 0x0+200e40 0x0+ 0x0+1a0 RW 0x8
with 0 file size. ld.so should skip such PT_DYNAMIC segments.
Without a PT_DYNAMIC segment the loading of the shared object will
fail, and therefore ldd on such objects will also fail instead of
crashing. This provides better diagnostics for tooling that is
attempting to inspect the invalid shared objects which may just
contain debug information.
[BZ #22101]
* elf/Makefile (tests): Add tst-debug1.
($(objpfx)tst-debug1): New.
($(objpfx)tst-debug1.out): Likewise.
($(objpfx)tst-debug1mod1.so): Likewise.
* elf/dl-load.c (_dl_map_object_from_fd): Skip PT_DYNAMIC segment
with p_filesz == 0.
* elf/tst-debug1.c: New file.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
glibc fails to build with GCC mainline for SPARC because of the use of
manually-created IFUNCs, which fail the tests of compatibility of
function alias types. This patch changes sparc-ifunc.h to use the
generic __ifunc in defining sparc_libm_ifunc. The generic __ifunc can
use the GCC ifunc attribute when available, so ensuring
type-correctness as well as better debug info than when setting symbol
types in asm statements.
Note that for this to fix the build with GCC mainline the GCC patch
<https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01779.html>, or
building GCC with --enable-gnu-indirect-function, is also needed.
Tested (compilation only) with build-many-glibcs.py (sparc64-linux-gnu
and sparcv9-linux-gnu, with GCC 8 with the above patch, and also with
GCC 7).
* sysdeps/sparc/sparc-ifunc.h [!__ASSEMBLER__] (sparc_libm_ifunc):
Define using __ifunc.
As per https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01220.html ia64
defaults to non-executable stacks in the Linux kernel (furthermore,
the use of function descriptors means that trampolines for nested
function pointers never need an executable stack). glibc however
defines DEFAULT_STACK_PERMS to include PF_X for that architecture,
meaning (a) elf/check-execstack fails and (b) (from code inspection,
not tested, but this is why I think this is a user-visible bug) thread
stacks are unnecessarily mapped with execute permission. This patch
fixes the DEFAULT_STACK_PERMS definition in question.
Tested (compilation only) with build-many-glibcs.py for ia64. This
fixes the check-execstack failure.
[BZ #22156]
* sysdeps/ia64/stackinfo.h (DEFAULT_STACK_PERMS): Likewise.
Problem reported by Florian Weimer [1] and solution suggested by
Andreas Schwab [2]. It also set the same buffer size independent
of architecture max_align_t size.
Checked on x86_64-linux-gnu and i686-linux-gnu.
* lib/malloc/scratch_buffer.h (struct scratch_buffer):
Use an union instead of a max_align_t array for __space,
so that __space is the same size on all platforms.
* malloc/scratch_buffer_grow_preserve.c
(__libc_scratch_buffer_grow_preserve): Likewise.
[1] https://sourceware.org/ml/libc-alpha/2017-09/msg00693.html
[2] https://sourceware.org/ml/libc-alpha/2017-09/msg00695.html
This patch follows commit 5554304f0 (posix: Allow glob to match dangling
symlinks [BZ #866]) by adding a compat symbol that follow previous
semantic of not following dangling symlinks and thus avoiding call
gl_lstat with GLOB_ALTDIRFUNC.
It avoids failure with old binaries that not set the alternate function
pointer for lstat (GNUmake for instance). The following scenario, for
instance, fails with current GNUmake because glibc will access unitialized
memory when calling gl_lstat:
$ cat src/t/t.c
int main ()
{
return 0;
}
$ cat Makefile
SRC = $(wildcard src/*/t.c)
OBJ = $(patsubst src/%.c, obj/%.o, $(SRC))
prog: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o prog
obj/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
$ make
This works as expected with the patch applied. Since it is for generic
ABI, default compat symbols are added with override for Linux due LFS.
Now we have two compat symbols for glob on Linux:
1. sysdeps/unix/sysv/linux/oldglob.c which implements glob64 with
the old dirent layout. For this implementation I also set it to
not follow dangling symlinks (which is the safest path).
2. sysdeps/unix/sysv/linux/glob{64}-lstat-compat.c which implements
the compat symbol for dangling symlinks. As for generic glob,
the implementation uses XSTAT_IS_XSTAT64 to define whether
both __glob_lstat_compat and __glob64_lstat_compat should be
different implementations. For archictures that define
XSTAT_IS_XSTAT64, __glob_lstat_compat is aliased to
__glob64_lstat_compat.
3. sysdeps/unix/sysv/linux/alpha/oldglob.c with a different glob_t
layout. As for 1. this patch changes it to not follow dangling
symlinks.
The patch also bumps _GNU_GLOB_INTERFACE_VERSION to 2 to advertise the
new semantic. On GNUmake, for instance, it will force to it use its
internal glob implementation instead and avoiding triggering the same
failure on builds against newer GLIBCs.
Checked on x86_64-linux-gnu and i686-linux-gnu. I also checked
with a build against the major ABIs required to check for the abilist.
The changes should also work on gnulib (I run gnulib-tool.py check glob
and it shown no regressions).
[BZ #22183]
* include/gnu-versions.h (_GNU_GLOB_INTERFACE_VERSION): Increase
version to 2.
* posix/Makefile (routines): Add glob-lstat-compat and
glob64-lstat-compat.
* posix/Versions (GLIBC_2.27, glob, glob64): Add symbol version.
* posix/glob-lstat-compat.c: New file.
* posix/glob64-lstat-compat.c: Likewise.
* posix/tst-glob_lstat_compat.c: Likewise.
* sysdeps/unix/sysv/linux/glob-lstat-compat.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c: Likewise.
* sysdeps/unix/sysv/linux/glob64-lstat-compat.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/glob.c: Remove file.
* posix/glob.c (glob_lstat): New function.
(glob): Rename to __glob and add versioned symbol to 2.27.
(glob_in_dir): Use glob_lstat.
* posix/glob64.c (glob64): Add GLOB_ATTRIBUTE.
* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/glob.c (glob): Add versioned symbol for
2.27.
* sysdeps/unix/sysv/linux/glob64.c (glob64): Likewise.
* sysdeps/unix/sysv/linux/oldglob.c (GLOB_NO_LSTAT): Define.
* sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob): Do not use
gl_lstat on glob call.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add GLIBC_2.27 glob
and glob64 symbols.
* 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.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/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.
Commit 073e8fa773 requires binutils 2.25
or later to build glibc:
* configure.ac (AS): Require binutils 2.25 or later.
(LD): Likewise.
But it only updated LD version check in configure.ac. This patch adds
the missing AS version check.
* configure.ac (AS): Require binutils 2.25 or later.
* configure: Regenerated.
[BZ #22161]
* nscd/netgroupcache.c (addinnetgrX): Release read lock after
resetting timeout.
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Andreas Schwab <schwab@suse.de>
A lock is held by mempool_allocate() when CACHEABLE is true; we
must release this lock if we exit early.
This patch fixes a typo in inclusion guard in sincos32.h.
ChangeLog:
* sysdeps/ieee754/dbl-64/sincos32.h
[SINCCOS32_H]: Remove define.
[SINCOS32_H]: Define.
This patch changes the expf and exp2f error handling semantics to only
set errno accoring to POSIX rules. New symbol version is introduced at
GLIBC_2.27.
The old wrappers are kept for compat symbols.
Internal calls to __expf now get the new error semantics, this seems to
only affect sysdeps/i386/fpu/s_expm1f.S where the errno-only behaviour
should be correct.
ia64 needed assembly change to have the new and compat versioned symbol
map to the same function.
All linux libm abilists are updated.
* math/Versions (expf): New libm symbol at GLIBC_2.27.
(exp2f): Likewise.
* math/w_exp2f.c: New file.
* math/w_expf.c: New file.
* math/w_exp2f_compat.c (__exp2f_compat): For compat symbol only.
* math/w_expf_compat.c (__expf_compat): Likewise.
* sysdeps/ia64/fpu/e_exp2f.S: Add versioned symbols.
* sysdeps/ia64/fpu/e_expf.S: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update.
* 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.
Based on new expf and exp2f code from
https://github.com/ARM-software/optimized-routines/
with wrapper on aarch64:
expf reciprocal-throughput: 2.3x faster
expf latency: 1.7x faster
without wrapper on aarch64:
expf reciprocal-throughput: 3.3x faster
expf latency: 1.7x faster
without wrapper on aarch64:
exp2f reciprocal-throughput: 2.8x faster
exp2f latency: 1.3x faster
libm.so size on aarch64:
.text size: -152 bytes
.rodata size: -1740 bytes
expf/exp2f worst case nearest rounding error: 0.502 ulp
worst case non-nearest rounding error: 1 ulp
Error checks are inline and errno setting is in separate tail called
functions, but the wrappers are kept in this patch to handle the
_LIB_VERSION==_SVID_ case. (So e.g. errno is set twice for expf calls
and once for __expf_finite calls on targets where the new code is used.)
Double precision arithmetics is used which is expected to be faster on
most targets (including soft-float) than using single precision and it
is easier to get good precision result with it.
Const data is kept in a separate translation unit which complicates
maintenance a bit, but is expected to give good code for literal loads
on most targets and allows sharing data across expf, exp2f and powf.
(This data is disabled on i386, m68k and ia64 which have their own
expf, exp2f and powf code.)
Some details may need target specific tweaks:
- best convert and round to int operation in the arg reduction may be
different across targets.
- code was optimized on fma target, optimal polynomial eval may be
different without fma.
- gcc does not always generate good code for fp bit representation
access via unions or it may be inherently slow on some targets.
The libm-test-ulps will need adjustment because..
- The argument reduction ideally uses nearest rounded rint, but that is
not efficient on most targets, so the polynomial can get evaluated on a
wider interval in non-nearest rounding mode making 1 ulp errors common
in that case.
- The polynomial is evaluated such that it may have 1 ulp error on
negative tiny inputs with upward rounding.
* math/Makefile (type-float-routines): Add math_errf and e_exp2f_data.
* sysdeps/aarch64/fpu/math_private.h (TOINT_INTRINSICS): Define.
(roundtoint, converttoint): Likewise.
* sysdeps/ieee754/flt-32/e_expf.c: New implementation.
* sysdeps/ieee754/flt-32/e_exp2f.c: New implementation.
* sysdeps/ieee754/flt-32/e_exp2f_data.c: New file.
* sysdeps/ieee754/flt-32/math_config.h: New file.
* sysdeps/ieee754/flt-32/math_errf.c: New file.
* sysdeps/ieee754/flt-32/t_exp2f.h: Remove.
* sysdeps/i386/fpu/e_exp2f_data.c: New file.
* sysdeps/i386/fpu/math_errf.c: New file.
* sysdeps/ia64/fpu/e_exp2f_data.c: New file.
* sysdeps/ia64/fpu/math_errf.c: New file.
* sysdeps/m68k/m680x0/fpu/e_exp2f_data.c: New file.
* sysdeps/m68k/m680x0/fpu/math_errf.c: New file.
conform/ISO11/time.h/linknamespace complains that using timespec_get exposes
gettimeofday.
conform/POSIX/time.h/linknamespace complains that using clock_settime
exposes settimeofday.
* sysdeps/unix/clock_gettime.c (realtime_gettime, __clock_gettime): Use
__gettimeofday instead of gettimeofday.
* sysdeps/unix/clock_settime.c (__clock_settime): Use __settimeofday
instead of settimeofday.
server_thread_udp_process_one already takes care of calling sendto()
instead of xsendto to be able to ignore the case where the client has
closed the socket. Depending on the TCP/IP stack behavior, this error
could be notified later through recvfrom(), so we need to ignore it
there too.
* support/resolv_test.c (server_thread_udp_process_one): Call recvfrom
instead of xrecvfrom, and ignore ECONNREFUSED errors.
* sysdeps/mach/hurd/bits/socket.h: Include <bits/wordsize.h> instead
of <limits.h>
(__need_NULL): Do not define.
(__ss_aligntype): Use __WORDSIZE instead of ULONG_MAX to determine
alignment.
[!__USE_MISC] (pseudo_AF_XTP, pseudo_AF_RTIP, pseudo_AF_PIP,
CMGROUP_MAX, cmsgcred): Do not define.
(CMSG_FIRSTHDR, __cmsg_nxthdr): Use (struct cmsghdr *) 0 instead of
NULL.
* bits/socket.h: Likewise.
* sysdeps/mach/hurd/dl-sysdep.c (check_no_hidden): New macro.
(__open, __close, __libc_read, __libc_write, __writev, __libc_lseek64,
__mmap, __fxstat64, __xstat64, __access, __access_noerrno, __getpid,
__getcwd, __sbrk, __strtoul_internal, _exit, abort): Use check_no_hidden
to make sure that these symbols are defined.
This patch makes flt-32 libm functions use libm_alias_float to define
public interfaces (in cases where _Float32 aliases of those interfaces
would be appropriate, so not for finitef / isinff / isnanf).
Tested for x86_64. Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.
* sysdeps/ieee754/flt-32/s_asinhf.c: Include <libm-alias-float.h>.
(asinhf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_atanf.c: Include <libm-alias-float.h>.
(atanf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_cbrtf.c: Include <libm-alias-float.h>.
(cbrtf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_ceilf.c: Include <libm-alias-float.h>.
(ceilf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_copysignf.c: Include
<libm-alias-float.h>.
(copysignf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_cosf.c: Include <libm-alias-float.h>.
(cosf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_erff.c: Include <libm-alias-float.h>.
(erff): Define using libm_alias_float.
(erfcf): Likewise.
* sysdeps/ieee754/flt-32/s_expm1f.c: Include <libm-alias-float.h>.
(expm1f): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_fabsf.c: Include <libm-alias-float.h>.
(fabsf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_floorf.c: Include <libm-alias-float.h>.
(floorf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_frexpf.c: Include <libm-alias-float.h>.
(frexpf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_fromfpf.c (fromfpf): Define using
libm_alias_float.
* sysdeps/ieee754/flt-32/s_fromfpf_main.c: Include
<libm-alias-float.h>.
* sysdeps/ieee754/flt-32/s_fromfpxf.c (fromfpxf): Define using
libm_alias_float.
* sysdeps/ieee754/flt-32/s_getpayloadf.c: Include
<libm-alias-float.h>.
(getpayloadf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_llrintf.c: Include
<libm-alias-float.h>.
(llrintf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_llroundf.c: Include
<libm-alias-float.h>.
(llroundf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_logbf.c: Include <libm-alias-float.h>.
(logbf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_lrintf.c: Include <libm-alias-float.h>.
(lrintf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_lroundf.c: Include <libm-alias-float.h>.
(lroundf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_modff.c: Include <libm-alias-float.h>.
(modff): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_nearbyintf.c: Include
<libm-alias-float.h>.
(nearbyintf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_nextafterf.c: Include
<libm-alias-float.h>.
(nextafterf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_nextupf.c: Include
<libm-alias-float.h>.
(nextupf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_remquof.c: Include
<libm-alias-float.h>.
(remquof): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_rintf.c: Include <libm-alias-float.h>.
(rintf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_roundevenf.c: Include
<libm-alias-float.h>.
(roundevenf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_roundf.c: Include <libm-alias-float.h>.
(roundf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_setpayloadf.c (setpayloadf): Define
using libm_alias_float.
* sysdeps/ieee754/flt-32/s_setpayloadf_main.c: Include
<libm-alias-float.h>.
* sysdeps/ieee754/flt-32/s_setpayloadsigf.c (setpayloadsigf):
Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_sincosf.c: Include
<libm-alias-float.h>.
(sincosf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_sinf.c: Include <libm-alias-float.h>.
(sinf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_tanf.c: Include <libm-alias-float.h>.
(tanf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_tanhf.c: Include <libm-alias-float.h>.
(tanhf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_totalorderf.c: Include
<libm-alias-float.h>.
(totalorderf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_totalordermagf.c: Include
<libm-alias-float.h>.
(totalordermagf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_truncf.c: Include <libm-alias-float.h>.
(truncf): Define using libm_alias_float.
* sysdeps/ieee754/flt-32/s_ufromfpf.c (ufromfpf): Define using
libm_alias_float.
* sysdeps/ieee754/flt-32/s_ufromfpxf.c (ufromfpxf): Define using
libm_alias_float.
When optimization for size is on (-Os), fpclassify does not use the
type-generic __builtin_fpclassify builtin, instead it uses __MATH_TG.
However, when library support for float128 is available, __MATH_TG uses
__builtin_types_compatible_p, which is not available in C++ mode.
On the other hand, libstdc++ undefines (in cmath) many macros from
math.h, including fpclassify, so that it can provide its own functions.
However, during its configure tests, libstdc++ just tests for the
availability of the macros (it does not undefine them, nor does it
provide its own functions).
Finally, when libstdc++ is configured with optimization for size
enabled, its configure tests include math.h and get the definition of
fpclassify that uses __MATH_TG (and __builtin_types_compatible_p).
Since libstdc++ does not undefine the macros during its configure tests,
they fail.
This patch lets fpclassify use the builtin in C++ mode, even when
optimization for size is on. This allows the configure test in
libstdc++ to work.
Tested for powerpc64le and x86_64.
[BZ #22146]
math/math.h: Let fpclassify use the builtin in C++ mode, even
when optimazing for size.
This patch removes the Banner mechanism, with the last remaining
Banner file replaced by a contrib.texi entry. This accords with the
principle that the output of running libc.so.6 is not the place to
credit particular contributions (the manual is), and with all other
configuration options not mentioned there, it doesn't seem appropriate
to focus there on the one question of whether the one remaining piece
configured as an add-on was enabled or not.
Tested for x86_64.
* csu/Makefile (generated): Do not add version-info.h.
(before-compile): Likewise.
(all-Banner-files): Remove variable.
($(objpfx)version-info.h): Remove rule.
* csu/version.c (banner): Do not include "version-info.h".
* libidn/Banner: Remove.
* manual/contrib.texi (Simon Josefsson): New entry.
The IEEE 754 implementation of lgammal in sysdeps/ieee754/ldbl-128/ used
to be shared by IBM's implementation in sysdeps/ieee754/ldbl-128ibm/ (by
an inclusion of the source file). In order for the algorithm to work
for IBM's implementation, a check for LDBL_MANT_DIG was required. Since
the source file is no longer shared, the requirement for the check is
gone. This patch removes the conditionals.
Tested for powerpc64le and s390x.
* sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r):
Remove conditionals on LDBL_MANT_DIG.
* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
(__ieee754_lgammal_r): Likewise.
The ldbl-128ibm implementation of j0l, j1l, lgammal_r, and cbrtl, as
well as the tables used by expl were copied from ldbl-128. However, the
original files used _Float128 for the type and L() for the literal
suffix. This patch uses the following sed command to rewrite _Float128
as long double and L(x) as xL (for e_expl.c, e_j0l.c, e_j1l.c,
e_lgammal_r.c, and t_expl.h):
sed -i <filename> \
-e "/^#define _Float128 long double/d" \
-e "/^#define L(x) x ## L/d" \
-e "/L(/s/)/L/" \
-e "/L(/s/L(//" \
-e "s/_Float128/long double/g"
For sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c, this sed command incorrectly
replaces a few occurrences of L(), so the following command is used
instead:
sed -i sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c \
-e "/^#define _Float128 long double/d" \
-e "/^#define L(x) x ## L/d" \
-e "s/L(0\.3\{40\})/0.3333333333333333333333333333333333333333L/" \
-e "s/L(3\.7568280825958912391243e-1)/3.7568280825958912391243e-1L/" \
-e "/L(/s/)/L/" \
-e "/L(/s/L(//" \
-e "s/_Float128/long double/g"
Tested for powerpc64le with patched [1] and unpatched gcc.
[1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html
* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Remove definitions of
_Float128 and L().
* sysdeps/ieee754/ldbl-128ibm/e_j0l.c: Remove definitions of
_Float128 and L(). Replace _Float128 with long double and L(x)
with xL, throughout the file.
* sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/t_expl.h: Likewise.
Some files under sysdeps/ieee754/ldbl-128ibm/ are able to reuse the
implementation in sysdeps/ieee754/ldbl-128/ by defining _Float128 to
long double. This relied on compiler support for _Float128 being
disabled. On powerpc, such support was disabled by default, however, it
got enabled by default [1] in GCC 8.
This patch copies the implementations from ldbl-128 to ldbl-128ibm. The
uses of _Float128 and L() are kept intact in this patch and are replaced
with a script in a subsequent patch.
[1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html
Tested for powerpc64 and powerpc64le.
* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Include tables from
sysdeps/ieee754/ldbl-128ibm.
* sysdeps/ieee754/ldbl-128ibm/e_j0l.c: Copy contents from the
equivalent implementation in sysdeps/ieee754/ldbl-128/ instead
of including it. Keep _Float128 and L() intact. These will be
reviewed by a separate patch.
* sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/t_expl.h: Likewise.
On powerpc64le, compiler support for float128 is not enabled by default
on gcc. To enable it, the flag -mfloat128 must be passed as a command
line option to the compiler. This means that only the few files that
actively have -mfloat128 passed as an argument get compiler support for
float128, whereas all other files don't.
When -mfloat128 becomes enabled by default on powerpc [1], all the files
that do not currently have compiler support for float128 enabled during
their compilation, will start to have it. This will lead to build
errors in s_finite.c, s_isinf.c, and s_isnan.c.
The errors are due to the unintended macro expansion of __finitef128 to
__redirect_finitef128 in math/bits/mathcalls-helper-functions.h. In
that header, __MATHDECL_1 takes '__finite' and 'f128' as arguments and
concatenates them. However, since '__finite' has been redefined in
s_finite.c, the function declaration becomes __redirect_finitef128:
extern int __redirect___finitef128 (_Float128 __value) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));
This declaration itself is OK. The problem arises when include/math.h
creates the hidden prototype ('hidden_proto (__finitef128)'), which
expands to:
extern __typeof (__finitef128) __finitef128 __attribute__ ((visibility ("hidden")));
Since __finitef128 is not declared, __typeof fails. This effect was
already true for the 'float' and 'long double' versions and is now true
for float128. Likewise for isinsff128 and isnanf128.
This patch defines __finitef128 as __redirect___finitef128 in
sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c, similarly to what's
done for the float and long double versions of these functions, to get
rid of the build error. Likewise for isinff128 and isnanf128.
[1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html
Tested for powerpc64 and powerpc64le.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
(__finitef128): Define to __redirect___finitef128.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
(__isinff128): Define to __redirect___isinff128.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
(__isnanf128): Define to __redirect___isnanf128.
On powerpc64le, not all files can have the flag -mfloat128 passed as an
option on the compile command, since that could conflict with other
flags, such as -mno-vsx. Each file that needs the flag, gets it through
a CFLAGS-filename variable on sysdeps/powerpc/powerpc64le/Makefile.
The test cases tst-strtod-nan-locale and tst-wcstod-nan-locale are
missing this flag.
Tested for powerpc64le.
* sysdeps/powerpc/powerpc64le/Makefile
(CFLAGS-tst-strtod-nan-locale.c): New variable.
(CFLAGS-tst-wcstod-nan-locale.c): New variable.
POSIX requires that dlclose() and exit() be thread safe, therefore
you can have one thread in the middle of dlclose() and another thread
executing exit() without causing any undefined behaviour on the part
of the implementation.
The existing implementation had a flaw that exit() exit handler processing
did not consider a concurrent dlclose() and would not mark already run
exit handlers using the ef_free flavour. The consequence of this is that
a concurrent exit() with dlclose() will run all the exit handlers that
dlclose() had not yet run, but then will block on the loader lock. The
concurrent dlclose() will continue to run all the exit handlers again
(twice) in violation of the Itanium C++ ABI requirements for __cxa_atexit().
This commit fixes this by having exit() mark all handlers with ef_free to
ensure that concurrent dlclose() won't re-run registered exit handlers that
have already run.
Various subdirectories of glibc include Banner files to put some text
in the output of executing libc.so.6, under "Available extensions".
Some of those subdirectories (e.g. crypt) may originally have been
add-ons (and so optional, so a particular glibc build might or might
not have included them), but except for libidn they aren't now (or if
only included in some builds, in the case of soft-fp, the inclusion
depends on the architecture for which glibc is configured rather than
having any glibc configuration for which it's an optional feature),
and it doesn't seem useful for the libc.so.6 output to call out a few
features like that.
This patch removes the non-add-on Banner files, updating contrib.texi
where they noted contributions not otherwise mentioned there.
Tested for x86_64.
* crypt/Banner: Remove file.
* nptl/Banner: Likewise.
* resolv/Banner: Likewise.
* soft-fp/Banner: Likewise.
* nptl/Makefile ($(objpfx)banner.h): Remove rule.
($(objpfx)version.d): Remove dependency on banner.h.
($(objpfx)version.os): Likewise.
* nptl/version.c (banner): Do not include banner.h.
* manual/contrib.texi: Update entries for Richard Henderson, Jakub
Jelinek and BIND code.
This patch adds SSE4.1 versions of trunc and truncf, using the roundsd
/ roundss instructions, similar to the versions of ceil, floor, rint
and nearbyint functions we already have. In my testing with the glibc
benchtests these are about 30% faster than the C versions for double,
20% faster for float.
Tested for x86_64.
[BZ #20142]
* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
Add s_trunc-c, s_truncf-c, s_trunc-sse4_1 and s_truncf-sse4_1.
* sysdeps/x86_64/fpu/multiarch/s_trunc-c.c: New file.
* sysdeps/x86_64/fpu/multiarch/s_trunc-sse4_1.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_trunc.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_truncf-c.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_truncf-sse4_1.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_truncf.c: Likewise.
exp2f and log2f benchmark traces are just copies of the existing
expf and logf traces from wrf_r.
* benchtests/Makefile: Add exp2f and log2f benchmarks.
* benchtests/exp2f-inputs: Copy of expf-inputs.
* benchtests/log2f-inputs: Copy of logf-inputs.
The recent fexecve changes broke the build on (at least) alpha (maybe
other configurations, that was the first breakage I saw in my
build-many-glibcs.py run):
In file included from ../sysdeps/unix/sysv/linux/alpha/sysdep.h:29:0,
from ../sysdeps/alpha/nptl/tls.h:31,
from ../include/errno.h:25,
from ../sysdeps/unix/sysv/linux/fexecve.c:18:
../sysdeps/unix/sysv/linux/fexecve.c: In function 'fexecve':
../sysdeps/unix/alpha/sysdep.h:203:10: error: 'sizeof' on array function parameter 'argv' will return size of 'char * const*' [-Werror=sizeof-array-argument]
(sizeof(arg) == 4 ? (long)(int)(long)(arg) : (long)(arg))
^
../sysdeps/unix/alpha/sysdep.h:302:26: note: in expansion of macro 'syscall_promote'
register long _tmp_18 = syscall_promote (arg3); \
^~~~~~~~~~~~~~~
../sysdeps/unix/alpha/sysdep.h:173:2: note: in expansion of macro 'inline_syscall5'
inline_syscall##nr(__NR_##name, args); \
^~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/alpha/sysdep.h:85:2: note: in expansion of macro 'INLINE_SYSCALL1'
INLINE_SYSCALL1(name, nr, args); \
^~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/fexecve.c:42:3: note: in expansion of macro 'INLINE_SYSCALL'
INLINE_SYSCALL (execveat, 5, fd, "", argv, envp, AT_EMPTY_PATH);
^~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/fexecve.c:33:30: note: declared here
fexecve (int fd, char *const argv[], char *const envp[])
^~~~
This patch fixes this similarly to previous fixes for such issues: use
&argv[0] and &envp[0] as the syscall macro arguments. Tested
(compilation only) for alpha-linux-gnu with build-many-glibcs.py.
* sysdeps/unix/sysv/linux/fexecve.c (fexecve) [__NR_execveat]:
Explicitly take address of first element of array arguments in
call to INLINE_SYSCALL.
Add a trace for logf. This is a reduced trace based on 2.8 billion
samples extracted from wrf_r.
* benchtests/Makefile: Add logf benchmark.
* benchtests/logf-inputs: Add reduced trace from wrf_r.
Add a trace for expf. This is a reduced trace based on 2.4 billion
samples extracted from wrf_r.
* benchtests/Makefile: Add expf benchmark.
* benchtests/expf-inputs: Add reduced trace from wrf_r.
Add unwind info to __libc_start_main so that unwinding continues one
extra level to _start. Similarly add unwind info to backtrace.
Given many targets require this, do this in a general way.
* csu/Makefile: Add -funwind-tables to libc-start.c.
* debug/Makefile: Add -funwind-tables to backtrace.c.
* sysdeps/aarch64/Makefile: Remove CFLAGS-backtrace.c.
* sysdeps/arm/Makefile: Likewise.
* sysdeps/i386/Makefile: Likewise.
* sysdeps/m68k/Makefile: Likewise.
* sysdeps/mips/Makefile: Likewise.
* sysdeps/nios2/Makefile: Likewise.
* sysdeps/sh/Makefile: Likewise.
* sysdeps/sparc/Makefile: Likewise.
This patch adds benchtests for the trunc and truncf functions. The
inputs listed are fairly arbitrary; I do not assert they are
representative of any particular application.
* benchtests/Makefile (bench-math): Add trunc and truncf.
(CFLAGS-bench-trunc.c): New variable.
(CFLAGS-bench-truncf.c): Likewise.
* benchtests/trunc-inputs: New file.
* benchtests/truncf-inputs: Likewise.
As per the section "3.1.4.2 Alignment Interrupts" of the "POWER8 Processor
User's Manual for the Single-Chip Module", alignment interrupt is reported
for misaligned stores in Caching-inhibited storage. As memset is used in
some drivers for DMA (like xorg), this patch avoids misaligned stores for
sizes less than 8 in memset.
This patch fixes a problem on powerpc64le that I missed in initial
testing of my last patch to ldbl-opt. In the specific case of
powerpc64le, the weak aliases for exp10l and remainderl do not get
defined in the generic wrappers because of how those wrappers
undefine and redefine weak_alias. This patch restores those aliases
in the ldbl-opt code.
Tested (compilation only) for powerpc64le with build-many-glibcs.py.
* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c [LIBM_SVID_COMPAT &&
!LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)] (weak_alias): Undefine and
redefine.
[LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)]
(exp10l): Define as weak alias.
* sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c [LIBM_SVID_COMPAT
&& !LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (weak_alias): Undefine
and redefine.
[LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)]
(remainderl): Define as weak alias.
This patch converts libm function implementations in math/ from using
weak_alias to using libm_alias_ldouble to define public function
names, in cases where it would be appropriate to define _Float128 /
_Float64x aliases for those functions as well (in cases where either
or both of those types exist and have the same ABI as long double).
This eliminates many ldbl-opt wrappers round these function
implementations.
Tested for x86_64, and with build-many-glibcs.py. All installed
stripped shared libraries are unchanged except for libm.so on
powerpc64le. As noted for a previous patch, powerpc64le's use of
ldbl-opt means various long double functions get defined using
long_double_symbol which gives them an explicit symbol version in the
object files, and this patch results in some such functions using
weak_alias instead (because powerpc64le never had a previous version
of these functions for long double = double); both produce a valid
libm.so with the same public symbols at the same versions, but macros
expanding to call weak_alias is cleaner in this case.
* math/s_fmal.c: Include <libm-alias-ldouble.h>.
(fmal): Define using libm_alias_ldouble.
* math/w_acoshl_compat.c: Include <libm-alias-ldouble.h>.
(acoshl): Define using libm_alias_ldouble.
* math/w_acosl_compat.c: Include <libm-alias-ldouble.h>.
(acosl): Define using libm_alias_ldouble.
* math/w_asinl_compat.c: Include <libm-alias-ldouble.h>.
(asinl): Define using libm_alias_ldouble.
* math/w_atan2l_compat.c: Include <libm-alias-ldouble.h>.
(atan2l): Define using libm_alias_ldouble.
* math/w_atanhl_compat.c: Include <libm-alias-ldouble.h>.
(atanhl): Define using libm_alias_ldouble.
* math/w_coshl_compat.c: Include <libm-alias-ldouble.h>.
(coshl): Define using libm_alias_ldouble.
* math/w_exp10l_compat.c: Include <libm-alias-ldouble.h>.
(exp10l): Define using libm_alias_ldouble.
* math/w_exp2l_compat.c: Include <libm-alias-ldouble.h>.
(exp2l): Define using libm_alias_ldouble.
* math/w_expl_compat.c: Include <libm-alias-ldouble.h>.
(expl): Define using libm_alias_ldouble.
* math/w_fmodl_compat.c: Include <libm-alias-ldouble.h>.
(fmodl): Define using libm_alias_ldouble.
* math/w_hypotl_compat.c: Include <libm-alias-ldouble.h>.
(hypotl): Define using libm_alias_ldouble.
* math/w_j0l_compat.c: Include <libm-alias-ldouble.h>.
(j0l): Define using libm_alias_ldouble.
(y0l): Likewise.
* math/w_j1l_compat.c: Include <libm-alias-ldouble.h>.
(j1l): Define using libm_alias_ldouble.
(y1l): Likewise.
* math/w_jnl_compat.c: Include <libm-alias-ldouble.h>.
(jnl): Define using libm_alias_ldouble.
(ynl): Likewise.
* math/w_log10l_compat.c: Include <libm-alias-ldouble.h>.
(log10l): Define using libm_alias_ldouble.
* math/w_log2l_compat.c: Include <libm-alias-ldouble.h>.
(log2l): Define using libm_alias_ldouble.
* math/w_logl_compat.c: Include <libm-alias-ldouble.h>.
(logl): Define using libm_alias_ldouble.
* math/w_powl_compat.c: Include <libm-alias-ldouble.h>.
(powl): Define using libm_alias_ldouble.
* math/w_remainderl_compat.c: Include <libm-alias-ldouble.h>.
(remainderl): Define using libm_alias_ldouble.
* math/w_sinhl_compat.c: Include <libm-alias-ldouble.h>.
(sinhl): Define using libm_alias_ldouble.
* math/w_sqrtl_compat.c: Include <libm-alias-ldouble.h>.
(sqrtl): Define using libm_alias_ldouble.
* math/w_tgammal_compat.c: Include <libm-alias-ldouble.h>.
(tgammal): Define using libm_alias_ldouble.
* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c [LIBM_SVID_COMPAT]
(exp10l): Do not use long_double_symbol here.
* sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c
[LIBM_SVID_COMPAT] (remainderl): Likewise.
* sysdeps/ieee754/ldbl-opt/s_fmal.c: Remove.
* sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_expl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise.
eXecute-Only Memory (XOM) is a protection mechanism against some ROP
attacks. XOM sets the code as executable and unreadable, so the access
to any data, like literal pools, in the code section causes the fault
with XOM. The compiler can disable literal pools for C source files,
but not for assembly files, so I use movz/movk instead of literal pools
in start.S for XOM.
I add MOVL macro with movz/movk instructions like movl pseudo-instruction
in armasm, and use the macro instead of literal pools.
* sysdeps/aarch64/start.S: Use MOVL instead of literal pools.
* sysdeps/aarch64/sysdep.h (MOVL): Add MOVL macro.
The compare_strings.py option unconditionally generates a graph PNG
image of the input data, which can be unnecessary and slow. Put this
behind an optional flag -g.
* benchtests/scripts/compare_strings.py: New option -g.
(draw_graph): Print a message that a graph is being generated.
(process_results): Generate graph only if -g is passed.
(main): Process option -g.
Make the column widths for the outputs fixed so that they look a
little less messy. They will still look bad with lots of IFUNCs (like
on x86) but it's still a step forward.
* benchtests/scripts/compare_strings.py (process_results):
Better spacing for output.
Make the script more usable by adding proper command line options
along with a way to query the options. The script is capable of doing
a bunch of things right now like choosing a base for comparison,
choosing to generate graphs, etc. and they should be accessible via
command line switches.
* benchtests/scripts/compare_strings.py: Use argparse.
* benchtests/README: Document existence of compare_strings.py.
This patch converts libm function implementations in math/ from using
weak_alias to using libm_alias_double to define public function names,
in cases where it would be appropriate to define _Float64 / _Float32x
aliases for those functions as well. This eliminates many
NO_LONG_DOUBLE conditionals and ldbl-opt wrappers round these function
implementations.
Tested for x86_64. Also tested with build-many-glibcs.py. Binary
differences seen are that the different order in which remainder and
drem symbols get defined as a result of this patch (the same source
file defines the same aliases, but in a different order of definition)
changes the order of symbols in the final libm.so when long double =
double, and for ldbl-opt configurations, the compat symbols for Bessel
functions were previously defined by e.g. "compat_symbol (libm, j0,
j0l, GLIBC_2_0)", which declares j0l as a compat symbol based on j0
and so makes j0l weak because j0 is weak, and are now defined
(indirectly via the relevant macros) based on e.g. __j0, so are no
longer weak because __j0 isn't weak.
* math/s_fma.c: Include <libm-alias-double.h>.
(fma): Define using libm_alias_double.
* math/s_nextafter.c: Include <libm-alias-double.h>.
(nextafter): Define using libm_alias_double.
* math/w_acos_compat.c: Include <libm-alias-double.h>.
(acos): Define using libm_alias_double.
* math/w_acosh_compat.c: Include <libm-alias-double.h>.
(aocsh): Define using libm_alias_double.
* math/w_asin_compat.c: Include <libm-alias-double.h>.
(asin): Define using libm_alias_double.
* math/w_atan2_compat.c: Include <libm-alias-double.h>.
(atan2): Define using libm_alias_double.
* math/w_atanh_compat.c: Include <libm-alias-double.h>.
(atanh): Define using libm_alias_double.
* math/w_cosh_compat.c: Include <libm-alias-double.h>.
(cosh): Define using libm_alias_double.
* math/w_exp10_compat.c: Include <libm-alias-double.h>.
(exp10): Define using libm_alias_double.
* math/w_exp2_compat.c: Include <libm-alias-double.h>.
(exp2): Define using libm_alias_double.
* math/w_exp_compat.c: Include <libm-alias-double.h>.
(exp): Define using libm_alias_double.
* math/w_fmod_compat.c: Include <libm-alias-double.h>.
(fmod): Define using libm_alias_double.
* math/w_hypot_compat.c: Include <libm-alias-double.h>.
(hypot): Define using libm_alias_double.
* math/w_j0_compat.c: Include <libm-alias-double.h>.
(j0): Define using libm_alias_double.
(y0): Likewise.
* math/w_j1_compat.c: Include <libm-alias-double.h>.
(j1): Define using libm_alias_double.
(y1): Likewise.
* math/w_jn_compat.c: Include <libm-alias-double.h>.
(jn): Define using libm_alias_double.
(yn): Likewise.
* math/w_log10_compat.c: Include <libm-alias-double.h>.
(log10): Define using libm_alias_double.
* math/w_log2_compat.c: Include <libm-alias-double.h>.
(log2): Define using libm_alias_double.
* math/w_log_compat.c: Include <libm-alias-double.h>.
(log): Define using libm_alias_double.
* math/w_pow_compat.c: Include <libm-alias-double.h>.
(pow): Define using libm_alias_double.
* math/w_remainder_compat.c: Include <libm-alias-double.h>.
(remainder): Define using libm_alias_double.
* math/w_sinh_compat.c: Include <libm-alias-double.h>.
(sinh): Define using libm_alias_double.
* math/w_sqrt_compat.c: Include <libm-alias-double.h>.
(sqrt): Define using libm_alias_double.
* math/w_tgamma_compat.c: Include <libm-alias-double.h>.
(tgamma): Define using libm_alias_double.
* sysdeps/ieee754/ldbl-opt/s_nextafter.c [LONG_DOUBLE_COMPAT(libm,
GLIBC_2_0)] (nextafterl): Do not define compat symbol here.
* sysdeps/ieee754/ldbl-opt/w_exp10_compat.c
[LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)] (exp10l): Likewise.
* sysdeps/ieee754/ldbl-opt/w_remainder_compat.c
[LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (remainderl): Likewise.
* sysdeps/ieee754/ldbl-opt/w_acos_compat.c: Remove.
* sysdeps/ieee754/ldbl-opt/w_acosh_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_asin_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_atan2_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_atanh_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_cosh_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_exp_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_fmod_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_hypot_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_j0_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_j1_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_jn_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_log10_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_log2_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_log_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_pow_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_sinh_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_sqrt_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_tgamma_compat.c: Likewise.
The math/ directory has various stub implementations of functions
(generally long double functions, plus sqrtf128) that set errno to
ENOSYS and print a message.
These are a relic of when the long double libm implementation in glibc
was originally incomplete. They are only present for a limited set of
libm functions, not all those that would need implementing for any
hypothetical new long double format, and only for long double (plus
sqrtf128), not for other floating-point types. I removed the
corresponding ENOSYS tests in the testsuite in
<https://sourceware.org/ml/libc-alpha/2013-05/msg00599.html>.
I think these stubs are an inherently different case from stubs for
functionality needing OS-specific implementations, since
floating-point formats are generally standardized between modern
processors (a new long double format does not seem likely - I'd expect
new ports all to have long double = binary128 or long double =
binary64 - though _Float16 functions *f16 are entirely possible in
future) and libm functions are generally only expected to fail for
domain / range / pole errors, not for other unknown system-specific
conditions the way the functions needing OS-specific implementations
may fail.
This patch removes these stub implementations. The effect (which, as
noted above, was actually mostly already the case, given the
incompleteness of the set of stubs, and was certainly the case if you
wanted your libm port to *work* rather than just build) is that any
new long double format needs to provide a full set of functions for
the build to succeed; any port using ldbl-128 needs to provide sqrtl
(possibly using the soft-fp version from another port); any port using
ldbl-96 needs to provide all those functions that all of
x86_64/i386/ia64/m68k provide rather than getting from the ldbl-96
directory; any port with _Float128 as a type with a distinct format
needs to provide sqrtf128.
Tested for x86_64. Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.
* math/e_acoshl.c: Remove.
* math/e_acosl.c: Likewise.
* math/e_asinl.c: Likewise.
* math/e_atan2l.c: Likewise.
* math/e_atanhl.c: Likewise.
* math/e_coshl.c: Likewise.
* math/e_expl.c: Likewise.
* math/e_fmodl.c: Likewise.
* math/e_gammal_r.c: Likewise.
* math/e_hypotl.c: Likewise.
* math/e_j0l.c: Likewise.
* math/e_j1l.c: Likewise.
* math/e_jnl.c: Likewise.
* math/e_lgammal_r.c: Likewise.
* math/e_log10l.c: Likewise.
* math/e_log2l.c: Likewise.
* math/e_logl.c: Likewise.
* math/e_powl.c: Likewise.
* math/e_rem_pio2l.c: Likewise.
* math/e_sinhl.c: Likewise.
* math/e_sqrtf128.c: Likewise.
* math/e_sqrtl.c: Likewise.
* math/k_cosl.c: Likewise.
* math/k_sinl.c: Likewise.
* math/k_tanl.c: Likewise.
* math/s_asinhl.c: Likewise.
* math/s_atanl.c: Likewise.
* math/s_cbrtl.c: Likewise.
* math/s_erfl.c: Likewise.
* math/s_expm1l.c: Likewise.
* math/s_log1pl.c: Likewise.
* math/s_tanhl.c: Likewise.
Some math functions have to be distributed in libc because they're
required by printf.
libc and libm require their own builds of these functions, e.g. libc
functions have to call __stack_chk_fail_local in order to bypass the
PLT, while libm functions have to call __stack_chk_fail.
While math/Makefile treat the generic cases, i.e. s_isinff, the
multiarch Makefile has to treat its own files, i.e. s_isinff-ppc64.
[BZ #21745]
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile:
[$(subdir) = math] (sysdep_calls): New variable. Has the
previous contents of sysdep_routines, but re-sorted..
[$(subdir) = math] (sysdep_routines): Re-use the contents from
sysdep_calls.
[$(subdir) = math] (libm-sysdep_routines): Remove the functions
defined in sysdep_calls and replace by the respective m_* names.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S:
(compat_symbol): Undefine to avoid duplicated compat symbols in
libc.
This patch converts libm function implementations in math/ from using
weak_alias to using libm_alias_float to define public function names,
in cases where it would be appropriate to define _Float32 aliases for
those functions as well. expf and exp2f are omitted from this patch,
given the in-progress patches that would change their symbol
versioning arrangements (at a later stage it will be necessary to add
macros that can be used for functions with such symbol versioning
arrangements - which will apply to lgammaf as well - but for the
initial patches in this area I'm just dealing with easy cases, and any
symbol versioning changes to these functions while the work is in
progress can effectively just undo the libm_alias_* changes as regards
those functions).
Tested for x86_64. Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.
* math/s_fmaf.c: Include <libm-alias-float.h>.
(fmaf): Define using libm_alias_float.
* math/w_acosf_compat.c: Include <libm-alias-float.h>.
(acosf): Define using libm_alias_float.
* math/w_acoshf_compat.c: Include <libm-alias-float.h>.
(acoshf): Define using libm_alias_float.
* math/w_asinf_compat.c: Include <libm-alias-float.h>.
(asinf): Define using libm_alias_float.
* math/w_atan2f_compat.c: Include <libm-alias-float.h>.
(atan2f): Define using libm_alias_float.
* math/w_atanhf_compat.c: Include <libm-alias-float.h>.
(atanhf): Define using libm_alias_float.
* math/w_coshf_compat.c: Include <libm-alias-float.h>.
(coshf): Define using libm_alias_float.
* math/w_exp10f_compat.c: Include <libm-alias-float.h>.
(exp10f): Define using libm_alias_float.
* math/w_fmodf_compat.c: Include <libm-alias-float.h>.
(fmodf): Define using libm_alias_float.
* math/w_hypotf_compat.c: Include <libm-alias-float.h>.
(hypotf): Define using libm_alias_float.
* math/w_j0f_compat.c: Include <libm-alias-float.h>.
(j0f): Define using libm_alias_float.
(y0f): Likewise.
* math/w_j1f_compat.c: Include <libm-alias-float.h>.
(j1f): Define using libm_alias_float.
(y1f): Likewise.
* math/w_jnf_compat.c: Include <libm-alias-float.h>.
(jnf): Define using libm_alias_float.
(ynf): Likewise.
* math/w_log10f_compat.c: Include <libm-alias-float.h>.
(log10f): Define using libm_alias_float.
* math/w_log2f_compat.c: Include <libm-alias-float.h>.
(log2f): Define using libm_alias_float.
* math/w_logf_compat.c: Include <libm-alias-float.h>.
(logf): Define using libm_alias_float.
* math/w_powf_compat.c: Include <libm-alias-float.h>.
(powf): Define using libm_alias_float.
* math/w_remainderf_compat.c: Include <libm-alias-float.h>.
(remainderf): Define using libm_alias_float.
* math/w_sinhf_compat.c: Include <libm-alias-float.h>.
(sinhf): Define using libm_alias_float.
* math/w_sqrtf_compat.c: Include <libm-alias-float.h>.
(sqrtf): Define using libm_alias_float.
* math/w_tgammaf_compat.c: Include <libm-alias-float.h>.
(tgammaf): Define using libm_alias_float.
Many libm functions define the function as __<func> and then define
<func> as a weak alias. This is not at all limited to cases where
there is an internal call that has namespace reasons to need to call
__<func> instead of <func>.
The common macros for creating libm function aliases work on the basis
of public function names all being aliases; that is, they define
aliases for functions using the above pattern. Thus, where a function
just defines the public name <func> directly, changing that to be a
weak alias enables a subsequent conversion to the common macros to
retain the exact existing symbols (and so be testable by comparison of
stripped binaries).
This patch converts many existing functions to use the weak alias
pattern, as preparation for subsequent conversions to common macros.
I do expect that _FloatN/_FloatNx function aliases will end up needing
new variants of the common macros that do *not* create the original
float / double / long double name of a function - for cases where that
name is created specially to give it a particular symbol version, for
example - but for functions that can use the most common macros to
create all the public names as aliases, it makes sense for them to do
so.
Regarding the Bessel function wrappers in this patch: only float and
double wrappers are changed because the long double wrappers already
used the weak alias pattern.
Tested for x86_64, and with build-many-glibcs.py.
* include/math.h (roundeven): Change hidden_proto call to
__roundeven.
* math/w_j0_compat.c (j0): Rename to __j0 and define as weak
alias.
[NO_LONG_DOUBLE] (__j0l): New strong alias.
(y0): Rename to __y0 and define as weak alias.
[NO_LONG_DOUBLE] (__y0l): New strong alias.
* math/w_j0f_compat.c (j0f): Rename to __j0f and define as weak
alias.
(y0f): Rename to __y0f and define as weak alias.
* math/w_j1_compat.c (j1): Rename to __j1 and define as weak
alias.
[NO_LONG_DOUBLE] (__j1l): New strong alias.
(y1): Rename to __y1 and define as weak alias.
[NO_LONG_DOUBLE] (__y1l): New strong alias.
* math/w_j1f_compat.c (j1f): Rename to __j1f and define as weak
alias.
(y1f): Rename to __y1f and define as weak alias.
* math/w_jn_compat.c (jn): Rename to __jn and define as weak
alias.
[NO_LONG_DOUBLE] (__jnl): New strong alias.
(yn): Rename to __yn and define as weak alias.
[NO_LONG_DOUBLE] (__ynl): New strong alias.
* math/w_jnf_compat.c (jnf): Rename to __jnf and define as weak
alias.
(ynf): Rename to __ynf and define as weak alias.
* sysdeps/ieee754/dbl-64/s_fromfp.c (FUNC): Define to __fromfp.
(fromfp): Define as weak alias.
[NO_LONG_DOUBLE] (__fromfpl): New strong alias.
* sysdeps/ieee754/dbl-64/s_fromfpx.c (FUNC): Define to __fromfpx.
(fromfpx): Define as weak alias.
[NO_LONG_DOUBLE] (__fromfpxl): New strong alias.
* sysdeps/ieee754/dbl-64/s_getpayload.c (getpayload): Rename to
__getpayload and define as weak alias.
[NO_LONG_DOUBLE] (__getpayloadl): New strong alias.
* sysdeps/ieee754/dbl-64/s_roundeven.c (roundeven): Rename to
__roundeven and define as weak alias.
[NO_LONG_DOUBLE] (__roundevenl): New strong alias.
* sysdeps/ieee754/dbl-64/s_setpayload.c (FUNC): Define to
__setpayload.
(setpayload): Define as weak alias.
[NO_LONG_DOUBLE] (__setpayloadl): New strong alias.
* sysdeps/ieee754/dbl-64/s_setpayloadsig.c (FUNC): Define to
__setpayloadsig.
(setpayloadsig): Define as weak alias.
[NO_LONG_DOUBLE] (__setpayloadsigl): New strong alias.
* sysdeps/ieee754/dbl-64/s_totalorder.c (totalorder): Rename to
__totalorder and define as weak alias.
[NO_LONG_DOUBLE] (__totalorderl): New strong alias.
* sysdeps/ieee754/dbl-64/s_totalordermag.c (totalordermag): Rename
to __totalordermag and define as weak alias.
[NO_LONG_DOUBLE] (__totalordermagl): New strong alias.
* sysdeps/ieee754/dbl-64/s_ufromfp.c (FUNC): Define to __ufromfp.
(ufromfp): Define as weak alias.
[NO_LONG_DOUBLE] (__ufromfpl): New strong alias.
* sysdeps/ieee754/dbl-64/s_ufromfpx.c (FUNC): Define to
__ufromfpx.
(ufromfpx): Define as weak alias.
[NO_LONG_DOUBLE] (__ufromfpxl): New strong alias.
* sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c (getpayload):
Rename to __getpayload and define as weak alias.
[NO_LONG_DOUBLE] (__getpayloadl): New strong alias.
* sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c (roundeven):
Rename to __roundeven and define as weak alias.
[NO_LONG_DOUBLE] (__roundevenl): New strong alias.
* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c (totalorder):
Rename to __totalorder and define as weak alias.
[NO_LONG_DOUBLE] (__totalorderl): New strong alias.
* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c
(totalordermag): Rename to __totalordermag and define as weak
alias.
[NO_LONG_DOUBLE] (__totalordermagl): New strong alias.
* sysdeps/ieee754/float128/float128_private.h (__getpayloadl): New
macro.
(__roundevenl): Likewise.
(__totalorderl): Likewise.
(__totalordermagl): Likewise
* sysdeps/ieee754/float128/s_fromfpf128.c (FUNC): Define to
__fromfpf128.
(fromfpf128): Define as weak alias.
* sysdeps/ieee754/float128/s_fromfpxf128.c (FUNC): Define to
__fromfpxf128.
(fromfpxf128): Define as weak alias.
* sysdeps/ieee754/float128/s_setpayloadf128.c (FUNC): Define to
__setpayloadf128.
(setpayloadf128): Define as weak alias.
* sysdeps/ieee754/float128/s_setpayloadsigf128.c (FUNC): Define to
__setpayloadsigf128.
(setpayloadsigf128): Define as weak alias.
* sysdeps/ieee754/float128/s_ufromfpf128.c (FUNC): Define to
__ufromfpf128.
(ufromfpf128): Define as weak alias.
* sysdeps/ieee754/float128/s_ufromfpxf128.c (FUNC): Define to
__ufromfpxf128.
(ufromfpxf128): Define as weak alias.
* sysdeps/ieee754/flt-32/s_fromfpf.c (FUNC): Define to __fromfpf.
(fromfpf): Define as weak alias.
* sysdeps/ieee754/flt-32/s_fromfpxf.c (FUNC): Define to
__fromfpxf.
(fromfpxf): Define as weak alias.
* sysdeps/ieee754/flt-32/s_getpayloadf.c (getpayloadf): Rename to
__getpayloadf and define as weak alias.
* sysdeps/ieee754/flt-32/s_roundevenf.c (roundevenf): Rename to
__roundevenf and define as weak alias.
* sysdeps/ieee754/flt-32/s_setpayloadf.c (FUNC): Define to
__setpayloadf.
(setpayloadf): Define as weak alias.
* sysdeps/ieee754/flt-32/s_setpayloadsigf.c (FUNC): Define to
__setpayloadsigf.
(setpayloadsigf): Define as weak alias.
* sysdeps/ieee754/flt-32/s_totalorderf.c (totalorderf): Rename to
__totalorderf and define as weak alias.
* sysdeps/ieee754/flt-32/s_totalordermagf.c (totalordermagf):
Rename to __totalordermagf and define as weak alias.
* sysdeps/ieee754/flt-32/s_ufromfpf.c (FUNC): Define to
__ufromfpf.
(ufromfpf): Define as weak alias.
* sysdeps/ieee754/flt-32/s_ufromfpxf.c (FUNC): Define to
__ufromfpxf.
(ufromfpxf): Define as weak alias.
* sysdeps/ieee754/ldbl-128/s_fromfpl.c (FUNC): Define to
__fromfpl.
(fromfpl): Define as weak alias.
* sysdeps/ieee754/ldbl-128/s_fromfpxl.c (FUNC): Define to
__fromfpxl.
(fromfpxl): Define as weak alias.
* sysdeps/ieee754/ldbl-128/s_getpayloadl.c (getpayloadl): Rename
to __getpayloadl and define as weak alias.
* sysdeps/ieee754/ldbl-128/s_roundevenl.c (roundevenl): Rename to
__roundevenl and define as weak alias.
* sysdeps/ieee754/ldbl-128/s_setpayloadl.c (FUNC): Define to
__setpayloadl.
(setpayloadl): Define as weak alias.
* sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c (FUNC): Define to
__setpayloadsigl.
(setpayloadsigl): Define as weak alias.
* sysdeps/ieee754/ldbl-128/s_totalorderl.c (totalorderl): Rename
to __totalorderl and define as weak alias.
* sysdeps/ieee754/ldbl-128/s_totalordermagl.c (totalordermagl):
Rename to __totalordermagl and define as weak alias.
* sysdeps/ieee754/ldbl-128/s_ufromfpl.c (FUNC): Define to
__ufromfpl.
(ufromfpl): Define as weak alias.
* sysdeps/ieee754/ldbl-128/s_ufromfpxl.c (FUNC): Define to
__ufromfpxl.
(ufromfpxl): Define as weak alias.
* sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c (FUNC): Define to
__fromfpl.
(fromfpl): Define as weak alias.
* sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c (FUNC): Define to
__fromfpxl.
(fromfpxl): Define as weak alias.
* sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c (getpayloadl):
Rename to __getpayloadl and define as weak alias.
* sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c (roundevenl): Rename
to __roundevenl and define as weak alias. Call __roundeven
instead of roundeven.
* sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c (FUNC): Define to
__setpayloadl.
(setpayloadl): Define as weak alias.
* sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c (FUNC): Define to
__setpayloadsigl.
(setpayloadsigl): Define as weak alias.
* sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c (totalorderl):
Rename to __totalorderl and define as weak alias.
* sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c (totalordermagl):
Rename to __totalordermagl and define as weak alias.
* sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c (FUNC): Define to
__ufromfpl.
(ufromfpl): Define as weak alias.
* sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c (FUNC): Define to
__ufromfpxl.
(ufromfpxl): Define as weak alias.
* sysdeps/ieee754/ldbl-96/s_fromfpl.c (FUNC): Define to
__fromfpl.
(fromfpl): Define as weak alias.
* sysdeps/ieee754/ldbl-96/s_fromfpxl.c (FUNC): Define to
__fromfpxl.
(fromfpxl): Define as weak alias.
* sysdeps/ieee754/ldbl-96/s_getpayloadl.c (getpayloadl): Rename to
__getpayloadl and define as weak alias.
* sysdeps/ieee754/ldbl-96/s_roundevenl.c (roundevenl): Rename to
__roundevenl and define as weak alias.
* sysdeps/ieee754/ldbl-96/s_setpayloadl.c (FUNC): Define to
__setpayloadl.
(setpayloadl): Define as weak alias.
* sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c (FUNC): Define to
__setpayloadsigl.
(setpayloadsigl): Define as weak alias.
* sysdeps/ieee754/ldbl-96/s_totalorderl.c (totalorderl): Rename to
__totalorderl and define as weak alias.
* sysdeps/ieee754/ldbl-96/s_totalordermagl.c (totalordermagl):
Rename to __totalordermagl and define as weak alias.
* sysdeps/ieee754/ldbl-96/s_ufromfpl.c (FUNC): Define to
__ufromfpl.
(ufromfpl): Define as weak alias.
* sysdeps/ieee754/ldbl-96/s_ufromfpxl.c (FUNC): Define to
__ufromfpxl.
(ufromfpxl): Define as weak alias.
Keeping the same buffers along with copying the same size of data into
the same location means that the first routine is typically the
slowest since it has to bear the cost of fetching data into to cache.
Reallocating buffers stabilizes numbers by a bit.
* benchtests/bench-string.h (realloc_bufs): New function.
(test_init): Call it.
* benchtests/bench-memset-large.c (do_test): Likewise.
* benchtests/bench-memset.c (do_test): Likewise.
Make the memset benchmarks (bench-memset and bench-memset-large) print
their output in JSON so that they can be evaluated using the
compare_strings.py script.
* benchtests/bench-memset-large.c: Print output in JSON
format.
* benchtests/bench-memset.c: Likewise.
This code page is identical to code page 850 except that X'D5'
has been changed from LI61 (dotless i) to SC20 (euro symbol).
The code points from /x01 to /x1f in the /localedata/charmaps/IBM858
file have the same mapping as those in localedata/charmaps/ANSI_X3.4-1968.
That means they disagree with with
ftp://ftp.software.ibm.com/software/globalization/gcoc/attachments/CP00858.txt
in that range.
For example, localedata/charmaps/IBM858 and localedata/charmaps/ANSI_X3.4-1968 have:
“<U0001> /x01 START OF HEADING (SOH)”
whereas CP00858.txt has:
“01 SS000000 Smiling Face”
That means that CP00858.txt is not really ASCII-compatible and to make
it ASCII-compatible we deviate fro CP00858.txt in the code points from /x01
to /x1f.
[BZ #21084]
* benchtests/strcoll-inputs/filelist#en_US.UTF-8: Add IBM858 and ibm858.c.
* iconvdata/Makefile: Add IBM858.
* iconvdata/gconv-modules: Add IBM858.
* iconvdata/ibm858.c: New file.
* iconvdata/tst-tables.sh: Add IBM858
* localedata/charmaps/IBM858: New file.
Continuing the process of setting up common macros for libm function
aliases, with a view to using them to define _FloatN / _FloatNx
aliases in future, this patch adds a libm_alias_float128 macro and
uses it in the type-generic templates. (_Float128 functions will end
up with _Float64x aliases on powerpc64le, but not on x86_64/x86/ia64
because _Float64x has long double format there, and the macro will
provide a single place for the conditionals for that choice, as well
as for once ldbl-128 functions always build *f128 and need
conditionals for whether to have *l aliases.)
Tested for x86_64. Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.
* sysdeps/generic/libm-alias-float128.h: New file.
* sysdeps/generic/math-type-macros-float128.h: Include
<libm-alias-float128.h>.
[!declare_mgen_alias] (declare_mgen_alias): Define macro.
Continuing the process of setting up common macros for libm function
aliases, with a view to using them to define _FloatN / _FloatNx
aliases in future, this patch adds a libm_alias_ldouble macro and uses
it in the type-generic templates.
Since math-type-macros-ldouble.h already did the appropriate thing for
each symbol (weak_alias or long_double_symbol), this is just a
straightforward rearrangement of code, to make the required logic
available in a place that can also be used outside of the type-generic
templates in future (in particular, to eliminate various wrappers for
functions in ldbl-opt and ldbl-64-128).
Tested for x86_64. Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.
* sysdeps/generic/libm-alias-ldouble.h: New file.
* sysdeps/ieee754/ldbl-opt/libm-alias-ldouble.h: Likewise.
* sysdeps/ieee754/ldbl-opt/math-type-macros-ldouble.h: Remove.
* sysdeps/generic/math-type-macros-ldouble.h: Include
<libm-alias-ldouble.h>.
[!declare_mgen_alias] (declare_mgen_alias): Define to use
libm_alias_ldouble.
This patch cleans up how compat symbols / long double versioning are
handled for log1p, ldexp, scalbn and scalbln functions.
The general principle is to do as much as possible through the
type-generic templates. Previously, when errno-setting wrappers were
added the compat long double symbols were left pointing directly to
the underlying implementations; they are moved to point to the
errno-setting wrappers. For the functions also present in libc,
compat symbol handling for the libc copies needs to go in ldbl-opt
wrappers, but the type-generic templates can handle it for the libm
copies. There is no need for w_scalbln_template.c to disable the
creation of an unused internal alias (such code made sense in the
context of patches trying to avoid any changes to generated code for
ease of comparison, but can be removed in a change that specifically
does intend to change details of where symbols point).
Tested for x86_64, and with build-many-glibcs.py.
* math/w_scalbln_template.c (strong_alias): Do not undefine and
redefine.
* sysdeps/ieee754/ldbl-opt/s_ldexp.c (declare_mgen_alias): Remove
macro.
(ldexpl): Only define as compat symbol for libc, not libm.
(scalbnl): Define as compat symbol for libc here.
* sysdeps/ieee754/ldbl-opt/s_ldexpl.c (declare_mgen_alias): Only
define for [IS_IN (libc)].
(__ldexpl_2): Remove alias.
(ldexpl): Only define with long_double_symbol if [IS_IN (libc)].
(scalbnl): Likewise. Use __wrap_scalbnl not __ldexpl_2 as base
name in long_double_symbol call.
* sysdeps/ieee754/ldbl-opt/s_log1p.c: Remove file.
* sysdeps/ieee754/ldbl-opt/s_scalbln.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_scalbn.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_log1p.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_scalbln.c (declare_mgen_alias):
Remove macro.
[IS_IN (libc) && LONG_DOUBLE_COMPAT (libc, GLIBC_2_1)] (scalblnl):
Define as compat symbol.
This patch fixes the compat glob implementation consolidation from
commit 116f1c64d with the following changes:
- Add a compat implementation on s390 to avoid the architecture
to build the symbols on default linux oldglob.c by setting
GLOB_NO_OLD_VERSION.
- Remove the duplicate rule to build oldglob on alpha.
Checked on s390-linux-gnu and alpha-linux-gnu using build-many-glibc.py.
* sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c: New file.
* sysdeps/unix/sysv/linux/alpha/Makefile
[$(subdir) = csu] (sysdep_routines): Remove rule.
Continuing the process of setting up common macros for libm function
aliases, with a view to using them to define _FloatN / _FloatNx
aliases in future, this patch adds a libm_alias_double macro and uses
it in the type-generic templates.
This macro handles defining aliases for double, and for long double in
the NO_LONG_DOUBLE case. It also handles defining compat symbols for
long double = double for architectures that changed their long double
format. By so doing, it eliminates the need for the
M_LIBM_NEED_COMPAT and declare_mgen_libm_compat macros; the single
declare_mgen_alias call in each template now suffices to define all
required compat symbols. When used for more double functions (not
based on type-generic templates), I expect it will eliminate the need
for most ldbl-opt wrappers for such functions.
A few special cases are needed. __clog10l is a public symbol (for
historical reasons) so needs to be given appropriate compat versions
for architectures that changed their long double format, but is not
defined as an alias using the normal macros since __clog10* are *not*
public symbols for _FloatN / _FloatNx types. For scalbn, scalbln and
log1p, the changes adding errno setting support for those functions
left compat symbols pointing directly to the non-errno-setting
implementations. There is no requirement for the compat symbols not
to set errno; that just made for the simplest patches at that time.
Now, with these common macros, it's natural to redirect the compat
symbols to the errno-setting wrappers, which I intend to do in a
separate patch.
Tested for x86_64, and with build-many-glibcs.py. For ldbl-opt
platforms the stripped libm.so binaries are changed (disassembly
unchanged) because the details of how the clog10l compat symbol is
created mean it ceases to be weak as it was before; for other
platforms, stripped libm.so binaries are unchanged.
2017-09-13 Joseph Myers <joseph@codesourcery.com>
* sysdeps/generic/libm-alias-double.h: New file.
* sysdeps/ieee754/ldbl-opt/libm-alias-double.h: Likewise.
* sysdeps/generic/math-type-macros-double.h: Include
<libm-alias-double.h>.
[declare_mgen_alias] (declare_mgen_alias): Define to use
libm_alias_double.
* sysdeps/generic/math-type-macros.h [!M_LIBM_NEED_COMPAT]
(M_LIBM_NEED_COMPAT): Remove macro.
[!M_LIBM_NEED_COMPAT] (declare_mgen_libm_compat): Likewise.
* sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: Remove.
* math/cabs_template.c [M_LIBM_NEED_COMPAT]: Remove conditional
code.
* math/carg_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/cimag_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/conj_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/creal_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_cacos_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_cacosh_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_casin_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_casinh_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_catan_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_catanh_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_ccos_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_ccosh_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_cexp_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_clog10_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_clog_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_cpow_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_cproj_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_csin_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_csinh_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_csqrt_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_ctan_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_ctanh_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_fdim_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_fmax_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_fmin_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/s_nan_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* math/w_ilogb_template.c [M_LIBM_NEED_COMPAT]: Likewise.
* sysdeps/ieee754/ldbl-opt/s_clog10.c: New file.
* sysdeps/ieee754/ldbl-opt/s_ldexp.c (M_LIBM_NEED_COMPAT): Remove
macro.
(declare_mgen_alias): New macro.
* sysdeps/ieee754/ldbl-opt/w_log1p.c: New file.
* sysdeps/ieee754/ldbl-opt/w_scalbln.c: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c
(M_LIBM_NEED_COMPAT): Remove macro.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c
[HAVE_AS_VIS3_SUPPORT]: Include <math_ldbl_opt.h> and
<first-versions.h>.
[HAVE_AS_VIS3_SUPPORT && LONG_DOUBLE_COMPAT (libm,
FIRST_VERSION_libm_fdiml)]: Define fdiml as compat symbol.
The libm template machinery includes a macro declare_mgen_alias_2, to
define two function aliases rather than one. This macro is only used
in one place, to define ldexp and scalbn, and only has one nondefault
definition, for double in the case where long double has the same
format. That definition is because declare_mgen_alias for double, in
that case, defines <internal-func>l as an alias of <internal-func>, so
cannot be called twice for aliases of the same function.
Now, I suspect the <internal-func>l aliases are generally not needed
(with maybe a few exceptions such as __clog10l, which is an exported
function). But even in the presence of them, there is no need for a
special declare_mgen_alias_2 macro for this case. This patch
eliminates the need for such a macro by defining __wrap_scalbn<suffix>
as an alias of __ldexp<suffix>, and then using that when defining the
scalbn public aliases. This is similar to how such internal aliases
are created for functions with multiple symbol versions, for example.
Tested for x86_64, and with build-many-glibcs.py. (There *are* some
cases where installed stripped shared libraries change - not in the
generated code but because such changes to static symbols on input to
ld, even nonexported symbols that don't affect the code or dynamic
symbols, can affect the particular representation in the output of
string tables, hash tables etc.)
* sysdeps/generic/math-type-macros.h [!declare_mgen_alias_2]
(declare_mgen_alias_2): Remove.
* sysdeps/generic/math-type-macros-double.h
[NO_LONG_DOUBLE && !declare_mgen_alias_2] (declare_mgen_alias_2):
Likewise.
* math/s_ldexp_template.c (M_SUF (__wrap_scalbn)): Define strong
alias.
(ldexp): Define with declare_mgen_alias.
(scalbn): Likewise.
AVX512 functions in mathvec are used on machines with AVX512. An AVX2
wrapper is also provided and it can be used when the AVX512 version
isn't profitable. MathVec_Prefer_No_AVX512 is addded to cpu-features.
If glibc.tune.hwcaps=MathVec_Prefer_No_AVX512 is set in GLIBC_TUNABLES
environment variable, the AVX2 wrapper will be used.
Tested on x86-64 machines with and without AVX512. Also verified
glibc.tune.hwcaps=MathVec_Prefer_No_AVX512 on AVX512 machine.
[BZ #21967]
* sysdeps/x86/cpu-features.h (bit_arch_MathVec_Prefer_No_AVX512):
New.
(index_arch_MathVec_Prefer_No_AVX512): Likewise.
* sysdeps/x86/cpu-tunables.c (TUNABLE_CALLBACK (set_hwcaps)):
Handle MathVec_Prefer_No_AVX512.
* sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx512.h
(IFUNC_SELECTOR): Return AVX2 version if MathVec_Prefer_No_AVX512
is set.
Fully supporting TS 18661-3 _FloatN / _FloatNx types in the cases
where they have the same format as other supported types (in line with
the principles described at
<https://sourceware.org/ml/libc-alpha/2017-01/msg00333.html>) means
adding a lot of function aliases to libm (and a few to libc). float
functions will have *f32 aliases, double functions will have *f32x and
*f64 aliases, long double functions may have *f64x, *f128 or both
aliases depending on the configuration, float128 functions have have
*f64x aliases depending on the configuration.
At present, most individual libm functions have their own weak_alias
calls to define the public names for those functions. For TS 18661-3
support, it is desirable that functions not all need to duplicate the
logic for which alias names to define.
Thus, common macros for defining the public aliases to a libm function
make sense. In the double and long double cases, such macros will
also help simplify existing code (with LONG_DOUBLE_COMPAT
etc. conditionals), by eliminating existing conditionals and ldbl-opt
/ ldbl-64-128 wrappers (using the generated ldbl-compat-choose.h to
allow a single macro definition to expand appropriately for each
symbol depending on LONG_DOUBLE_COMPAT for that symbol).
This patch starts the process of adding such macros with a
straightforward case: a libm_alias_float macro, initially only used in
the case of type-generic templates, to define aliases for float
functions (currently just the *f public names, in future also *f32).
Future patches are intended to add such macros for other types and to
extend the cases in which they are used, with a view to as many places
as possible using them before support for _FloatN / _FloatNx aliases
is enabled. (I think it's inevitable that some places doing
architecture-specific things with aliases and symbol versioning may
end up needing to replicate logic for the new aliases, but hopefully
the number of such places can be kept to a minimum.)
The libm_alias_float macro takes unsuffixed names for both the
internal and public function names. The need for unsuffixed public
names is obvious, since such macros will end up defining multiple
public names with different suffixes. Unsuffixed internal names are
because I expect the ldbl-128 functions to end up in a form that
always defines *f128 names and sometimes also defines *l names - with
the main internal names being e.g. __ieee754_<func>f128 (so many
macros in float128_private.h can go away). But __ieee754_<func>l
aliases will still be needed for e.g. use from math/ complex
functions, meaning the alias macro needs to see just __ieee754_<func>
as internal name so it can create an alias based on that name. Since
libm_alias_float128 will thus need the unsuffixed internal name, it
seems to make sense for all such macros to receive the unsuffixed
name.
Tested for x86_64. Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.
* sysdeps/generic/libm-alias-float.h: New file.
* sysdeps/generic/math-type-macros-float.h: Include
<libm-alias-float.h>.
[!declare_mgen_alias] (declare_mgen_alias): Define macro.
Before glibc 2.26, ld.so set dl_platform to "x86_64" and searched the
"x86_64" subdirectory when loading a shared library. ld.so in glibc
2.26 was changed to set dl_platform to "haswell" or "xeon_phi", based
on supported ISAs. This led to shared library loading failure for
shared libraries placed under the "x86_64" subdirectory.
This patch adds "x86_64" to x86-64 dl_hwcap so that ld.so will always
search the "x86_64" subdirectory when loading a shared library.
NB: We can't set x86-64 dl_platform to "x86-64" since ld.so will skip
the "haswell" and "xeon_phi" subdirectories on "haswell" and "xeon_phi"
machines.
Tested on i686 and x86-64.
[BZ #22093]
* sysdeps/x86/cpu-features.c (init_cpu_features): Initialize
GLRO(dl_hwcap) to HWCAP_X86_64 for x86-64.
* sysdeps/x86/dl-hwcap.h (HWCAP_COUNT): Updated.
(HWCAP_IMPORTANT): Likewise.
(HWCAP_X86_64): New enum.
(HWCAP_X86_AVX512_1): Updated.
* sysdeps/x86/dl-procinfo.c (_dl_x86_hwcap_flags): Add "x86_64".
* sysdeps/x86_64/Makefile (tests): Add tst-x86_64-1.
(modules-names): Add x86_64/tst-x86_64mod-1.
(LDFLAGS-tst-x86_64mod-1.so): New.
($(objpfx)tst-x86_64-1): Likewise.
($(objpfx)x86_64/tst-x86_64mod-1.os): Likewise.
(tst-x86_64-1-clean): Likewise.
* sysdeps/x86_64/tst-x86_64-1.c: New file.
* sysdeps/x86_64/tst-x86_64mod-1.c: Likewise.
2.3 is not representable with double, and thus leads to rounding issues if
the clock is not very precise and the measured delay is then exactly 2.3.
* sunrpc/tst-udp-timeout.c (test_udp_server): Increase timeout to 2.5
seconds.
“Bengali” still remained in some comments in the bn_BD locale file,
in iso-639.def and in a test input file. Change it there as well.
“Bangla” is now used as the English name for this language in CLDR.
[BZ #14925]
* libio/tst-widetext.input: Change “Bengali” to “Bangla”.
* locale/iso-639.def: Change “Bengali” to “Bangla”.
* localedata/locales/bn_BD: “Bengali” was still used in some
comments. Change it to “Bangla”.
* manual/tunables.texi (glibc.tune.cpu): Add thunderx2t99 and
thunderx2t99p1 to list of cpu names.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list):
Add thunderx2t99 and thunderx2t99p1 entries to cpu_list.
While reviewing Linux 4.13 for glibc header changes needed, I noticed
that bits/fcntl-linux.h was missing F_ADD_SEALS etc. from Linux 3.17.
I didn't find any discussion indicating this omission is deliberate.
Now, these interfaces can only be used with file descriptors created
with memfd_create, and we don't have a memfd_create wrapper in glibc
(a patch was submitted in October 2014, albeit without documentation /
tests, and discussions continued over the next few months, but without
consensus on whether to add the interface - and we still lack any
general consensus on syscall wrappers), but I don't think that's a
reason to exclude the constants from bits/fcntl-linux.h (especially as
the header does not look compatible with simultaneously including
linux/fcntl.h).
(Some of those 2014/2015 discussions raised concerns about difficulty
using the memfd_create / sealing interface, but those seem to me more
like a question of whether it should be part of the OS-independent GNU
API - in my view, even fairly specialized syscalls ought to have
wrappers added to glibc if not obsolescent, but there may be cases
where we only want to include them in the Linux-specific API and
anything in the OS-independent GNU API should be different - rather
than being relevant to whether constants for use with fcntl should
appear in headers.)
* sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU]
(F_ADD_SEALS): New macro.
[__USE_GNU] (F_GET_SEALS): Likewise.
[__USE_GNU] (F_SEAL_SEAL): Likewise.
[__USE_GNU] (F_SEAL_SHRINK): Likewise.
[__USE_GNU] (F_SEAL_GROW): Likewise.
[__USE_GNU] (F_SEAL_WRITE): Likewise.
This patch replaces the internal integer constant from
__glob_pattern_type return with a proper enum.
Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.
* posix/glob_internal.h (glob_pattern_type_t): New enumeration.
(__glob_pattern_type): Use __glob_pat_types.
* posix/glob_pattern_p.c (__glob_pattern_p): Likewise.
* posix/glob.c (glob): Likewise.
(glob_in_dir): Likewise.
This patch consolidates the glob implementation. The main changes are:
* On Linux all implementation now uses the default one at
sysdeps/unix/sysv/linux/glob{free}{64}.c with the exception
of alpha (which requires specific versioning) and s390-32 (which
different than other 32 bits ports it does not add a compat one
symbol for 2.1 version).
* The default implementation uses XSTAT_IS_XSTAT64 to define whether
both glob{free} and glob{free}64 should be different implementations.
For archictures that define XSTAT_IS_XSTAT64, glob{free} is an alias
to glob{free}64.
* Move i386 olddirent.h header to Linux default directory, since it is
the only header with this name and it is shared among different
architectures (and used on compat glob symbol as well).
Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.
* sysdeps/unix/sysv/linux/arm/glob64.c: Remove file.
* sysdeps/unix/sysv/linux/i386/glob64.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/glob64.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/globfree64.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/glob64.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/glob64.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/globfree64.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/glob.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/globfree.c: Likewise.
* sysdeps/wordsize-64/glob.c: Likewise.
* sysdeps/wordsize-64/glob64.c: Likewise.
* sysdeps/wordsize-64/globfree64.c: Likewise.
* sysdeps/unix/sysv/linux/glob.c: New file.
* sysdeps/unix/sysv/linux/glob64.c: Likewise.
* sysdeps/unix/sysv/linux/globfree.c: Likewise.
* sysdeps/unix/sysv/linux/globfree64.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/glob64.c: Likewise.
* sysdeps/unix/sysv/linux/oldglob.c [SHLIB_COMPAT]: Also
adds !GLOB_NO_OLD_VERSION as an extra condition.
* sysdeps/unix/sysv/linux/i386/alphasort64.c: Include olddirent.h
using relative path instead of absolute one.
* sysdeps/unix/sysv/linux/i386/getdents64.c: Likewise.
* sysdeps/unix/sysv/linux/i386/readdir64.c: Likewise.
* sysdeps/unix/sysv/linux/i386/readdir64_r.c: Likewise.
* sysdeps/unix/sysv/linux/i386/versionsort64.c: Likewise.
* sysdeps/unix/sysv/linux/i386/olddirent.h: Move to ...
* sysdeps/unix/sysv/linux//olddirent.h: ... here.
Current glob implementation allows unlimited user name for home
directory construction on GLOB_TILDE case. To accomplish it glob
either construct a name on stack if size are small enough (based
on current alloca_used) or in heap otherwise.
This patch simplifies storage allocation by using the same scratch
buffer for both get_rlogin_r and getpwnam_r.
This also syncs with gnulib commit 064df0b (glob: fix bugs with long
login names).
Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.
* posix/glob.c (GET_LOGIN_NAME_MAX): Remove.
(glob): Use the same scratch buffer for both getlogin_r and
getpwnam_r. Don’t require preallocation of the login name. This
simplifies storage allocation, and corrects the handling of
long login names.
This patch fixes longstanding misuse of errno after getpwnam_r,
which returns an error number rather than setting errno. This is
sync with gnulib commit 5db9301.
Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.
[BZ #1062]
* posix/glob.c (glob): Port recent patches to platforms
lacking getpwnam_r.
(glob): Fix longstanding misuse of errno after getpwnam_r, which
returns an error number rather than setting errno.
This patch syncs the scratch_buffer grom gnulib commit 3866ef6 with
GLIBC code.
Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.
* include/scratch_buffer.h (scratch_buffer): Use a C99 align method
instead of GCC extension.
* malloc/scratch_buffer_grow.c [!_LIBC]: Include libc-config.h.
* malloc/scratch_buffer_grow_preserve.c [!_LIBC]: Likewise.
* malloc/scratch_buffer_set_array_size.c [!_LIBC]: Likewise.
This patch makes glob match dangling symlinks. Compared to other glob
implementation (*BSD, bash, musl, and other shells as well), GLIBC seems
the be the only one that does not match dangling symlinks. As for
comment #5 in BZ #866, POSIX does not have any strict specification for
dangling symlinks match and it is reasonable that trying to glob everything
in a path should return all types of files (such as for a 'rm *'). Also,
comment #7 shows even more example where GLIBC current behavior is
unexepected.
I avoided adding another GNU specific flag to set this behavior and
instead make it the default. Although this change the semanthic from
previous implementation, I think adding another compat symbol to be
really unecessary as from aforementioned reasons (current behavior not
defined in any standard, general idea of different implementation is
to list dangling symbols).
This also sync glob with gnulib commit fd1daf4 (glob: match dangling
symlinks).
Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.
[BZ #866]
[BZ #1062]
* posix/Makefile (tests): Remove bug-glob1 and tst-glob_symlinks.
* posix/bug-glob1.c: Remove file.
* posix/tst-glob_symlinks.c: New file.
* posix/glob.c (__lstat64): New macro.
(is_dir): New function.
(glob, glob_in_dir): Match symlinks even if they are dangling.
(link_stat, link_exists_p): Remove. All uses removed.
According to this kernel commit 2adc376c55194, d_ino 0 is a regular inode
number on Linux (which also matches POSIX, as it does not treat the value
as special). This patch makes glob accept is a valid inode number.
This is also a sync with gnulib commit c8e57c1.
Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.
[BZ #1062]
[BZ #19971]
* posix/glob.c (struct readdir_result): Remove skip_entry member.
(readdir_result_skip_entry, D_INO_TO_RESULT): Remove.
All uses removed.
This patch syncs posix/glob.c implementation with gnulib version
b5ec983 (glob: simplify symlink detection). The only difference
to gnulib code is
* DT_UNKNOWN, DT_DIR, and DT_LNK definition in the case there
were not already defined. Gnulib code which uses
HAVE_STRUCT_DIRENT_D_TYPE will redefine them wrongly because
GLIBC does not define HAVE_STRUCT_DIRENT_D_TYPE. Instead
the patch check for each definition instead.
Also, the patch requires additional globfree and globfree64 files
for compatibility version on some architectures. Also the code
simplification leads to not macro simplification (not need for
NO_GLOB_PATTERN_P anymore).
Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py
for all major architectures.
[BZ #1062]
* posix/Makefile (routines): Add globfree, globfree64, and
glob_pattern_p.
* posix/flexmember.h: New file.
* posix/glob_internal.h: Likewise.
* posix/glob_pattern_p.c: Likewise.
* posix/globfree.c: Likewise.
* posix/globfree64.c: Likewise.
* sysdeps/gnu/globfree64.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/globfree.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/globfree64.c: Likewise.
* sysdeps/unix/sysv/linux/oldglob.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/globfree64.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/globfree.c: Likewise.
* sysdeps/wordsize-64/globfree.c: Likewise.
* sysdeps/wordsize-64/globfree64.c: Likewise.
* posix/glob.c (HAVE_CONFIG_H): Use !_LIBC instead.
[NDEBUG): Remove comments.
(GLOB_ONLY_P, _AMIGA, VMS): Remove define.
(dirent_type): New type. Use uint_fast8_t not
uint8_t, as C99 does not require uint8_t.
(DT_UNKNOWN, DT_DIR, DT_LNK): New macros.
(struct readdir_result): Use dirent_type. Do not define skip_entry
unless it is needed; this saves a byte on platforms lacking d_ino.
(readdir_result_type, readdir_result_skip_entry):
New functions, replacing ...
(readdir_result_might_be_symlink, readdir_result_might_be_dir):
these functions, which were removed. This makes the callers
easier to read. All callers changed.
(D_INO_TO_RESULT): Now empty if there is no d_ino.
(size_add_wrapv, glob_use_alloca): New static functions.
(glob, glob_in_dir): Check for size_t overflow in several places,
and fix some size_t checks that were not quite right.
Remove old code using SHELL since Bash no longer
uses this.
(glob, prefix_array): Separate MS code better.
(glob_in_dir): Remove old Amiga and VMS code.
(globfree, __glob_pattern_type, __glob_pattern_p): Move to
separate files.
(glob_in_dir): Do not rely on undefined behavior in accessing
struct members beyond their bounds. Use a flexible array member
instead
(link_stat): Rename from link_exists2_p and return -1/0 instead of
0/1. Caller changed.
(glob): Fix memory leaks.
* posix/glob64 (globfree64): Move to separate file.
* sysdeps/gnu/glob64.c (NO_GLOB_PATTERN_P): Remove define.
(globfree64): Remove hidden alias.
* sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Add
oldglob.
* sysdeps/unix/sysv/linux/alpha/glob.c (__new_globfree): Move to
separate file.
* sysdeps/unix/sysv/linux/i386/glob64.c (NO_GLOB_PATTERN_P): Remove
define.
Move compat code to separate file.
* sysdeps/wordsize-64/glob.c (globfree): Move definitions to
separate file.
This patch updates sysdeps/gnu/netinet/tcp.h to include new
definitions from include/uapi/linux/tcp.h in Linux 4.13.
Tested for x86_64.
* sysdeps/gnu/netinet/tcp.h (TCP_ULP): New macro.
(TCP_MD5SIG_EXT): Likewise.
(TCP_MD5SIG_FLAG_PREFIX): Likewise.
(struct tcp_md5sig): Replace __tcpm_pad1 by tcpm_flags and
tcpm_prefixlen. Rename __tcpm_pad2 to __tcpm_pad.
This patch adds the new SOL_TLS constant from Linux 4.13 to the Linux
bits/socket.h.
Tested for x86_64.
* sysdeps/unix/sysv/linux/bits/socket.h (SOL_TLS): New macro.
* hurd/get-host.c (_hurd_get_host_config): Also check that more == 0
before assuming that the file is empty. Avoid testing buffer content
when nread == 0.
[BZ #22070]
* localedata/unicode-gen/utf8_gen.py: Set the width for
characters with Prepended_Concatenation_Mark property to 1
* localedata/charmaps/UTF-8: Updated using the improved script.
Writing ranges of neighbouring characters with the same with like this
<U000E0100>...<U000E01EF> 0
in charmaps/UTF-8 is more efficient than writing many single character lines
like:
<U000E0100> 0
<U000E0101> 0
...
[BZ #21750]
* unicode-gen/utf8_gen.py: Write all ranges of neighbouring characters
with the same width using the range notation in charmaps/UTF-8.
The initial obsoletion of SVID libm error handling left the old
wrappers and __kernel_standard still being used for new ports and
static linking, just with macro definitions of _LIB_VERSION and
matherr that meant symbols with those names were never actually used
and the code for different error handling variants could be optimized
out.
This patch cleans things up further by eliminating the
__kernel_standard use for new ports and static linking. Now, the old
wrappers no longer generate any code in the !LIBM_SVID_COMPAT case,
while the new errno-only wrappers that were added for float128 support
are now also used for float, double and long double in that case.
The changes are generally straightforward. The w_scalb*_compat
wrappers continue to be used (scalb is obsolescent in the sense of not
being supported for float128, but is present in supported standards -
the 2001 edition of POSIX and earlier XSI versions - so remains
supported for static linking and new ports, as do the float and long
double variants that are existing GNU extensions). Those wrappers
would only call __kernel_standard in the _LIB_VERSION == _SVID_ case.
Since we would like to be able to compile most of glibc without
optimization, relying on a static function whose only use is under an
if (0) condition being optimized away to avoid an undefined
__kernel_standard reference may not be a good idea. Thus, the
relevant code in the scalb wrappers has LIBM_SVID_COMPAT conditionals
added to guarantee it's not built at all in the case where
__kernel_standard does not exist.
Just as i386 has its own w_sqrt_compat.c, so w_sqrt.c is also added.
ia64 gets dummy w_*.c to prevent those files being built where they
would conflict with the ia64 libm, as with its existing w_*_compat.c.
Conditions disabling code for !LIBM_SVID_COMPAT are needed in both the
math/ wrappers and in the long double wrappers in ldbl-opt (to avoid
them setting up aliases and symbol versions for undefined symbols). I
hope that future cleanups to how libm function aliases and symbol
versioning are done will eliminate the need for most of the ldbl-opt
wrappers.
Tested for x86_64 and x86, and with build-many-glibcs.py.
* sysdeps/generic/math-type-macros-double.h: Include
<math-svid-compat.h>.
(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
* sysdeps/generic/math-type-macros-float.h: Include
<math-svid-compat.h>.
(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
* sysdeps/generic/math-type-macros-ldouble.h: Include
<math-svid-compat.h>.
(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
* math/lgamma-compat.h (BUILD_LGAMMA): Include LIBM_SVID_COMPAT
condition.
* math/w_acos_compat.c: Condition contents on [LIBM_SVID_COMPAT].
* math/w_acosf_compat.c: Likewise.
* math/w_acosh_compat.c: Likewise.
* math/w_acoshf_compat.c: Likewise.
* math/w_acoshl_compat.c: Likewise.
* math/w_acosl_compat.c: Likewise.
* math/w_asin_compat.c: Likewise.
* math/w_asinf_compat.c: Likewise.
* math/w_asinl_compat.c: Likewise.
* math/w_atan2_compat.c: Likewise.
* math/w_atan2f_compat.c: Likewise.
* math/w_atan2l_compat.c: Likewise.
* math/w_atanh_compat.c: Likewise.
* math/w_atanhf_compat.c: Likewise.
* math/w_atanhl_compat.c: Likewise.
* math/w_cosh_compat.c: Likewise.
* math/w_coshf_compat.c: Likewise.
* math/w_coshl_compat.c: Likewise.
* math/w_exp10_compat.c: Likewise.
* math/w_exp10f_compat.c: Likewise.
* math/w_exp10l_compat.c: Likewise.
* math/w_exp2_compat.c: Likewise.
* math/w_exp2f_compat.c: Likewise.
* math/w_exp2l_compat.c: Likewise.
* math/w_fmod_compat.c: Likewise.
* math/w_fmodf_compat.c: Likewise.
* math/w_fmodl_compat.c: Likewise.
* math/w_hypot_compat.c: Likewise.
* math/w_hypotf_compat.c: Likewise.
* math/w_hypotl_compat.c: Likewise.
* math/w_j0_compat.c: Likewise.
* math/w_j0f_compat.c: Likewise.
* math/w_j0l_compat.c: Likewise.
* math/w_j1_compat.c: Likewise.
* math/w_j1f_compat.c: Likewise.
* math/w_j1l_compat.c: Likewise.
* math/w_jn_compat.c: Likewise.
* math/w_jnf_compat.c: Likewise.
* math/w_jnl_compat.c: Likewise.
* math/w_lgamma_r_compat.c: Likewise.
* math/w_lgammaf_r_compat.c: Likewise.
* math/w_lgammal_r_compat.c: Likewise.
* math/w_log10_compat.c: Likewise.
* math/w_log10f_compat.c: Likewise.
* math/w_log10l_compat.c: Likewise.
* math/w_log2_compat.c: Likewise.
* math/w_log2f_compat.c: Likewise.
* math/w_log2l_compat.c: Likewise.
* math/w_log_compat.c: Likewise.
* math/w_logf_compat.c: Likewise.
* math/w_logl_compat.c: Likewise.
* math/w_pow_compat.c: Likewise.
* math/w_powf_compat.c: Likewise.
* math/w_powl_compat.c: Likewise.
* math/w_remainder_compat.c: Likewise.
* math/w_remainderf_compat.c: Likewise.
* math/w_remainderl_compat.c: Likewise.
* math/w_sinh_compat.c: Likewise.
* math/w_sinhf_compat.c: Likewise.
* math/w_sinhl_compat.c: Likewise.
* math/w_sqrt_compat.c: Likewise.
* math/w_sqrtf_compat.c: Likewise.
* math/w_sqrtl_compat.c: Likewise.
* math/w_tgamma_compat.c: Likewise.
* math/w_tgammaf_compat.c: Likewise.
* math/w_tgammal_compat.c: Likewise.
* math/w_scalb_compat.c (sysv_scalb): Condition definition on
[LIBM_SVID_COMPAT].
(__scalb): Condition call to sysv_scalb on [LIBM_SVID_COMPAT].
* math/w_scalbf_compat.c (sysv_scalbf): Condition definition on
[LIBM_SVID_COMPAT].
(__scalbf): Condition call to sysv_scalbf on [LIBM_SVID_COMPAT].
* math/w_scalbl_compat.c (sysv_scalbl): Condition definition on
[LIBM_SVID_COMPAT].
(__scalbl): Condition call to sysv_scalbl on [LIBM_SVID_COMPAT].
* sysdeps/i386/fpu/w_sqrt.c: New file.
* sysdeps/ia64/fpu/w_acos.c: Likewise.
* sysdeps/ia64/fpu/w_acosf.c: Likewise.
* sysdeps/ia64/fpu/w_acosh.c: Likewise.
* sysdeps/ia64/fpu/w_acoshf.c: Likewise.
* sysdeps/ia64/fpu/w_acoshl.c: Likewise.
* sysdeps/ia64/fpu/w_acosl.c: Likewise.
* sysdeps/ia64/fpu/w_asin.c: Likewise.
* sysdeps/ia64/fpu/w_asinf.c: Likewise.
* sysdeps/ia64/fpu/w_asinl.c: Likewise.
* sysdeps/ia64/fpu/w_atan2.c: Likewise.
* sysdeps/ia64/fpu/w_atan2f.c: Likewise.
* sysdeps/ia64/fpu/w_atan2l.c: Likewise.
* sysdeps/ia64/fpu/w_atanh.c: Likewise.
* sysdeps/ia64/fpu/w_atanhf.c: Likewise.
* sysdeps/ia64/fpu/w_atanhl.c: Likewise.
* sysdeps/ia64/fpu/w_cosh.c: Likewise.
* sysdeps/ia64/fpu/w_coshf.c: Likewise.
* sysdeps/ia64/fpu/w_coshl.c: Likewise.
* sysdeps/ia64/fpu/w_exp.c: Likewise.
* sysdeps/ia64/fpu/w_exp10.c: Likewise.
* sysdeps/ia64/fpu/w_exp10f.c: Likewise.
* sysdeps/ia64/fpu/w_exp10l.c: Likewise.
* sysdeps/ia64/fpu/w_exp2.c: Likewise.
* sysdeps/ia64/fpu/w_exp2f.c: Likewise.
* sysdeps/ia64/fpu/w_exp2l.c: Likewise.
* sysdeps/ia64/fpu/w_expf.c: Likewise.
* sysdeps/ia64/fpu/w_expl.c: Likewise.
* sysdeps/ia64/fpu/w_fmod.c: Likewise.
* sysdeps/ia64/fpu/w_fmodf.c: Likewise.
* sysdeps/ia64/fpu/w_fmodl.c: Likewise.
* sysdeps/ia64/fpu/w_hypot.c: Likewise.
* sysdeps/ia64/fpu/w_hypotf.c: Likewise.
* sysdeps/ia64/fpu/w_hypotl.c: Likewise.
* sysdeps/ia64/fpu/w_lgamma_r.c: Likewise.
* sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise.
* sysdeps/ia64/fpu/w_lgammal_r.c: Likewise.
* sysdeps/ia64/fpu/w_log.c: Likewise.
* sysdeps/ia64/fpu/w_log10.c: Likewise.
* sysdeps/ia64/fpu/w_log10f.c: Likewise.
* sysdeps/ia64/fpu/w_log10l.c: Likewise.
* sysdeps/ia64/fpu/w_log2.c: Likewise.
* sysdeps/ia64/fpu/w_log2f.c: Likewise.
* sysdeps/ia64/fpu/w_log2l.c: Likewise.
* sysdeps/ia64/fpu/w_logf.c: Likewise.
* sysdeps/ia64/fpu/w_logl.c: Likewise.
* sysdeps/ia64/fpu/w_pow.c: Likewise.
* sysdeps/ia64/fpu/w_powf.c: Likewise.
* sysdeps/ia64/fpu/w_powl.c: Likewise.
* sysdeps/ia64/fpu/w_remainder.c: Likewise.
* sysdeps/ia64/fpu/w_remainderf.c: Likewise.
* sysdeps/ia64/fpu/w_remainderl.c: Likewise.
* sysdeps/ia64/fpu/w_sinh.c: Likewise.
* sysdeps/ia64/fpu/w_sinhf.c: Likewise.
* sysdeps/ia64/fpu/w_sinhl.c: Likewise.
* sysdeps/ia64/fpu/w_sqrt.c: Likewise.
* sysdeps/ia64/fpu/w_sqrtf.c: Likewise.
* sysdeps/ia64/fpu/w_sqrtl.c: Likewise.
* sysdeps/ia64/fpu/w_tgamma.c: Likewise.
* sysdeps/ia64/fpu/w_tgammaf.c: Likewise.
* sysdeps/ia64/fpu/w_tgammal.c: Likewise.
* sysdeps/ieee754/dbl-64/w_exp_compat.c: Condition contents on
[LIBM_SVID_COMPAT].
* sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise.
* sysdeps/ieee754/k_standard.c: Likewise.
* sysdeps/ieee754/k_standardf.c: Likewise.
* sysdeps/ieee754/k_standardl.c: Likewise.
* sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-64-128/w_expl_compat.c: Condition
long_double_symbol call on [LIBM_SVID_COMPAT].
* sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c: Condition
long_double_symbol and compat_symbol calls on [LIBM_SVID_COMPAT].
* include/shlib-compat.h (TEST_COMPAT): New Macro.
* malloc/tst-mallocstate.c: Convert from test-skeleton
to test-driver. Ifdef code using TEST_COMPAT macro.
* math/test-matherr-2.c: Ifdef test using TEST_COMPAT macro.
* math/test-matherr.c: Likewise.
debug/pcprofiledump.c contains code that tries to handle other-endian
data. This uses a condition "(word & 0xfffffff0) == bswap_32
(0xdeb00000)". This condition is always false (the LHS always has the
low four bits zero, the RHS doesn't); a correct comparison would use
0x0fffffff. This results in -Werror=tautological-compare build
failures with the tile version of bits/byteswap.h and mainline GCC.
https://sourceware.org/ml/libc-testresults/2017-q3/msg00400.html
pcprofiledump.c: In function 'main':
pcprofiledump.c:118:39: error: bitwise comparison always evaluates to false
[-Werror=tautological-compare]
int must_swap = (word & 0xfffffff0) == bswap_32 (0xdeb00000);
^~
This patch fixes the condition. Tested for x86_64, and with
build-many-glibcs.py that it fixes the build for tilegx-linux-gnu.
(Note that I have not tested the actual pcprofiledump functionality,
native or cross endian, which lacks any testsuite coverage.)
[BZ #22086]
* debug/pcprofiledump.c (main): Use byte-swapped mask when
comparing word with byte-swapped constant.
As far as I can tell Linux 4.13 does not add any new syscalls not
included in syscall-names.list. This patch updates the version number
in that file accordingly.
* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
version to 4.13.
bits/math-finite.h handles exp10 if __USE_GNU. It should use the
condition __GLIBC_USE (IEC_60559_FUNCS_EXT), as in bits/mathcalls.h.
This patch fixes the condition.
Tested for x86_64.
[BZ #22082]
* math/bits/math-finite.h (exp10): Redirect if [__GLIBC_USE
(IEC_60559_FUNCS_EXT)], not [__USE_GNU].
This is a common programming error, and the cause of the problem is not
always obvious.
<tgmath.h> defines a log macro, but it includes <math.h> before that, so
that is compatible with the warning.
* misc/tst-preadvwritev2-common.c (RWF_HIPRI, RWF_DSYNC, RWF_SYNC,
RWF_NOWAIT): Define to 0 if undefined already.
(do_test_with_invalid_flags): Set invalid_flag to 2 if RWF_SUPPORTED
boils down to 0.
* misc/preadv2.c: Include <errno.h>.
* misc/preadv64v2.c: Include <errno.h>.
* misc/pwritev2.c: Include <errno.h>.
* misc/pwritev64v2.c: Include <errno.h>.
* sysdeps/posix/preadv2.c: Include <errno.h>.
* sysdeps/posix/preadv64v2.c: Include <errno.h>.
Fix <unistd.h> inclusion.
* sysdeps/posix/pwritev2.c: Include <errno.h>.
* sysdeps/posix/pwritev64v2.c: Include <errno.h>.
* sysdeps/posix/preadv2.c: Use off_t instead of OFF_T.
* sysdeps/posix/preadv64v2.c: Use off_t instead of OFF_T.
* sysdeps/posix/pwritev2.c: Use off_t instead of OFF_T.
* sysdeps/posix/pwritev64v2.c: Use off_t instead of OFF_T.
This patch obsoletes the pow10, pow10f and pow10l functions (makes
them into compat symbols, not available for new ports or static
linking). The exp10 names for these functions are standardized (in TS
18661-4) and were added in the same glibc version (2.1) as pow10 so
source code can change to use them without any loss of portability.
Since pow10 is deliberately not provided for _Float128, only exp10,
this slightly simplifies moving to the new wrapper templates in the
!LIBM_SVID_COMPAT case, by avoiding needing to arrange for pow10,
pow10f and pow10l to be defined by those templates.
Tested for x86_64, and with build-many-glibcs.py.
* manual/math.texi (pow10): Do not document.
(pow10f): Likewise.
(pow10l): Likewise.
* math/bits/mathcalls.h [__USE_GNU] (pow10): Do not declare.
* math/bits/math-finite.h [__USE_GNU] (pow10): Likewise.
* math/libm-test-exp10.inc (pow10_test): Remove.
(do_test): Do not call pow10.
* math/w_exp10_compat.c (pow10): Make into compat symbol.
[NO_LONG_DOUBLE] (pow10l): Likewise.
* math/w_exp10f_compat.c (pow10f): Likewise.
* math/w_exp10l_compat.c (pow10l): Likewise.
* sysdeps/ia64/fpu/e_exp10.S: Include <shlib-compat.h>.
(pow10): Make into compat symbol.
* sysdeps/ia64/fpu/e_exp10f.S: Include <shlib-compat.h>.
(pow10f): Make into compat symbol.
* sysdeps/ia64/fpu/e_exp10l.S: Include <shlib-compat.h>.
(pow10l): Make into compat symbol.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove
pow10.
(CFLAGS-nldbl-pow10.c): Remove variable..
* sysdeps/ieee754/ldbl-opt/nldbl-pow10.c: Remove file.
* sysdeps/ieee754/ldbl-opt/w_exp10_compat.c (pow10l): Condition on
[SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)].
* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c (compat_symbol):
Undefine and redefine.
(pow10l): Make into compat symbol.
* sysdeps/aarch64/libm-test-ulps: Remove pow10 ulps.
* sysdeps/alpha/fpu/libm-test-ulps: Likewise.
* sysdeps/arm/libm-test-ulps: Likewise.
* sysdeps/hppa/fpu/libm-test-ulps: Likewise.
* sysdeps/i386/fpu/libm-test-ulps: Likewise.
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
* sysdeps/microblaze/libm-test-ulps: Likewise.
* sysdeps/mips/mips32/libm-test-ulps: Likewise.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.
* sysdeps/nios2/libm-test-ulps: Likewise.
* sysdeps/powerpc/fpu/libm-test-ulps: Likewise.
* sysdeps/powerpc/nofpu/libm-test-ulps: Likewise.
* sysdeps/s390/fpu/libm-test-ulps: Likewise.
* sysdeps/sh/libm-test-ulps: Likewise.
* sysdeps/sparc/fpu/libm-test-ulps: Likewise.
* sysdeps/tile/libm-test-ulps: Likewise.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
This patch adds O_TMPFILE support to tmpfile on Linux. This is
similar to the previous suggestion by Andreas Schwab [1] with the
difference the file descriptor creation is parameterized to
compartmentalize Linux only open flags (O_TMPFILE) on sysdeps.
Checked on x86_64-linux-gnu.
Adhemerval Zanella <adhemerval.zanella@linaro.org>
Andreas Schwab <schwab@suse.de>
[BZ #21530]
* include/stdio.h (__gen_tempfd): New function.
* stdio-common/Makefile (routines): Add gentempfd.
* stdio-common/gentempfd.c: New file.
* sysdeps/unix/sysv/linux/gentempfd.c: Likewise.
* stdio-common/tmpfile.c (tmpfile): First try to use a system specific
unnamed file first.
[1] https://sourceware.org/ml/libc-alpha/2017-06/msg01293.html
The old code uses errno as the primary indicator for success or
failure. This is wrong because errno is only set for specific
combinations of the status return value and the h_errno variable.
This simplifies the code because it is not necessary to propagate the
temporary h_errno value to the thread-local variable. It also increases
compatibility with NSS modules which update only one of the two places.
* sysdeps/aarch64/fpu/s_llrint.c (OREG_SIZE): New macro.
* sysdeps/aarch64/fpu/s_llround.c (OREG_SIZE): Likewise.
* sysdeps/aarch64/fpu/s_llrintf.c (OREGS, IREGS): Remove.
(IREG_SIZE, OREG_SIZE): New macros.
* sysdeps/aarch64/fpu/s_llroundf.c: (OREGS, IREGS): Remove.
(IREG_SIZE, OREG_SIZE): New macros.
* sysdeps/aarch64/fpu/s_lrintf.c (IREGS): Remove.
(IREG_SIZE): New macro.
* sysdeps/aarch64/fpu/s_lroundf.c (IREGS): Remove.
(IREG_SIZE): New macro.
* sysdeps/aarch64/fpu/s_lrint.c (get-rounding-mode.h, stdint.h):
New includes.
(IREG_SIZE, OREG_SIZE): Initialize if not already set.
(OREGS, IREGS): Set based on IREG_SIZE and OREG_SIZE.
(__CONCATX): Handle exceptions correctly on large values that may
set FE_INVALID.
* sysdeps/aarch64/fpu/s_lround.c (IREG_SIZE, OREG_SIZE):
Initialize if not already set.
(OREGS, IREGS): Set based on IREG_SIZE and OREG_SIZE.
The NO_CANCELLATION macro is used currently on generic headers to
define non cancellable syscalls and on Linux fcntl to implement the non
cancellable variation. Former should be single-handled by not-cancel.h
header and former could be simplified build both cancellable and non
cancellable for default objects and alias the non-cancellable to default
one for rtld ones (since Linux already support cancellation as default).
This patch thus removes the NO_CANCELLATION macro and its usage. The
generic non cancellable fcntl is route to internal fcntl.
Checked on x86_64-linux-gnu and i686-linux-gnu. Also checked with
a build again major ABIs.
* sysdeps/generic/not-cancel.h (NO_CANCELLATION): Remove macro.
* sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h
(NO_CANCELLATION): Likewise.
* sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
(NO_CANCELLATION): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
(NO_CANCELLATION): Likewise.
* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (NO_CANCELLATION):
Likewise
* sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): Add
hidden prototype.
* sysdeps/unix/sysv/linux/fcntl.c (__fcntl_nocancel): Define only
for !IS_IN (rtld) and remove NO_CANCELLATION usage.
Similar to my patches for HUGE_VAL and INFINITY. this patch eliminates
the bits/nan.h headers. __builtin_nanf ("") is used to define NAN for
GCC 3.3 and later; the fallback is (0.0f / 0.0f), which is a constant
expression for a quiet NaN of type float, but raises a spurious
"invalid" exception outside static initializers, which seems the best
that can be done purely in standard C. Again, if anyone actually uses
a compiler with its own incompatible extension for producing a
constant quiet NaN, we can add compiler conditionals.
Tested for x86_64.
* math/math.h [__USE_ISOC99] (NAN): Define directly here. Do not
include <bits/nan.h>.
* math/Makefile (headers): Remove bits/nan.h.
* bits/nan.h: Remove.
* sysdeps/ieee754/bits/nan.h: Likewise.
* sysdeps/mips/bits/nan.h: Likewise.
Similar to my patch for HUGE_VAL, this patch eliminates the bits/inf.h
headers and just unconditionally uses the same definitions as the
sysdeps/ieee754 version did (__builtin_inff () for GCC >= 3.3,
otherwise HUGE_VALF), directly in math.h, so removing an unnecessary
level of indirection.
Tested for x86_64.
* math/math.h [__USE_ISOC99] (INFINITY): Define directly here. Do
not include <bits/inf.h>.
* math/Makefile (headers): Remove bits/inf.h.
* bits/inf.h: Remove.
* sysdeps/ieee754/bits/inf.h: Likewise.
There are various bits/huge_val*.h headers to define HUGE_VAL and
related macros. All of them use __builtin_huge_val etc. for GCC 3.3
and later. Then there are various fallbacks, such as using a large
hex float constant for GCC 2.96 and later, or using unions (with or
without compound literals) to construct the bytes of an infinity, with
this last being the reason for having architecture-specific files.
Supporting TS 18661-3 _FloatN / _FloatNx types that have the same
format as other supported types will mean adding more such macros;
needing to add more headers for them doesn't seem very desirable.
The fallbacks based on bytes of the representation of an infinity do
not meet the standard requirements for a constant expression. At
least one of them is also wrong: sysdeps/sh/bits/huge_val.h is
producing a mixed-endian representation which does not match what GCC
does.
This patch eliminates all those headers, defining the macros directly
in math.h. For GCC 3.3 and later, the built-in functions are used as
now. For other compilers, a large constant 1e10000 (with appropriate
suffix) is used. This is like the fallback for GCC 2.96 and later,
but without using hex floats (which have no apparent advantage here).
It is unambiguously valid standard C for all floating-point formats
with infinities, which covers all formats supported by glibc or likely
to be supported by glibc in future (C90 DR#025 said that if a
floating-point format represents infinities, all real values lie
within the range of representable values, so the constraints for
constant expressions are not violated), but may generate compiler
warnings and wouldn't handle the TS 18661-1 FENV_ROUND pragma
correctly. If someone is actually using a compiler with glibc that
does not claim to be GCC 3.3 or later, but which has a better way to
define the HUGE_VAL macros, we can always add compiler conditionals in
with alternative definitions.
I intend to make similar changes for INF and NAN. The SNAN macros
already just use __builtin_nans etc. with no fallback for compilers
not claiming to be GCC 3.3 or later.
Tested for x86_64.
* math/math.h: Do not include bits/huge_val.h, bits/huge_valf.h,
bits/huge_vall.h or bits/huge_val_flt128.h.
(HUGE_VAL): Define directly here.
[__USE_ISOC99] (HUGE_VALF): Likewise.
[__USE_ISOC99] (HUGE_VALL): Likewise.
[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(HUGE_VAL_F128): Likewise.
* math/Makefile (headers): Remove bits/huge_val.h,
bits/huge_valf.h, bits/huge_vall.h and bits/huge_val_flt128.h.
* bits/huge_val.h: Remove.
* bits/huge_val_flt128.h: Likewise.
* bits/huge_valf.h: Likewise.
* bits/huge_vall.h: Likewise.
* sysdeps/ia64/bits/huge_vall.h: Likewise.
* sysdeps/ieee754/bits/huge_val.h: Likewise.
* sysdeps/ieee754/bits/huge_valf.h: Likewise.
* sysdeps/m68k/m680x0/bits/huge_vall.h: Likewise.
* sysdeps/sh/bits/huge_val.h: Likewise.
* sysdeps/sparc/bits/huge_vall.h: Likewise.
* sysdeps/x86/bits/huge_vall.h: Likewise.
Since sofini.os terminates .eh_frame section, it should be placed last.
[BZ #22051]
* Makerules (build-module-helper-objlist): Filter out
$(elf-objpfx)sofini.os.
(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
needed.
This patch completes the ucontext.h namespace fixes by fixing issues
related to the use of struct sigcontext as mcontext_t, and inclusion
of <bits/sigcontext.h> even when struct sigcontext is not so used.
Inclusion of <bits/sigcontext.h> by <sys/ucontext.h> is removed; the
way to get the sigcontext structure is by including <signal.h> (in a
context where __USE_MISC is defined); the sysdeps/generic version of
sys/ucontext.h keeps the inclusion by necessity, with a comment about
how this is not namespace-clean, but the only configuration that used
it, MicroBlaze, gets its own version of the header in this patch.
Where mcontext_t was typedefed to struct sigcontext, the contents of
struct sigcontext are inserted (with appropriate namespace handling to
prefix fields with __ when __USE_MISC is not defined); review should
check that this has been done correctly in each case, whether the
definition of struct sigcontext comes from glibc headers or from the
Linux kernel. This changes C++ name mangling on affected
architectures (which do not include x86_64/x86).
Tested for x86_64, and with build-many-glibcs.py.
2017-08-14 Joseph Myers <joseph@codesourcery.com>
[BZ #21457]
* sysdeps/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>.
* sysdeps/generic/sys/ucontext.h: Add comment about use of struct
sigcontext and namespace requirements.
* sysdeps/i386/sys/ucontext.h: Do not include <bits/sigcontext.h>.
* sysdeps/m68k/sys/ucontext.h: Likewise.
* sysdeps/mips/sys/ucontext.h: Likewise. Include <bits/types.h>.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oEXTENSION): Use
__glibc_reserved1 instead of __reserved.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym: Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/ia64/makecontext.c (__makecontext): Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym: Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): New macro.
(struct __ia64_fpreg_mcontext): New type.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
(_SC_GR0_OFFSET): Use mcontext_t instead of struct sigcontext.
(uc_sigmask): Define using __ctx.
(uc_stack): Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include
<bits/sigcontext.h>. Include <bits/types.h>.
* conform/Makefile (test-xfail-XPG42/signal.h/conform): Remove.
(test-xfail-XPG42/sys/wait.h/conform): Likewise.
(test-xfail-XPG42/ucontext.h/conform): Likewise.
(test-xfail-UNIX98/signal.h/conform): Likewise.
(test-xfail-UNIX98/sys/wait.h/conform): Likewise.
(test-xfail-UNIX98/ucontext.h/conform): Likewise.
(test-xfail-XOPEN2K/signal.h/conform): Likewise.
(test-xfail-XOPEN2K/sys/wait.h/conform): Likewise.
(test-xfail-XOPEN2K/ucontext.h/conform): Likewise.
(test-xfail-POSIX2008/signal.h/conform): Likewise.
(test-xfail-POSIX2008/sys/wait.h/conform): Likewise.
(test-xfail-XOPEN2K8/signal.h/conform): Likewise.
(test-xfail-XOPEN2K8/sys/wait.h/conform): Likewise.
Clean up calls to malloc_printerr and trim its argument list.
This also removes a few bits of work done before calling
malloc_printerr (such as unlocking operations).
The tunable/environment variable still enables the lightweight
additional malloc checking, but mallopt (M_CHECK_ACTION)
no longer has any effect.
On very large multi-processor systems, creating hundreds of threads
runs into a test time out. The tests do not seem to benefit from
massive over-scheduling.
As shown by build bot failures
<https://sourceware.org/ml/libc-testresults/2017-q3/msg00349.html> the
m68k bits/mathinline.h is not namespace-clean: it fails to compile if
the user has defined macros f or l before it is included, because of
expansions of those arguments to __inline_functions. This patch
changes the __inline_functions definitions to take not the suffix but
a macro that concatenates it with the function name, to avoid the
spurious macro expansions.
Tested for m68k with build-many-glibcs.py.
[BZ #22035]
* sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__inline_functions):
Define to take a second argument that is a macro that
concatentates a suffix, not the suffix itself.
(__CONCAT_d): New macro.
(__CONCAT_f): Likewise.
(__CONCAT_l): Likewise.
Fix a commit cc25c8b4c1 ("New pthread rwlock that is more scalable.")
regression and prevent uncontrolled stack space usage from happening
when a 5-, 6- or 7-argument syscall wrapper is placed in a loop.
The cause of the problem is the use of `alloca' in regular MIPS/Linux
wrappers to force the use of the frame pointer register in any function
using one or more of these wrappers. Using the frame pointer register
is required so as not to break frame unwinding as the the stack pointer
is lowered within the inline asm used by these wrappers to make room for
the stack arguments, which 5-, 6- and 7-argument syscalls use with the
o32 ABI.
The regular MIPS/Linux wrappers are macros however, expanded inline, and
stack allocations made with `alloca' are not discarded until the return
of the function they are made in. Consequently if called in a loop,
then virtual memory is wasted, and if the loop goes through enough
iterations, then ultimately available memory can get exhausted causing
the program to crash.
Address the issue by replacing the inline code with standalone assembly
functions, which rely on the compiler arranging syscall arguments
according to the o32 function calling convention, which MIPS/Linux
syscalls also use, except for the syscall number passed and the error
flag returned. This way there is no need to fiddle with the stack
pointer anymore and all that has to be handled in the new standalone
functions is the special handling of the syscall number and the error
flag.
Redirect 5-, 6- or 7-argument MIPS16/Linux syscall wrappers to these new
functions as well, so as to avoid an unnecessary double call the
existing wrappers would cause with the new arrangement.
[BZ #21956]
* sysdeps/unix/sysv/linux/mips/mips32/mips16/Makefile
[subdir = misc] (sysdep_routines): Remove `mips16-syscall5',
`mips16-syscall6' and `mips16-syscall7'.
(CFLAGS-mips16-syscall5.c, CFLAGS-mips16-syscall6.c)
(CFLAGS-mips16-syscall7.c): Remove.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/Versions (libc):
Remove `__mips16_syscall5', `__mips16_syscall6' and
`__mips16_syscall7'.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall0.c
(__mips16_syscall0): Rename `__mips16_syscall_return' to
`__mips_syscall_return'.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall1.c
(__mips16_syscall1): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall2.c
(__mips16_syscall2): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall3.c
(__mips16_syscall3): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall4.c
(__mips16_syscall4): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall5.c:
Remove.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall6.c:
Remove.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall7.c:
Remove.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall.h
(__mips16_syscall5): Expand to `__mips_syscall5' rather than
`__mips16_syscall5'. Remove prototype.
(__mips16_syscall6): Expand to `__mips_syscall6' rather than
`__mips16_syscall6'. Remove prototype.
(__mips16_syscall7): Expand to `__mips_syscall7' rather than
`__mips16_syscall7'. Remove prototype.
(__nomips16, __mips16_syscall_return): Move to...
* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
(__nomips16, __mips_syscall_return): ... here.
[__mips16] (INTERNAL_SYSCALL_NCS): Rename
`__mips16_syscall_return' to `__mips_syscall_return'.
[__mips16] (INTERNAL_SYSCALL_MIPS16): Pass `number' to
`internal_syscall##nr'.
[!__mips16] (INTERNAL_SYSCALL): Pass `SYS_ify (name)' to
`internal_syscall##nr'.
(FORCE_FRAME_POINTER): Remove.
(__mips_syscall5): New prototype.
(internal_syscall5): Rewrite to call `__mips_syscall5'.
(__mips_syscall6): New prototype.
(internal_syscall6): Rewrite to call `__mips_syscall6'.
(__mips_syscall7): New prototype.
(internal_syscall7): Rewrite to call `__mips_syscall7'.
* sysdeps/unix/sysv/linux/mips/mips32/mips-syscall5.S: New file.
* sysdeps/unix/sysv/linux/mips/mips32/mips-syscall6.S: New file.
* sysdeps/unix/sysv/linux/mips/mips32/mips-syscall7.S: New file.
* sysdeps/unix/sysv/linux/mips/mips32/Makefile [subdir = misc]
(sysdep_routines): Add libc-do-syscall.
* sysdeps/unix/sysv/linux/mips/mips32/Versions (libc): Add
`__mips_syscall5', `__mips_syscall6' and `__mips_syscall7'.
This patch fixes ia64 failures on thread exit by madvise the required
area taking in consideration its disjoing stacks
(NEED_SEPARATE_REGISTER_STACK). Also the snippet that setup the
madvise call to advertise kernel the area won't be used anymore in
near future is reallocated in allocatestack.c (for consistency to
put all stack management function in one place).
Checked on x86_64-linux-gnu and i686-linux-gnu for sanity (since
it is not expected code changes for architecture that do not
define NEED_SEPARATE_REGISTER_STACK) and also got a report that
it fixes ia64-linux-gnu failures from Sergei Trofimovich
<slyfox@gentoo.org>.
[BZ #21672]
* nptl/allocatestack.c [_STACK_GROWS_DOWN] (setup_stack_prot):
Set to use !NEED_SEPARATE_REGISTER_STACK as well.
(advise_stack_range): New function.
* nptl/pthread_create.c (START_THREAD_DEFN): Move logic to mark
stack non required to advise_stack_range at allocatestack.c
Commit 39e7a5a668 added stdint.h
to sys/procfs.h, but it is included into signal.h by default and
there is code that does not expect stdint.h to be visible there,
so use __uint64_t instead of uint64_t.
The current bits/math-finite.h approach to defining functions for
different types, involving math.h defining _MSUF_ and _MSUFTO_ for the
function suffixes involved, is not namespace-clean if one of those
suffixes (f, l, f128) is defined as a macro by the user before math.h
is included; too many levels of macro expansion occur. Instead, those
suffixes should appear directly in the expansion of the macro using ##
so they don't get expanded even if defined as macros by the user (that
is, math.h should be defining __REDIRFROM_X and __REDIRTO_X directly
to use those suffixes rather than suffixes being passed as an argument
by macro callers). This patch makes that change.
Tested for x86_64.
[BZ #22028]
* math/math.h [__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0]
(_MSUF_): Remove macro.
[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0] (_MSUFTO_):
Likewise.
[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0]
(__REDIRFROM_X): New macro.
[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0] (__REDIRTO_X):
Likewise.
* math/bits/math-finite.h (__REDIRFROM_X): Remove macro.
(__REDIRTO_X): Likewise.
(__MATH_REDIRCALL): Do not pass _MSUF_ or _MSUFTO_ macro
arguments.
(__MATH_REDIRCALL_2): Likewise.
(__MATH_REDIRCALL_INTERNAL): Likewise.
(__REDIRFROM (lgamma, , _MSUF_)): Likewise.
(__REDIRFROM (gamma, , _MSUF_)): Likweise.
(__REDIRFROM (__gamma, _r_finite, _MSUF_)): Likewise.
(__REDIRFROM (tgamma, , _MSUF_)): Likewise.
* math/test-finite-macros.c: New file.
* math/Makefile (tests): Add test-finite-macros.
(CFLAGS-test-finite-macros.c): New variable.
Add locale for “Morisyen” which is also called “Mauritian Creole”
and is spoken in Mauritius.
[BZ #21971]
* localedata/SUPPORTED: Add mfe_MU/UTF-8.
* localedata/locales/mfe_MU: New File.
[BZ #21971]
* locale/iso-639.def: add Morisyen.
When signaling nans are enabled (with -fsignaling-nans), the C++ version
of iszero uses the fpclassify macro, which is defined with __MATH_TG.
However, when support for float128 is available, __MATH_TG uses the
builtin __builtin_types_compatible_p, which is only available in C mode.
This patch refactors the C++ version of iszero so that it uses function
overloading to select between the floating-point types, instead of
relying on fpclassify and __MATH_TG.
Tested for powerpc64le, s390x, x86_64, and with build-many-glibcs.py.
[BZ #21930]
* math/math.h [defined __cplusplus && defined __SUPPORT_SNAN__]
(iszero): New C++ implementation that does not use
fpclassify/__MATH_TG/__builtin_types_compatible_p, when
signaling nans are enabled, since __builtin_types_compatible_p
is a C-only feature.
* math/test-math-iszero.cc: When __HAVE_DISTINCT_FLOAT128 is
defined, include ieee754_float128.h for access to the union and
member ieee854_float128.ieee.
[__HAVE_DISTINCT_FLOAT128] (do_test): Call check_float128.
[__HAVE_DISTINCT_FLOAT128] (check_float128): New function.
* sysdeps/powerpc/powerpc64le/Makefile [subdir == math]
(CXXFLAGS-test-math-iszero.cc): Add -mfloat128 to the build
options of test-math-zero on powerpc64le.
Now there are no more assembly wrappers using _LIB_VERSION or
__kernel_standard, the math-svid-compat code can be slighly
simplified. math-svid-compat.h no longer needs __ASSEMBLER__
conditionals, and the _LIB_VERSION variable no longer needs to be
built for static libm, since all references are now in C code that
includes math-svid-compat.h and so gets the macro definition of
_LIB_VERSION to _POSIX_ outside the compat case. This patch makes
those cleanups.
Tested for x86_64, and with build-many-glibcs.py.
* math/math-svid-compat.h [!__ASSEMBLER__]: Make code
unconditional.
* sysdeps/ieee754/s_lib_version.c [!defined SHARED]: Remove
conditional code; define contents only for [LIBM_SVID_COMPAT].
This commit changes the way the list of SYS_* system call macros is
created on Linux. glibc now contains a list of all known system
calls, and the generated <bits/syscall.h> file defines the SYS_ macro
only if the correspnding __NR_ macro is defined by the kernel headers.
As a result, glibc does not have to be rebuilt to pick up system calls
if the glibc sources already know about them. This means that glibc
can be built with older kernel headers, and if the installed kernel
headers are upgraded afterwards, additional SYS_ macros become
available as long as glibc has a record for those system calls.
When linked statically, TLS initialization is not achieved before
mach_init and alike, so ssp accesses to tcbhead's stack_guard would
crash. We can just avoid using ssp in the few functions needed before
TLS is set up.
* mach/Makefile (CFLAGS-mach_init.o, CFLAGS-RPC_vm_statistics.o,
CFLAGS-RPC_vm_map.o, CFLAGS-RPC_vm_protect.o,
CFLAGS-RPC_i386_set_gdt.o, CFLAGS-RPC_i386_set_ldt.o,
CFLAGS-RPC_task_get_special_port.o): Add $(no-stack-protector).
* hurd/Makefile (CFLAGS-hurdstartup.o,
CFLAGS-RPC_exec_startup_get_info.o): Add $(no-stack-protector).
libmachuser and libhurduser also need stack_chk_fail_local and they do not
link against libc_nonshared.
* mach/stack_chk_fail_local.c: New file.
* hurd/stack_chk_fail_local.c: New file.
* mach/Machrules ($(interface-library)-routines): Add
stack_chk_fail_local.
* mach/Versions (GLIBC_2.4): Add __stack_chk_fail.
* hurd/Versions (GLIBC_2.4): Add __stack_chk_fail.
Since assembly versions of HAS_CPU_FEATURE and HAS_ARCH_FEATURE have
been removed, assembly versions of index_cpu_* and index_arch_* can
also be removed.
Tested on i686 and x86-64 with and without --disable-multi-arch.
* sysdeps/x86/cpu-features.h [__ASSEMBLER__]
(index_cpu_*, index_arch_*): Removed.
When _Float128 is ABI-equivalent to long double, there is no need for
tgmath.h to have any special _Float128 handling: it's always OK to
call the long double versions of functions for _Float128 arguments in
that case, and the logic to determine return types is generic. Thus,
this patch changes the use of __HAVE_FLOAT128 to
__HAVE_DISTINCT_FLOAT128, as a minor optimization to reduce the size
of the macro expansions in the ABI-equivalent case.
Tested for x86_64.
* math/tgmath.h [__HAVE_FLOAT128]: Change conditional to
[__HAVE_DISTINCT_FLOAT128].
This patch cleans up how bits/math-finite.h handles types that are
ABI-aliases of other types.
For such types, no __*_finite functions exist; instead,
bits/math-finite.h must redirect calls to a the functions for a
canonical choice of type for each floating-point format. (For the
actual public interfaces, symbols need exporting for each type, even
those that are ABI-aliases, because of standard requirements that
programs can declare the functions themselves without including
<math.h>, but that does not apply to __*_finite.)
At present, there is a special-case conditional in bits/math-finite.h
on __MATH_DECLARING_LDOUBLE && defined __NO_LONG_DOUBLE_MATH to handle
redirecting long double function calls to double __*_finite. This
patch replaces this by a more general mechanism. math.h, before each
inclusion of bits/math-finite.h, defines _MSUFTO_ as the suffix to use
on the target of redirection, in addition to the existing _MSUF_.
This way, __MATH_DECLARING_LDOUBLE can go away, as can the special
conditional in bits/math-finite.h. With this patch, math.h is now
prepared for the case of supporting float128 functions as aliases of
long double ones on platforms where long double is binary128, with
_MSUFTO_ appropriately defined for that case, and appropriate _MSUFTO_
definitions can easily be included when supporting _Float32 / _Float64
/ _Float32x / _Float64x (which will always be ABI-aliases of another
type when supported).
Tested for x86_64, and did a compilation test for ARM with
build-many-glibcs.py to cover the long double = double case.
* math/math.h (_MSUFTO_): Define and undefine for each inclusion
of <bits/math-finite.h>.
(__MATH_DECLARING_LDOUBLE): Do not define and undefine for each
inclusion of <bits/math-finite.h>.
* math/bits/math-finite.h (__REDIRTO_X): Do not define
conditionally on [__MATH_DECLARING_LDOUBLE && defined
__NO_LONG_DOUBLE_MATH].
(__MATH_REDIRCALL): Use _MSUFTO_ in __REDIRTO call.
(__MATH_REDIRCALL_2): Likewise.
(__MATH_REDIRCALL_INTERNAL): Likewise.
(__REDIRFROM (lgamma, , _MSUF_)): Likewise.
(__REDIRFROM (gamma, , _MSUF_)): Likewise.
(__REDIRFROM (tgamma, , _MSUF_)): Likewise.
This patch removes the powerpc32-specific wrappers for sqrt and sqrtf.
These wrappers, by adding architecture-specific uses of _LIB_VERSION
and __kernel_standard, unnecessarily complicate cleanups of libm error
handling. They also do not serve a useful optimization purpose. GCC
knows about sqrt as a built-in function, and can generate direct calls
to a hardware square root instruction, either on its own, in the
-fno-math-errno case, or together with an inline check for the
argument being negative and a call to the out-of-line sqrt function
for error handling only in that case (and has been able to do so for a
long time). Thus in practice the wrapper will only be called only in
the case of negative arguments, which is not a case it is useful to
optimize for.
Tested with build-many-glibcs.py for powerpc-linux-gnu-power4.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrt_compat-power5.S:
Remove file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrt_compat-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrt_compat.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrtf_compat-power5.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrtf_compat-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrtf_compat.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S: Likewise.
* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S: Likewise.
* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(libm-sysdep-routines): Remove w_sqrt_compat-power5,
w_sqrt_compat-ppc32, w_sqrtf_compat-power5 and
w_sqrtf_compat-ppc32.
When __NO_LONG_DOUBLE_MATH is defined, __issignalingl is not available,
thus issignaling with long double argument should call __issignaling,
instead.
Tested for powerpc64le.
* math/math.h [defined __cplusplus] (issignaling): In the long
double case, call __issignalingl only if __NO_LONG_DOUBLE_MATH
is not defined. Call __issignaling, otherwise.
Use += instead of = to avoid overriding target specific CFLAGS settings.
Ideally the settings in target Makefiles would have precedence, but the
Makefile inclusion order does not allow that, with this fix at least the
target settings are not dropped.
Update libm-test-ulps for AVX512 mathvec tests by running
“make regen-ulps” on Intel Xeon processor with AVX512.
* sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
Fix GCC 7 errors when string/stratcliff.c is compiled with -O3:
stratcliff.c: In function ‘do_test’:
cc1: error: assuming signed overflow does not occur when assuming that (X - c) <= X is always true [-Werror=strict-overflow]
[BZ #21982]
* string/stratcliff.c (do_test): Declare size, nchars, inner,
middle and outer with size_t instead of int. Repleace %d and
%Zd with %zu in printf. Update "MAX (0, nchars - 128)" and
"MAX (outer, nchars - 64)" to support unsigned outer and
nchars. Also exit loop when outer == 0.
This patch consolidate the remaning non cancellable syscall definitions
on not-cancel.h header. They are:
* __fcntl_nocancel: Moved from fcntl.h to not-cancel.h.
* __sigsuspend_nocancel: Removed since 988f991b50 it is not used or
defined anymore.
* __nanosleep_nocancel: Removed since 6f33fd046b it is defined on
not-cancel.h.
Now all non-cancellable syscall definition are defined on not-cancel
(the only exceptions is the stdio symbol __fxprintf_nocancel which
uses non cancellable open and it is used on getopt implementation).
Checked on x86_64-linux-gnu and with build-many-glibc.py.
* include/fcntl.h (__fcntl_nocancel): Remove definition.
* include/signal.h (__sigsuspend_nocancel): Likewise.
* include/time.h (__nanosleep_nocancel): Likewise.
* sysdeps/generic/not-cancel.h (__fcntl_nocancel): New macro.
* login/utmp_file.c: Include non cancellable syscall header.
* sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): New
prototype.
Since binutils 2.25 or later is required to build glibc, we can replace
AVX512F .byte sequences with AVX512F instructions.
Tested on x86-64 and x32. There are no code differences in libmvec.so
and libmvec.a.
* sysdeps/x86_64/fpu/svml_d_sincos8_core.S: Replace AVX512F
.byte sequences with AVX512F instructions.
* sysdeps/x86_64/fpu/svml_d_wrapper_impl.h: Likewise.
* sysdeps/x86_64/fpu/svml_s_sincosf16_core.S: Likewise.
* sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S:
Likewise.
Since Martin Sebor's commit
commit ee4e992ebe
Author: Martin Sebor <msebor@redhat.com>
Date: Tue Aug 22 09:35:23 2017 -0600
Declare ifunc resolver to return a pointer to the same type as the target
function to help GCC detect incompatibilities between the two when it's
enhanced to do so.
builds for powerpc64le fail in the declaration of some ifunc resolvers,
because the ifunc is declared with unmatching return types. One of the
declarations comes from the __ifunc_resolver macro, which was patched by
the aforementioned commit:
/* Helper / base macros for indirect function symbols. */
#define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
classifier inhibit_stack_protector \
__typeof (type_name) *name##_ifunc (arg) \
whereas the other comes from the unpatched __ifunc macro when
HAVE_GCC_IFUNC is not defined:
# define __ifunc(type_name, name, expr, arg, init) \
extern __typeof (type_name) name; \
void *name##_ifunc (arg) __asm__ (#name); \
This patch changes the return type of the ifunc resolver in the __ifunc
macro, so that it matches the return type of the target function,
similarly to what the aforementioned commit does.
Tested for powerpc64le and s390x with unpatched GCC.
* include/libc-symbols.h: [!defined HAVE_GCC_IFUNC] (__ifunc):
Change the return type of the ifunc resolver to match the return
type of the target function.
With {INLINE,INTERNAL}_SYSCALL macros fixed for 64-bits arguments on x32,
we can remove the p{read,write}{v} from auto-generation list.
Tested on x86_64 and x32.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (pread64): Remove.
(preadv64): Likewise.
(pwrite64(: Likewise.
(pwritev64): Likewise.
The problem for x32 is the {INTERNAL,INLINE}_SYSCALL C macros explicit
cast the arguments to 'long int', thus passing as 32 bits arguments
that should be passed to 64 bits.
Previous x32 implementation uses the auto-generated syscalls from
assembly macros (syscalls.list), so the {INTERNAL,INLINE}_SYSCALL
macros are never used with 64 bit argument in x32 (which are
internally broken for this ILP).
To fix it I used a strategy similar to MIPS64n32 (although both
ABI differs for some syscalls on how top pass 64-bits arguments)
where argument types for kernel call are defined using GCC extension
'typeof' with a arithmetic operation. This allows 64-bits arguments
to be defined while 32-bits argument will still passed as 32-bits.
I also cleanup the {INLINE,INTERNAL}_SYSCALL definition by defining
'inline_syscallX' instead of constructing the argument passing using
macros (it adds some readability) and removed the ununsed
INTERNAL_SYSCALL_NCS_TYPES define (since the patch idea is exactly to
avoid requiric explicit types passing).
Tested on x86_64 and x32.
* sysdeps/unix/sysv/linux/x86_64/sysdep.h
(INTERNAL_SYSCALL_NCS_TYPES): Remove define.
(LOAD_ARGS_0): Likewise.
(LOAD_ARGS_1): Likewise.
(LOAD_ARGS_2): Likewise.
(LOAD_ARGS_3): Likewise.
(LOAD_ARGS_4): Likewise.
(LOAD_ARGS_5): Likewise.
(LOAD_ARGS_6): Likewise.
(LOAD_REGS_0): Likewise.
(LOAD_REGS_1): Likewise.
(LOAD_REGS_2): Likewise.
(LOAD_REGS_3): Likewise.
(LOAD_REGS_4): Likewise.
(LOAD_REGS_5): Likewise.
(LOAD_REGS_6): Likewise.
(ASM_ARGS_0): Likewise.
(ASM_ARGS_1): Likewise.
(ASM_ARGS_2): Likewise.
(ASM_ARGS_3): Likewise.
(ASM_ARGS_4): Likewise.
(ASM_ARGS_5): Likewise.
(ASM_ARGS_6): Likewise.
(LOAD_ARGS_TYPES_1): Likewise.
(LOAD_ARGS_TYPES_2): Likewise.
(LOAD_ARGS_TYPES_3): Likewise.
(LOAD_ARGS_TYPES_4): Likewise.
(LOAD_ARGS_TYPES_5): Likewise.
(LOAD_ARGS_TYPES_6): Likewise.
(LOAD_REGS_TYPES_1): Likewise.
(LOAD_REGS_TYPES_2): Likewise.
(LOAD_REGS_TYPES_3): Likewise.
(LOAD_REGS_TYPES_4): Likewise.
(LOAD_REGS_TYPES_5): Likewise.
(LOAD_REGS_TYPES_6): Likewise.
(TYPEFY): New define.
(ARGIFY): Likewise.
(internal_syscall0): Likewise.
(internal_syscall1): Likewise.
(internal_syscall2): Likewise.
(internal_syscall3): Likewise.
(internal_syscall4): Likewise.
(internal_syscall5): Likewise.
(internal_syscall6): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/times.c
(INTERNAL_SYSCALL_NCS): Remove define.
(internal_syscall1): Add define.
The header math-svid-compat.h has been unintentionally included twice in
the wrappers for the remainder functions. This patch removes the
duplicate inclusions.
* math/w_remainder_compat.c: Remove duplicate inclusion of
math-svid-compat.h.
* math/w_remainderf_compat.c: Likewise.
* math/w_remainderl_compat.c: Likewise.
During the development of float128 on powerpc64le, the ulps have been
generated since early versions of the patches. On those versions, the
functions gamma and pow10 were mistakenly thought to be part of the API.
After review, the functions were removed, however the ulps for them were
carried in the ulps file.
This patch removes such entries from the ulps file, as well as it
shrinks the ulps for the cpow and lgamma functions.
Tested for powerpc64le.
* sysdeps/powerpc/fpu/libm-test-ulps: Update.
The tgmath.h macros return a real type not a complex type when an
argument is of complex integer type (a GNU extension) and there are no
arguments of complex floating type. It seems clear that just as real
integers are mapped to double for tgmath.h, so complex integers should
be mapped to _Complex double.
This patch implements such a mapping. The main complication in fixing
this bug is that the tgmath.h macros expand their arguments a large
number of times, resulting in exponential blowup of the size of the
expansion when calls to tgmath.h macros are used in the arguments of
such macros; it would be unfortunate for fixing a bug with a fairly
obscure extension to make the macros expand their arguments even more
times. Thus, this patch optimizes the definitions of the relevant
macros. __tgmath_real_type previously expanded its argument 7 times
and now expands it 3 times. __tgmath_complex_type, used in place of
__tgmath_real_type only for functions that might return either real or
complex types, not for complex functions that always return real types
or always return complex types, expands its argument 5 times. So the
sizes of the macro expansions from nested macro calls are
correspondingly reduced (remembering that each tgmath.h macro expands
__tgmath_real_type, or sometimes now __tgmath_complex_type, several
times).
Sometimes the real return type resulted from calling a complex
function and converting the result to a real type; sometimes it
resulted from calling a real function, because the logic for
determining whether arguments were real or complex, based on sizeof,
was confused by integer promotions applying to e.g. short int but not
_Complex short int. The relevant tests are converted to use a new
macro __expr_is_real, which, by calling __builtin_classify_type rather
than comparing the results of two calls to sizeof, also reduces the
number of times macros expand their arguments.
Although there are reductions in the number of times macros expand
their arguments, I do not consider this to fix bug 21660, since a
proper fix means each macro expanding its arguments only once (via
using new compiler features designed for that purpose).
Tested for x86_64.
[BZ #21684]
* math/tgmath.h (__floating_type): Simplify definitions.
(__real_integer_type): New macro.
(__complex_integer_type): Likewise.
(__expr_is_real): Likewise.
(__tgmath_real_type_sub): Update comment to describe handling of
complex types.
(__tgmath_complex_type_sub): New macro.
(__tgmath_complex_type): Likewise.
[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(__TGMATH_CF128): Use __expr_is_real.
(__TGMATH_UNARY_REAL_IMAG): Use __tgmath_complex_type and
__expr_is_real.
(__TGMATH_BINARY_REAL_IMAG): Likewise.
(__TGMATH_UNARY_REAL_IMAG_RET_REAL): Use __expr_is_real.
* math/gen-tgmath-tests.py (Type.create_type): Create complex
integer types.
There is no current internal usage for non cancellable sigsuspend calls.
Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.
* sysdeps/generic/not-cancel.h (sigsuspend_not_cancel): remove
macro.
* sysdeps/mach/hurd/sigsuspend.c (sigsuspend_not_cancel): remove
alias.
* sysdeps/unix/sysv/linux/not-cancel.h (sigsuspend_not_cancel):
likewise.