]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
6 years agoMove nss_compat from nis to nss subdir and install it unconditionally
Andreas Schwab [Mon, 2 Oct 2017 12:30:46 +0000 (14:30 +0200)] 
Move nss_compat from nis to nss subdir and install it unconditionally

This has been tested that local lookup still works with and
without an installed libnss_nis, and that NIS lookup works when
libnss_nis is available.

6 years ago[BZ #22244] Fix yn(n,0) without SVID wrapper
Szabolcs Nagy [Tue, 3 Oct 2017 17:12:42 +0000 (18:12 +0100)] 
[BZ #22244] Fix yn(n,0) without SVID wrapper

Without SVID compat wrapper yn(n,0) and ynf(n,0) does not raise
the divide-by-zero excpetion and it may return inf with the wrong
sign for n < 0.

[BZ #22244]
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_yn): Fix x == 0 case.
* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_ynf): Likewise.

6 years ago[BZ #22243] fix log2(0) and log(10) in downward rounding
Szabolcs Nagy [Tue, 3 Oct 2017 16:13:18 +0000 (17:13 +0100)] 
[BZ #22243] fix log2(0) and log(10) in downward rounding

On 64bit targets if the SVID compat wrapper is suppressed (e.g. static linking)
then log2(0) and log10(0) returned inf instead of -inf.

[BZ #22243]
* sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c (__ieee754_log10): Use fabs.
* sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c (__ieee754_log2): Likewise.

6 years agoi386: Use "movl main@GOT(%ebx), %eax" in start.S
H.J. Lu [Wed, 4 Oct 2017 00:54:13 +0000 (17:54 -0700)] 
i386: Use "movl main@GOT(%ebx), %eax" in start.S

Don't use "leal main@GOTOFF(%ebx), %eax" since main may be in a
shared object.  Linker will convert "movl main@GOT(%ebx), %eax"
to "leal main@GOTOFF(%ebx), %eax" if main is defined locally.

* sysdeps/i386/start.S: Replace "leal main@GOT(%ebx), %eax" with
"movl main@GOTOFF(%ebx), %eax".

6 years agoRevert x86: Allow undefined _DYNAMIC in static executable
H.J. Lu [Wed, 4 Oct 2017 00:48:55 +0000 (17:48 -0700)] 
Revert x86: Allow undefined _DYNAMIC in static executable

This code is used in non-PIE static executable and static PIE.  It checks
if _DYNAMIC is undefined before using it to compute load address.  But
not all targets can convert access _DYNAMIC via GOT, which needs dynamic
relocation, to PC-relative at link-time.

* sysdeps/i386/dl-machine.h (elf_machine_load_address): Don't
allow undefined _DYNAMIC in PIE libc.a.
* sysdeps/x86_64/dl-machine.h (elf_machine_load_address):
Likewse.

6 years agomips: Don't check _DYNAMIC in elf_machine_load_address
H.J. Lu [Wed, 4 Oct 2017 00:47:40 +0000 (17:47 -0700)] 
mips: Don't check _DYNAMIC in elf_machine_load_address

Since mips can't convert access _DYNAMIC via GOT, which needs dynamic
relocation, to PC-relative at link-time, don't check _DYNAMIC in
elf_machine_load_address.

        * sysdeps/mips/dl-machine.h (elf_machine_load_address): Don't
        check _DYNAMIC.

6 years agoarm: Don't check _DYNAMIC in elf_machine_load_address
H.J. Lu [Wed, 4 Oct 2017 00:45:53 +0000 (17:45 -0700)] 
arm: Don't check _DYNAMIC in elf_machine_load_address

Since arm can't convert access _DYNAMIC via GOT, which needs dynamic
relocation, to PC-relative at link-time, don't check _DYNAMIC in
elf_machine_load_address.

* sysdeps/arm/dl-machine.h (elf_machine_load_address): Don't
check _DYNAMIC.

6 years agotest-math-iscanonical.cc: Replace bool with int
H.J. Lu [Wed, 4 Oct 2017 00:41:32 +0000 (17:41 -0700)] 
test-math-iscanonical.cc: Replace bool with int

Fix GCC 7 compilation error:

test-math-iscanonical.cc: In function ‘void check_type()’:
test-math-iscanonical.cc:33:11: error: use of an operand of type ‘bool’ in ‘operator++’ is deprecated [-Werror=deprecated]
     errors++;
           ^~

* math/test-math-iscanonical.cc (error): Replace bool with int.

6 years agoUse libm_alias_double for dbl-64 modf.
Joseph Myers [Tue, 3 Oct 2017 23:46:23 +0000 (23:46 +0000)] 
Use libm_alias_double for dbl-64 modf.

This patch makes dbl-64 modf use libm_alias_double.  Both the dbl-64
and dbl-64/wordsize-64 versions are changed, and the ldbl-opt version
is changed to define the libc compat symbol only.  Because of
multiarch wrappers, the changed implementations are made not to define
aliases at all if __modf is defined as a macro, as with other
functions, so avoiding duplicate compat symbols while allowing those
wrappers to be simplified.

Tested for x86_64, and verified with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

* sysdeps/ieee754/dbl-64/s_modf.c: Include <libm-alias-double.h>.
(modf): Define using libm_alias_double, only if [!__modf].
* sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c: Include
<libm-alias-double.h>.
(modf): Define using libm_alias_double, only if [!__modf].
* sysdeps/ieee754/ldbl-opt/s_modf.c (modfl): Only define libc
compat symbol here.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-ppc32.c
(weak_alias): Do not undefine and redefine.
(strong_alias): Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c
(weak_alias): Likewise.
(strong_alias): Likewise.

6 years agoUse libm_alias_double for dbl-64 logb.
Joseph Myers [Tue, 3 Oct 2017 23:44:41 +0000 (23:44 +0000)] 
Use libm_alias_double for dbl-64 logb.

This patch makes dbl-64 logb use libm_alias_double.  Both the dbl-64
and dbl-64/wordsize-64 versions are changed, and the ldbl-opt version
is removed.  Because of multiarch wrappers, the changed
implementations are made not to define aliases at all if __logb is
defined as a macro, as with other functions, so avoiding duplicate
compat symbols while allowing those wrappers to be simplified.

Tested for x86_64, and verified with build-many-glibcs.py that
installed stripped shared libraries are unchanged (except on alpha
where changes from using the wordsize-64 version are expected).

* sysdeps/ieee754/dbl-64/s_logb.c: Include <libm-alias-double.h>.
(logb): Define using libm_alias_double, only if [!__logb].
* sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c: Include
<libm-alias-double.h>.
(logb): Define using libm_alias_double, only if [!__logb].
* sysdeps/ieee754/ldbl-opt/s_logb.c: Remove file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-ppc32.c
(weak_alias): Do not undefine and redefine.
(strong_alias): Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c
(weak_alias): Likewise.
(strong_alias): Likewise.

6 years agotile: Check SHARED instead PIC for SYSCALL_ERROR_NAME
H.J. Lu [Tue, 3 Oct 2017 21:54:55 +0000 (14:54 -0700)] 
tile: Check SHARED instead PIC for SYSCALL_ERROR_NAME

For static PIE code, PIC is defined and SHARED is undefined.  We
should check SHARED instead PIC for SYSCALL_ERROR_NAME.

* sysdeps/unix/sysv/linux/tile/sysdep.h (SYSCALL_ERROR_NAME):
Check SHARED instead PIC.

6 years agoUse libm_alias_float for dbl-64 fmaf.
Joseph Myers [Tue, 3 Oct 2017 21:01:33 +0000 (21:01 +0000)] 
Use libm_alias_float for dbl-64 fmaf.

This patch makes the implementation of fmaf in the dbl-64 directory
use libm_alias float.

Tested for x86_64, and verified with build-many-glibcs.py that
installed stripped shared libraries are unchanged by this patch.

* sysdeps/ieee754/dbl-64/s_fmaf.c: Include <libm-alias-float.h>.
[!__fmaf] (fmaf): Define using libm_alias_float.

6 years agoUse libm_alias_double for dbl-64 frexp.
Joseph Myers [Tue, 3 Oct 2017 20:56:46 +0000 (20:56 +0000)] 
Use libm_alias_double for dbl-64 frexp.

This patch makes dbl-64 frexp use libm_alias_double.  Both the dbl-64
and dbl-64/wordsize-64 versions are changed; the ldbl-opt version is
made to define only the libc frexpl compat symbol, now the generic
code handles the libm compat symbol automatically.

Tested for x86_64, and verified with build-many-glibcs.py that
installed stripped shared libraries are unchanged by this patch.

* sysdeps/ieee754/dbl-64/s_frexp.c: Include <libm-alias-double.h>.
(frexp): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c: Include
<libm-alias-double.h>.
(frexp): Define using libm_alias_double.
* sysdeps/ieee754/ldbl-opt/s_frexp.c (frexpl): Only define libc
compat symbol here.

6 years agoAdd C++ versions of iscanonical for ldbl-96 and ldbl-128ibm (bug 22235)
Gabriel F. T. Gomes [Mon, 2 Oct 2017 17:46:35 +0000 (14:46 -0300)] 
Add C++ versions of iscanonical for ldbl-96 and ldbl-128ibm (bug 22235)

All representations of floating-point numbers in types with IEC 60559
binary exchange format are canonical.  On the other hand, types with IEC
60559 extended formats, such as those implemented under ldbl-96 and
ldbl-128ibm, contain representations that are not canonical.

TS 18661-1 introduced the type-generic macro iscanonical, which returns
whether a floating-point value is canonical or not.  In Glibc, this
type-generic macro is implemented using the macro __MATH_TG, which, when
support for float128 is enabled, relies on __builtin_types_compatible_p
to select between floating-point types.  However, this use of
iscanonical breaks C++ applications, because the builtin is only
available in C mode.

This patch provides a C++ implementation of iscanonical that relies on
function overloading, rather than builtins, to select between
floating-point types.

Unlike the C++ implementations for iszero and issignaling, this
implementation ignores __NO_LONG_DOUBLE_MATH.  The double type always
matches IEC 60559 double format, which is always canonical.  Thus, when
double and long double are the same (__NO_LONG_DOUBLE_MATH), iscanonical
always returns 1 and is not implemented with __MATH_TG.

Tested for powerpc64, powerpc64le and x86_64.

[BZ #22235]
* math/math.h: Trivial fix for unbalanced parentheses in comment.
* math/Makefile [CXX] (tests): Add test-math-iscanonical.cc.
(CFLAGS-test-math-iscanonical.cc): New variable.
* math/test-math-iscanonical.cc: New file.
* sysdeps/ieee754/ldbl-96/bits/iscanonical.h (iscanonical):
Provide a C++ implementation based on function overloading,
rather than using __MATH_TG, which uses C-only builtins.
* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h (iscanonical):
Likewise.
* sysdeps/powerpc/powerpc64le/Makefile
(CFLAGS-test-math-iscanonical.cc): New variable.

6 years agoUse libm_alias_double for more dbl-64 functions.
Joseph Myers [Tue, 3 Oct 2017 17:47:35 +0000 (17:47 +0000)] 
Use libm_alias_double for more dbl-64 functions.

This patch makes more dbl-64 functions use libm_alias_double to define
function aliases.  Specifically, it makes the change for functions
with dbl-64/wordsize-64 versions, changing both the dbl-64 and
dbl-64/wordsize-64 versions and removing the ldbl-opt wrappers.
Functions are excluded from this patch if there are complications
because of versions of those functions also present in libc, or
architecture-specific wrappers round these files.

Tested for x86_64, and with build-many-glibcs.py.  Installed stripped
shared libraries are unchanged except for alpha (where increased use
of dbl-64/wordsize-64 files, where previously ldbl-opt files that
wrapped dbl-64 files were used, was expected to result in different,
better code).

* sysdeps/ieee754/dbl-64/s_ceil.c: Include <libm-alias-double.h>.
(ceil): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_floor.c: Include <libm-alias-double.h>.
(floor): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_llround.c: Include
<libm-alias-double.h>.
(llround): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_lround.c: Include
<libm-alias-double.h>.
(lround): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_nearbyint.c: Include
<libm-alias-double.h>.
(nearbyint): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_remquo.c: Include
<libm-alias-double.h>.
(remquo): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_rint.c: Include <libm-alias-double.h>.
(rint): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_round.c: Include <libm-alias-double.h>.
(round): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_trunc.c: Include <libm-alias-double.h>.
(trunc): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c: Include
<libm-alias-double.h>.
(ceil): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c: Include
<libm-alias-double.h>.
(floor): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c: Include
<libm-alias-double.h>.
(llround): Define using libm_alias_double.
[_LP64] (lround): Likewise.
* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Include
<libm-alias-double.h>.
[!_LP64] (lround): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: Include
<libm-alias-double.h>.
(nearbyint): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c: Include
<libm-alias-double.h>.
(remquo): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c: Include
<libm-alias-double.h>.
(rint): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_round.c: Include
<libm-alias-double.h>.
(round): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c: Include
<libm-alias-double.h>.
(trunc): Define using libm_alias_double.
* sysdeps/ieee754/ldbl-opt/s_ceil.c: Remove file.
* sysdeps/ieee754/ldbl-opt/s_floor.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_llround.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_lround.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_nearbyint.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_remquo.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_rint.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_round.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_trunc.c: Likewise.

6 years agofix drem symbol for static linking and new targets
Szabolcs Nagy [Mon, 2 Oct 2017 14:53:51 +0000 (15:53 +0100)] 
fix drem symbol for static linking and new targets

The compat remainder code is no longer built for !LIBM_SVID_COMPAT targets,
but the legacy drem, dremf and dreml symbols should be still defined since
removing them may break existing code, so keep them as aliases in the
non-compat remainder code.

* math/w_remainder.c: New file.
* math/w_remainderf.c: New file.
* math/w_remainderl.c: New file.

6 years agold.so: Replace (&bootstrap_map) with BOOTSTRAP_MAP
H.J. Lu [Tue, 3 Oct 2017 08:55:00 +0000 (01:55 -0700)] 
ld.so: Replace (&bootstrap_map) with BOOTSTRAP_MAP

(&_dl_main_map) is used instead of (&bootstrap_map) to bootstrap static
PIE.  Define BOOTSTRAP_MAP with (&_dl_main_map) to avoid hardcode to
(&bootstrap_map).

* elf/rtld.c (BOOTSTRAP_MAP): New.
(RESOLVE_MAP): Replace (&bootstrap_map) with BOOTSTRAP_MAP.
* sysdeps/hppa/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
Likewise.
* sysdeps/ia64/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
Likewise.
* sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
Likewise.

6 years agoIntroduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN
Samuel Thibault [Mon, 2 Oct 2017 23:26:58 +0000 (01:26 +0200)] 
Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN

On the Hurd, the rtld needs to see its own dumb versions of a few functions
(defined in sysdeps/mach/hurd/dl-sysdep.c) overridden by libc's versions once
loaded. rtld should thus not have hidden attribute for these.  To achieve this,
the Hurd port used to just define NO_HIDDEN, which disables it completely. For
now, this changes that to disabling it for all rtld functions, for simplicity.

See Roland's comment on https://sourceware.org/bugzilla/show_bug.cgi?id=15605#c5

The ld.so numbers remain at

  8 .rel.plt      000000c8  00000c24  00000c24  00000c24  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .plt          000001a0  00000cf0  00000cf0  00000cf0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .plt.got      00000010  00000e90  00000e90  00000e90  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 18 .got.plt      00000070  0002d000  0002d000  0002c000  2**2
                  CONTENTS, ALLOC, LOAD, DATA

which is about 3 times as much as on Linux.

The libc.so numbers get divided by 3 (the remainings are mostly RPC stub calls)

* include/libc-symbols.h [NO_RTLD_HIDDEN] (rtld_hidden_proto,
rtld_hidden_tls_proto, rtld_hidden_def, rtld_hidden_weak,
rtld_hidden_rtld_hidden_ver, data_def, rtld_hidden_data_weak,
rtld_hidden_data_ver): Define to empty.
* include/assert.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__assert_fail,
__assert_perror_fail): Likewise.
* include/dirent.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
(__rewinddir): Likewise.
* include/libc-internal.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
(__profile_frequency): Likewise.
* include/setjmp.h (__sigsetjmp): Likewise.
* include/signal.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__sigaction,
__libc_sigaction): Likewise.
* include/stdlib.h [NO_RTLD_HIDDEN] (unsetenv, __strtoul_internal): Do
not set hidden attribute.
* include/string.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__stpcpy, __strdup,
__strerror_t, __strsep_g, memchr, memcmp, memcpy, memmove, memset,
rawmemchr, stpcpy, strchr, strcmp, strlen, strnlen, strsep): Likewise.
* include/sys/stat.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__fxstat,
__fxstat64, __lxstat, __lxstat64, __xstat, __xstat64,
__fxstatat64): Likewise.
* include/sys/utsname.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
(__uname): Likewise.
* include/sysdeps/generic/_itoa.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
(_itoa_upper_digits, _itoa_lower_digits): Likewise.
* sysdeps/mach/hurd/configure.ac (NO_HIDDEN): Do not set.
(NO_RTLD_HIDDEN): Set.
* sysdeps/mach/hurd/configure: Refresh.
* config.h.in: Refresh.

6 years agoUse libm_alias_double for dbl-64 atan, tan.
Joseph Myers [Mon, 2 Oct 2017 23:16:56 +0000 (23:16 +0000)] 
Use libm_alias_double for dbl-64 atan, tan.

This patch makes the dbl-64 atan and tan implementations use
libm_alias_double, removing the corresponding ldbl-opt wrappers.

Tested for x86_64, and with build-many-glibcs.py.  Installed stripped
shared libraries are unchanged on non-ldbl-opt platforms.  For
ldbl-opt configurations, the patch has the effect of causing
compat_symbol to define atanl and tanl in terms of __atan and __tan
instead of in terms of atan and tan, which is enough to change the
installed stripped libm.so.

* sysdeps/ieee754/dbl-64/s_atan.c: Include <libm-alias-double.h>.
(atan): Define using libm_alias_double.
* sysdeps/ieee754/dbl-64/s_tan.c: Include <libm-alias-double.h>.
(tan): Define using libm_alias_double.
* sysdeps/ieee754/ldbl-opt/s_atan.c: Remove file.
* sysdeps/ieee754/ldbl-opt/s_tan.c: Likewise.

6 years agoMake dbl-64 atan and tan into weak aliases.
Joseph Myers [Mon, 2 Oct 2017 20:20:52 +0000 (20:20 +0000)] 
Make dbl-64 atan and tan into weak aliases.

This patch converts the dbl-64 implementations of atan and tan into
weak aliases of __atan and __tan, in preparation for making them use
libm_alias_double.  Consequent changes are made to the x86_64
multiarch versions wrapping round them (with the dbl-64 functions,
like other such functions, being made not to define their aliases at
all if __atan or __tan are defined as macros by an including file).

Tested for x86_64, and with build-many-glibcs.py.

* sysdeps/ieee754/dbl-64/s_atan.c (atan): Rename to __atan and
define as weak alias of __atan.  Do not define any aliases if
[__atan].
[NO_LONG_DOUBLE] (__atanl): Define as strong alias of __atan.
[NO_LONG_DOUBLE] (atanl): Define as weak alias of __atanl.
* sysdeps/ieee754/dbl-64/s_tan.c (tan): Rename to __tan and define
as weak alias of __tan.  Do not define any aliases if [__tan].
[NO_LONG_DOUBLE] (__tanl): Define as strong alias of __tan.
[NO_LONG_DOUBLE] (tanl): Define as weak alias of __tanl.
* sysdeps/x86_64/fpu/multiarch/s_atan-avx.c (atan): Rename to
__atan.
* sysdeps/x86_64/fpu/multiarch/s_atan-fma.c (atan): Likewise.
* sysdeps/x86_64/fpu/multiarch/s_atan-fma4.c (atan): Likewise.
* sysdeps/x86_64/fpu/multiarch/s_atan.c (atan): Rename to __atan
and define as weak alias of __atan.
* sysdeps/x86_64/fpu/multiarch/s_tan-avx.c (tan): Rename to
__atan.
* sysdeps/x86_64/fpu/multiarch/s_tan-fma.c (tan): Likewise.
* sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c (tan): Likewise.
* sysdeps/x86_64/fpu/multiarch/s_tan.c (tan): Rename to __tan and
define as weak alias of __tan.

6 years agofix gamma symbol for static linking and new targets
Szabolcs Nagy [Mon, 2 Oct 2017 12:01:02 +0000 (13:01 +0100)] 
fix gamma symbol for static linking and new targets

The lgamma compat code is no longer built for !LIBM_SVID_COMPAT targets,
but the legacy gamma, gammaf and gammal symbols should be still defined,
so make them aliases to the non-compat lgamma code.

* math/w_lgamma.c: New file.
* math/w_lgammaf.c: New file.
* math/w_lgammal.c: New file.

6 years agoDo not wrap logf, log2f and powf
Szabolcs Nagy [Wed, 13 Sep 2017 17:14:26 +0000 (18:14 +0100)] 
Do not wrap logf, log2f and powf

The new generic logf, log2f and powf code don't need wrappers any more,
they set errno inline so only use the wrappers on targets that need it.

* sysdeps/ieee754/flt-32/e_log2f.c (__log2f): Define without wrapper.
* sysdeps/ieee754/flt-32/e_logf.c (__logf): Likewise
* sysdeps/ieee754/flt-32/e_powf.c (__powf): Likewise
* sysdeps/ieee754/flt-32/w_log2f.c: New file.
* sysdeps/ieee754/flt-32/w_logf.c: New file.
* sysdeps/ieee754/flt-32/w_powf.c: New file.
* sysdeps/i386/fpu/w_log2f.c: New file.
* sysdeps/i386/fpu/w_logf.c: New file.
* sysdeps/i386/fpu/w_powf.c: New file.
* sysdeps/m68k/m680x0/fpu/w_log2f.c: New file.
* sysdeps/m68k/m680x0/fpu/w_logf.c: New file.
* sysdeps/m68k/m680x0/fpu/w_powf.c: New file.

6 years agoDo not wrap expf and exp2f
Szabolcs Nagy [Tue, 12 Sep 2017 11:44:18 +0000 (12:44 +0100)] 
Do not wrap expf and exp2f

The new generic expf and exp2f code don't need wrappers any more, they
set errno inline, so only use the wrappers on targets that need it.
(If the wrapper is needed, then the top level wrapper code is included,
otherwise empty w_exp*f.c is used to suppress the wrapper.)

A powerpc64 expf implementation includes the expf c code directly which
needed some changes.

* sysdeps/ieee754/flt-32/e_exp2f.c (__exp2f): Define without wrapper.
* sysdeps/ieee754/flt-32/e_expf.c (__expf): Likewise
* sysdeps/ieee754/flt-32/w_exp2f.c: New file.
* sysdeps/ieee754/flt-32/w_expf.c: New file.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c: Update for
the new expf code.
* sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c: New file.
* sysdeps/powerpc/powerpc64/power8/fpu/w_expf.c: New file.
* sysdeps/m68k/m680x0/fpu/w_exp2f.c: New file.
* sysdeps/m68k/m680x0/fpu/w_expf.c: New file.
* sysdeps/i386/fpu/w_exp2f.c: New file.
* sysdeps/i386/fpu/w_expf.c: New file.
* sysdeps/i386/i686/fpu/multiarch/w_expf.c: New file.
* sysdeps/x86_64/fpu/w_expf.c: New file.

6 years agoNew symbol version for logf, log2f and powf without SVID compat
Szabolcs Nagy [Wed, 13 Sep 2017 16:19:51 +0000 (17:19 +0100)] 
New symbol version for logf, log2f and powf without SVID compat

This patch changes the logf, log2f and powf 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.

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 (logf): New libm symbol at GLIBC_2.27.
(log2f): Likewise.
(powf): Likewise.
* math/w_log2f.c: New file.
* math/w_logf.c: New file.
* math/w_powf.c: New file.
* math/w_log2f_compat.c (__log2f_compat): For compat symbol only.
* math/w_logf_compat.c (__logf_compat): Likewise.
* math/w_powf_compat.c (__powf_compat): Likewise.
* sysdeps/ia64/fpu/e_log2f.S: Add versioned symbols.
* sysdeps/ia64/fpu/e_logf.S: Likewise.
* sysdeps/ia64/fpu/e_powf.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.

6 years agopowerpc: Optimize memrchr for power8
Rajalakshmi Srinivasaraghavan [Mon, 2 Oct 2017 12:01:13 +0000 (17:31 +0530)] 
powerpc: Optimize memrchr for power8

Vectorized loops are used for sizes greater than 32B to improve
performance over power7 optimization.  This shows as an average
of 25% improvement depending on the position of search
character.  The performance is same for shorter strings.

6 years agoHide internal fadvise64/fallocate64 functions [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 01:05:52 +0000 (18:05 -0700)] 
Hide internal fadvise64/fallocate64 functions [BZ #18822]

Hide internal fadvise64/fallocate64 functions to allow direct access
within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* sysdeps/unix/sysv/linux/posix_fadvise64.c
(__posix_fadvise64_l64): Add Add libc_hidden_proto and
libc_hidden_def.
* sysdeps/unix/sysv/linux/posix_fallocate64.c
(__posix_fallocate64_l64): Likewise.

6 years agoHide internal __sched_setaffinity_new function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 01:03:46 +0000 (18:03 -0700)] 
Hide internal __sched_setaffinity_new function [BZ #18822]

Hide internal __sched_setaffinity_new function to allow direct access
within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* sysdeps/unix/sysv/linux/sched_setaffinity.c
(__sched_setaffinity_new): Add libc_hidden_proto and
libc_hidden_def.

6 years agoHide internal __glob64 function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 01:01:54 +0000 (18:01 -0700)] 
Hide internal __glob64 function [BZ #18822]

Hide internal __glob64 function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/glob.h (__glob64): Add libc_hidden_proto.
* sysdeps/unix/sysv/linux/glob64.c (__glob64): Add
libc_hidden_def.

6 years agoHide internal __new_getrlimit function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:59:51 +0000 (17:59 -0700)] 
Hide internal __new_getrlimit function [BZ #18822]

Hide internal __new_getrlimit function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* sysdeps/unix/sysv/linux/getrlimit64.c (__new_getrlimit): Add
attribute_hidden.

6 years agoHide internal __new_exitfn function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:58:08 +0000 (17:58 -0700)] 
Hide internal __new_exitfn function [BZ #18822]

Hide internal __new_exitfn function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* stdlib/exit.h (__new_exitfn): Add attribute_hidden.

6 years agoHide internal __moncontrol function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:56:46 +0000 (17:56 -0700)] 
Hide internal __moncontrol function [BZ #18822]

Hide internal __moncontrol function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* mon/gmon.c (__moncontrol): Add libc_hidden_proto and
libc_hidden_def.

6 years agoHide internal __libc_print_version function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:55:11 +0000 (17:55 -0700)] 
Hide internal __libc_print_version function [BZ #18822]

Hide internal __libc_print_version function to allow direct access
within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* csu/version.c (__libc_print_version): Add attribute_hidden.

6 years agoHide internal __init_misc function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:53:31 +0000 (17:53 -0700)] 
Hide internal __init_misc function [BZ #18822]

Hide internal __init_misc function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/libc-internal.h (__init_misc): Add attribute_hidden.

6 years agoHide internal __setfpucw function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:52:15 +0000 (17:52 -0700)] 
Hide internal __setfpucw function [BZ #18822]

Hide internal __setfpucw function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/fpu_control.h (__setfpucw): Add attribute_hidden.

6 years agoHide internal __nis_hash function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:49:47 +0000 (17:49 -0700)] 
Hide internal __nis_hash function [BZ #18822]

Hide internal __nis_hash function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* nscd/nscd_helper.c (__nis_hash): New prototype.

6 years agoHide internal __tcgetattr function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:48:11 +0000 (17:48 -0700)] 
Hide internal __tcgetattr function [BZ #18822]

Hide internal __tcgetattr function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/termios.h (__tcgetattr): Add libc_hidden_proto.
* sysdeps/unix/bsd/tcgetattr.c (__tcgetattr): Add
libc_hidden_def.
* sysdeps/unix/sysv/linux/tcgetattr.c (__tcgetattr): Likewise.
* termios/tcgetattr.c (__tcgetattr): Likewise.

6 years agoHide internal __setrlimit function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:46:39 +0000 (17:46 -0700)] 
Hide internal __setrlimit function [BZ #18822]

Hide internal __setrlimit function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/sys/resource.h (__setrlimit): Add libc_hidden_proto.
* resource/setrlimit.c (__setrlimit): Add libc_hidden_def.
* sysdeps/mach/hurd/setrlimit.c (__setrlimit): Likewise.
* sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Likewise.
* sysdeps/unix/sysv/linux/setrlimit64.c (__GI___setrlimit): New.

6 years agoHide internal __vstrfmon_l function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:44:52 +0000 (17:44 -0700)] 
Hide internal __vstrfmon_l function [BZ #18822]

Hide internal __vstrfmon_l function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/monetary.h (__vstrfmon_l): Add attribute_hidden.

6 years agoHide internal __sched_setparam function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:43:13 +0000 (17:43 -0700)] 
Hide internal __sched_setparam function [BZ #18822]

Hide internal __sched_setparam function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

__GI___sched_setparam is defined when sysdeps/unix/syscalls.list is
used to generate sched_setparam.  Otherwise libc_hidden_def is needed
explicitly.

[BZ #18822]
* include/sched.h (__sched_setparam): Add libc_hidden_proto.
* posix/sched_setp.c (__sched_setparam): Add libc_hidden_def.

6 years agoHide internal __hash_string function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:41:20 +0000 (17:41 -0700)] 
Hide internal __hash_string function [BZ #18822]

Hide internal __hash_string function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* intl/hash-string.h (__hash_string): Add attribute_hidden.

6 years agoHide internal __hasmntopt function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:37:27 +0000 (17:37 -0700)] 
Hide internal __hasmntopt function [BZ #18822]

Hide internal __hasmntopt function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/mntent.h (__hasmntopt): Add libc_hidden_proto.
* misc/mntent_r.c (__hasmntopt): Add libc_hidden_def.

6 years agoHide internal __ifreq function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:35:26 +0000 (17:35 -0700)] 
Hide internal __ifreq function [BZ #18822]

Hide internal __ifreq function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

[BZ #18822]
* include/ifreq.h: New file.
* sysdeps/generic/ifreq.h (__if_nextreq): Removed.
(__ifreq): Likewise.
* sysdeps/mach/hurd/ifreq.h (__if_nextreq): Removed.
(__ifreq): Likewise.

6 years agoHide internal idna functions [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:33:08 +0000 (17:33 -0700)] 
Hide internal idna functions [BZ #18822]

Hide internal idna functions to allow direct access within libc.so and
libc.a without using GOT nor PLT.

[BZ #18822]
* include/idna.h: New file.
* inet/getnameinfo.c: Include <idna.h> instead of
<libidn/idna.h>.
(__idna_to_unicode_lzlz): Removed.
* sysdeps/posix/getaddrinfo.c: Include <idna.h> instead of
<libidn/idna.h>.
(__idna_to_ascii_lz): Removed.
(__idna_to_unicode_lzlz): Likewise.

6 years agoHide internal __gettextparse function [BZ #18822]
H.J. Lu [Mon, 2 Oct 2017 00:30:49 +0000 (17:30 -0700)] 
Hide internal __gettextparse function [BZ #18822]

Hide internal __gettextparse function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/plural-exp.h: New file.
* intl/plural-exp.c: Include <plural-exp.h> instead of
"plural-exp.h".

6 years agoHide internal __get_sol function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:12:08 +0000 (16:12 -0700)] 
Hide internal __get_sol function [BZ #18822]

Hide internal __get_sol function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* sysdeps/unix/sysv/linux/getsourcefilter.c: Include
"getsourcefilter.h".
* sysdeps/unix/sysv/linux/getsourcefilter.h: New file.
* sysdeps/unix/sysv/linux/setsourcefilter.c: Include
"getsourcefilter.h".
(__get_sol): Removed.

6 years agoMove hidden_proto (__dl_iterate_phdr) to include/link.h [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:09:20 +0000 (16:09 -0700)] 
Move hidden_proto (__dl_iterate_phdr) to include/link.h [BZ #18822]

__dl_iterate_phdr is hidden and should be accessed directly within
libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* elf/dl-iteratephdr.c (hidden_proto (__dl_iterate_phdr)): Moved
to ...
* include/link.h (hidden_proto (__dl_iterate_phdr)): Here.

6 years agoHide internal __bsd_getpt function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:08:25 +0000 (16:08 -0700)] 
Hide internal __bsd_getpt function [BZ #18822]

Hide internal __bsd_getpt function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* sysdeps/unix/sysv/linux/getpt.c (__bsd_getpt): Add
attribute_hidden.

6 years agoHide internal __fopen_maybe_mmap function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:07:30 +0000 (16:07 -0700)] 
Hide internal __fopen_maybe_mmap function [BZ #18822]

Hide internal __fopen_maybe_mmap function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* libio/iolibio.h (__fopen_maybe_mmap): Add attribute_hidden.

6 years agoHide internal __tdestroy function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:06:43 +0000 (16:06 -0700)] 
Hide internal __tdestroy function [BZ #18822]

Hide internal __tdestroy function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/search.h (__tdestroy): Add libc_hidden_proto.
* misc/tsearch.c (__tdestroy): Add libc_hidden_def.

6 years agoHide internal __assert_fail_base function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:06:00 +0000 (16:06 -0700)] 
Hide internal __assert_fail_base function [BZ #18822]

Hide internal __assert_fail_base function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/assert.h (__assert_fail_base): Add attribute_hidden.

6 years agoHide internal __sysinfo function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:05:10 +0000 (16:05 -0700)] 
Hide internal __sysinfo function [BZ #18822]

Hide internal __sysinfo function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

[BZ #18822]
* sysdeps/unix/sysv/linux/include/sys/sysinfo.h (__sysinfo): Add
attribute_hidden.

6 years agoHide internal signal functions [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:04:26 +0000 (16:04 -0700)] 
Hide internal signal functions [BZ #18822]

Hide internal signal functions to allow direct access within libc.so and
libc.a without using GOT nor PLT.

__GI___kill and __GI___sigaltstack are defined when syscalls.list is
used to generate them.  Otherwise libc_hidden_def is needed explicitly.

[BZ #18822]
* include/signal.h (__kill): Add libc_hidden_proto.
(__sigblock): Likewise.
(__sigprocmask): Likewise.
(__sigaltstack): Likewise.
* signal/kill.c (__kill): Add libc_hidden_def.
* signal/sigblock.c (__sigblock): Likewise.
* signal/sigprocmask.c (__sigprocmask): Likewise.
* sysdeps/mach/hurd/kill.c (__kill): Likewise.
* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
* sysdeps/mach/hurd/sigprocmask.c (__sigprocmask): Likewise.
* sysdeps/posix/sigblock.c (__sigblock): Likewise.
* sysdeps/unix/sysv/linux/alpha/sigprocmask.c (__sigprocmask):
Likewise.
* sysdeps/unix/sysv/linux/ia64/sigprocmask.c (__sigprocmask):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
(__sigprocmask): Likewise.
* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask):
Likewise.
* /sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
(__sigprocmask): Likewise.
* sysdeps/unix/sysv/linux/x86_64/sigprocmask.c (__sigprocmask):
Likewise.

6 years agoHide internal __strsep function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:03:28 +0000 (16:03 -0700)] 
Hide internal __strsep function [BZ #18822]

Hide internal __strsep function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

[BZ #18822]
* include/string.h (__strsep): Add libc_hidden_proto.
* string/strsep.c (__strsep): Add libc_hidden_def.

6 years agoHide __posix_spawn_file_actions_realloc/__spawni [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:02:41 +0000 (16:02 -0700)] 
Hide __posix_spawn_file_actions_realloc/__spawni [BZ #18822]

Hide internal __posix_spawn_file_actions_realloc and /__spawni functions
to allow direct access within libc.so and libc.a without using GOT nor
PLT.

[BZ #18822]
* posix/spawn_int.h (__posix_spawn_file_actions_realloc): Add
attribute_hidden.
(__spawni): Likewise.

6 years agoHide internal __mremap function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:01:43 +0000 (16:01 -0700)] 
Hide internal __mremap function [BZ #18822]

Hide internal __mremap function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

__GI___mremap is defined when sysdeps/unix/syscalls.list is used to
generate mremap.  Otherwise libc_hidden_def is needed explicitly.

[BZ #18822]
* include/sys/mman.h (__mremap): Add libc_hidden_proto.
* sysdeps/unix/sysv/linux/m68k/mremap.S (__mremap): Add
libc_hidden_def.

6 years agoHide internal __malloc_check_init function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 23:00:05 +0000 (16:00 -0700)] 
Hide internal __malloc_check_init function [BZ #18822]

Hide internal __malloc_check_init function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/malloc.h (__malloc_check_init): Add attribute_hidden.

6 years agoHide internal __ioctl function [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:58:52 +0000 (15:58 -0700)] 
Hide internal __ioctl function [BZ #18822]

Hide internal __ioctl function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

__GI___ioctl is defined when sysdeps/unix/syscalls.list is used to
generate ioctl.  Otherwise libc_hidden_def is needed explicitly.

[BZ #18822]
* include/sys/ioctl.h (__ioctl): Add libc_hidden_proto.
* misc/ioctl.c (__ioctl): Add libc_hidden_def.
* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
* sysdeps/unix/sysv/linux/aarch64/ioctl.S (__ioctl): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S (__ioctl):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S (__ioctl): Likewise.

6 years agoMark internal intl functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:58:05 +0000 (15:58 -0700)] 
Mark internal intl functions with attribute_hidden [BZ #18822]

Mark internal intl functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* intl/gettextP.h (__dcngettext): Add attribute_hidden.
(__dcigettext): Likewise.

6 years agoHide internal sysinfo functions [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:57:00 +0000 (15:57 -0700)] 
Hide internal sysinfo functions [BZ #18822]

Hide internal sysinfo functions to allow direct access within libc.so
and libc.a without using GOT nor PLT.

[BZ #18822]
* include/sys/sysinfo.h (__get_nprocs_conf): Add
libc_hidden_proto.
(__get_nprocs): Likewise.
(__get_phys_pages): Likewise.
(__get_avphys_pages): Likewise.
(__get_child_max): Add attribute_hidden.
* misc/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def.
(__get_nprocs): Likewise.
(__get_phys_pages): Likewise.
(__get_avphys_pages): Likewise.
* sysdeps/mach/getsysstats.c (__get_nprocs_conf): Add
libc_hidden_def.
(__get_nprocs): Likewise.
(__get_phys_pages): Likewise.
(__get_avphys_pages): Likewise.
* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Add
libc_hidden_def.
(__get_nprocs_conf): Likewise.
(__get_phys_pages): Likewise.
(__get_avphys_pages): Likewise.

6 years agoMark internal netlink functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:56:04 +0000 (15:56 -0700)] 
Mark internal netlink functions with attribute_hidden [BZ #18822]

Mark internal netlink functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_open): Add
attribute_hidden.
(__netlink_close): Likewise.
(__netlink_free_handle): Likewise.
(__netlink_request): Likewise.

6 years agoMark internal rpc functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:54:51 +0000 (15:54 -0700)] 
Mark internal rpc functions with attribute_hidden [BZ #18822]

Mark internal rpc functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/rpc/rpc.h (__rpc_thread_variables): Add
attribute_hidden.
(__rpc_thread_svc_cleanup): Likewise.
(__rpc_thread_clnt_cleanup): Likewise.
(__rpc_thread_key_cleanup): Likewise.

6 years agoHide __readv and __writev [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:53:52 +0000 (15:53 -0700)] 
Hide __readv and __writev [BZ #18822]

Hide internal __readv and __writev functions to allow direct access
within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/sys/uio.h (__readv): Add libc_hidden_proto.
(__writev): Likewise.
* misc/readv.c (__readv): Add libc_hidden_def.
* misc/writev.c (__writev): Likewise.
* sysdeps/posix/readv.c (__readv): Likewise.
* sysdeps/posix/writev.c (__writev): Likewise.
* sysdeps/unix/sysv/linux/readv.c: Include <sys/uio.h>.
(__readv): Likewise.
* sysdeps/unix/sysv/linux/writev.c: Include <sys/uio.h>.
(__writev): Likewise.

6 years agoHide internal regex functions [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:52:56 +0000 (15:52 -0700)] 
Hide internal regex functions [BZ #18822]

Hide internal regex functions to allow direct access within libc.so and
libc.a without using GOT nor PLT.

[BZ #18822]
* include/regex.h (__re_compile_fastmap): Add attribute_hidden.
(__regcomp): Add libc_hidden_proto.
(__regexec): Likewise.
(__regfree): Likewise.
* posix/regcomp.c (__regcomp): Add libc_hidden_def.
(__regfree): Likewise.
* posix/regexec.c (__regexec): Likewise.

6 years agoMark internal utmp functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:51:44 +0000 (15:51 -0700)] 
Mark internal utmp functions with attribute_hidden [BZ #18822]

Mark internal utmp functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/utmp.h (__updwtmp): Add libc_hidden_proto.
(__getutent): Likewise.
(__getutid): Likewise.
(__getutline): Likewise.
(__pututline): Likewise.
(__getutent_r): Likewise.
(__getutid_r): Likewise.
(__getutline_r): Likewise.
(__utmpname): Add attribute_hidden.
(__setutent): Likewise.
(__endutent): Likewise.
* login/getutent.c (__getutent): Add libc_hidden_def.
* login/getutent_r.c (__getutent_r): Likewise.
(__pututline): Likewise.
* login/getutid.c (__getutid): Likewise.
* login/getutid_r.c (__getutid_r): Likewise.
* login/getutline.c (__getutline): Likewise.
* login/getutline_r.c (__getutline_r): Likewise.
* login/updwtmp.c (__updwtmp): Likewise.

6 years agoMark internal dirent functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:50:56 +0000 (15:50 -0700)] 
Mark internal dirent functions with attribute_hidden [BZ #18822]

Mark internal dirent functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.  __readdir64
is hidden with libc_hidden_proto and libc_hidden_def since the exported
readdir64 is an alias of __readdir64.

[BZ #18822]
* include/dirent.h (__opendir): Always add attribute_hidden.
(__fdopendir): Likewise.
(__closedir): Likewise.
(__readdir): Likewise.
(__readdir64): Add libc_hidden_proto.
* sysdeps/mach/hurd/readdir64.c (__readdir64): Add libc_hidden_def.
* sysdeps/unix/sysv/linux/i386/readdir64.c (__readdir64): Likewise.
* sysdeps/unix/sysv/linux/readdir64.c (__readdir64): Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/readdir.c (__GI___readdir64):
New alias.

6 years agoMark internal getXXXbyYYY functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:20:47 +0000 (15:20 -0700)] 
Mark internal getXXXbyYYY functions with attribute_hidden [BZ #18822]

Mark internal getXXXbyYYY functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/aliases.h (__getaliasbyname_r): Add attribute_hidden.
* include/netdb.h (__gethostbyaddr_r): Likewise.
(__gethostbyname_r): Likewise.
(__gethostbyname2_r): Likewise.
(__getnetbyaddr_r): Likewise.
(__getnetbyname_r): Likewise.
(__getservbyname_r): Likewise.
(__getservbyport_r): Likewise.
(__getprotobyname_r): Likewise.
(__getprotobynumber_r): Likewise.
(__getnetgrent_r): Likewise.
* include/rpc/netdb.h (__getrpcbyname_r): Likewise.
(__getrpcbynumber_r): Likewise.
* nss/getXXbyYY.c (INTERNAL (REENTRANT_NAME)): Likewise.

6 years agoMark internal stdio functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:19:51 +0000 (15:19 -0700)] 
Mark internal stdio functions with attribute_hidden [BZ #18822]

Mark internal stdio functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/stdio.h (__fcloseall): Add attribute_hidden.
(__getline): Likewise.
(__path_search): Likewise.
(__gen_tempname): Likewise.
(__libc_message): Likewise.
(__flockfile): Likewise.
(__funlockfile): Likewise.
(__fxprintf): Likewise.
(__fxprintf_nocancel): Likewise.

6 years agoMark internal gshadow functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:19:01 +0000 (15:19 -0700)] 
Mark internal gshadow functions with attribute_hidden [BZ #18822]

Mark internal gshadow functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/gshadow.h (__fgetsgent_r): Add attribute_hidden.
(__sgetsgent_r): Likewise.

6 years agoMark internal statfs functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:18:09 +0000 (15:18 -0700)] 
Mark internal statfs functions with attribute_hidden [BZ #18822]

Mark internal statfs functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/sys/statfs.h (__fstatfs): Add attribute_hidden.
(__statfs64): Likewise.
(__fstatfs64): Likewise.
* include/sys/statvfs.h (__statvfs64): Likewise.
(__fstatvfs64): Likewise.
* sysdeps/unix/sysv/linux/pathconf.h (__statfs_link_max): Likewise.
(__statfs_filesize_max): Likewise.
(__statfs_symlinks): Likewise.
(__statfs_chown_restricted): Likewise.

6 years agoMark internal time functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:17:19 +0000 (15:17 -0700)] 
Mark internal time functions with attribute_hidden [BZ #18822]

Mark internal time functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/time.h (__tzstring): Add attribute_hidden.
(__tzfile_read): Likewise.
(__tzfile_compute): Likewise.
(__tzfile_default): Likewise.
(__tzset_parse_tz): Likewise.
(__offtime): Likewise.
(__asctime_r): Likewise.
(__tzset): Likewise.
(__tz_convert): Likewise.
(__getdate_r): Likewise.
(__getclktck): Likewise.

6 years agoMark internal nscd functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:16:13 +0000 (15:16 -0700)] 
Mark internal nscd functions with attribute_hidden [BZ #18822]

Mark internal nscd functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* nscd/nscd-client.h (__nscd_get_map_ref): Add attribute_hidden.
(__nscd_unmap): Likewise.
(__nscd_cache_search): Likewise.
(__nscd_get_nl_timestamp): Likewise.
(__nscd_getpwnam_r): Likewise.
(__nscd_getpwuid_r): Likewise.
(__nscd_getgrnam_r): Likewise.
(__nscd_getgrgid_r): Likewise.
(__nscd_gethostbyname_r): Likewise.
(__nscd_gethostbyname2_r): Likewise.
(__nscd_gethostbyaddr_r): Likewise.
(__nscd_getai): Likewise.
(__nscd_getgrouplist): Likewise.
(__nscd_getservbyname_r): Likewise.
(__nscd_getservbyport_r): Likewise.
(__nscd_innetgr): Likewise.
(__nscd_setnetgrent): Likewise.

6 years agoMark internal gmp functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:15:15 +0000 (15:15 -0700)] 
Mark internal gmp functions with attribute_hidden [BZ #18822]

Mark internal gmp functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/gmp.h: Declare internal functions only if _ISOMAC is
undefined.
(__mpn_extract_double): Add attribute_hidden.
(__mpn_extract_long_double): Likewise.
(__mpn_extract_float128): Likewise.
(__mpn_construct_float): Likewise.
(__mpn_construct_double): Likewise.
(__mpn_construct_long_double): Likewise.
(__mpn_construct_float128): Likewise.
(mpn_add_1): Likewise.
(mpn_addmul_1): Likewise.
(mpn_add_n): Likewise.
(mpn_cmp): Likewise.
(mpn_divrem): Likewise.
(mpn_lshift): Likewise.
(mpn_mul): Likewise.
(mpn_mul_1): Likewise.
(mpn_rshift): Likewise.
(mpn_sub_1): Likewise.
(mpn_submul_1): Likewise.
(mpn_sub_n): Likewise.

6 years agoMark internal wchar functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:14:17 +0000 (15:14 -0700)] 
Mark internal wchar functions with attribute_hidden [BZ #18822]

Mark internal wchar functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/wchar.h (__wcsnlen): Add attribute_hidden.
(__wcscat): Likewise.
(__btowc): Likewise.
(__wcrtomb): Likewise.
(__mbsrtowcs): Likewise.
(__wcsrtombs): Likewise.
(__mbsnrtowcs): Likewise.
(__wcsnrtombs): Likewise.
(__wcsncpy): Likewise.
(__wcpncpy): Likewise.
(__wmemcpy): Likewise.
(__wmempcpy): Likewise.
(__wmemmove): Likewise.
(__wcschrnul): Likewise.
(__vfwscanf): Likewise.
(__vswprintf): Likewise.
(__fwprintf): Likewise.
(__vfwprintf): Likewise.

6 years agoMark internal grp/pwd/shadow functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:12:57 +0000 (15:12 -0700)] 
Mark internal grp/pwd/shadow functions with attribute_hidden [BZ #18822]

Mark internal grp/pwd/shadow functions with attribute_hidden to allow
direct access within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/grp.h (__fgetgrent_r): Add attribute_hidden.
(__getgrgid_r): Likewise.
(__getgrnam_r): Likewise.
* include/pwd.h (__getpwuid_r): Likewise.
(__getpwnam_r): Likewise.
(__fgetpwent_r): Likewise.
* include/shadow.h (__getspnam_r): Likewise.
(__sgetspent_r): Likewise.
(__fgetspent_r): Likewise.

6 years agoMark internal unistd functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:11:40 +0000 (15:11 -0700)] 
Mark internal unistd functions with attribute_hidden [BZ #18822]

Mark internal unistd functions with attribute_hidden to allow direct
access to them within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* include/unistd.h (__access): Add attribute_hidden.
(__lseek64): Likewise.
(__libc_pread64): Likewise.
(__pipe2): Likewise.
(__sleep): Likewise.
(__chdir): Likewise.
(__fchdir): Likewise.
(__getcwd): Likewise.
(__rmdir): Likewise.
(__execvpe): Likewise.
(__execve): Likewise.
(__setsid): Likewise.
(__getuid): Likewise.
(__geteuid): Likewise.
(__getgid): Likewise.
(__getegid): Likewise.
(__getgroups): Likewise.
(__group_member): Likewise.
(__ttyname_r): Likewise.
(__isatty): Likewise.
(__readlink): Likewise.
(__unlink): Likewise.
(__gethostname): Likewise.
(__profil): Likewise.
(__getdtablesize): Likewise.
(__brk): Likewise.
(__ftruncate): Likewise.
(__ftruncate64): Likewise.

6 years agoMark internal argp functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:10:12 +0000 (15:10 -0700)] 
Mark internal argp functions with attribute_hidden [BZ #18822]

Mark internal argp functions with attribute_hidden to allow direct
access to them within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* argp/argp-fmtstream.c: Include <argp-fmtstream.h>.
* argp/argp-fs-xinl.c: Likewise.
* argp/argp-help.c: Include <argp.h> and <argp-fmtstream.h>.
* argp/argp-parse.c: Include <argp.h>.
* argp/argp-xinl.c: Likewise.
* include/argp-fmtstream.h: New file.
* include/argp.h (__argp_error): Add attribute_hidden.
(__argp_failure): Likewise.
(__argp_input): Likewise.
(__argp_state_help): Likewise.

6 years agoMark ____wcsto*_l_internal functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:09:11 +0000 (15:09 -0700)] 
Mark ____wcsto*_l_internal functions with attribute_hidden [BZ #18822]

Mark ____wcsto*_l_internal functions with attribute_hidden to allow
direct access to them within libc.so and libc.a without using GOT nor
PLT.

[BZ #18822]
* include/wchar.h (____wcstof_l_internal): New prototype.
(____wcstod_l_internal): Likewise.
(____wcstold_l_internal): Likewise.
(____wcstol_l_internal): Likewise.
(____wcstoul_l_internal): Likewise.
(____wcstoll_l_internal): Likewise.
(____wcstoull_l_internal): Likewise.
(____wcstof128_l_internal): Likewise.
* sysdeps/ieee754/float128/wcstof128.c
(____wcstof128_l_internal): Removed.
* sysdeps/ieee754/float128/wcstof128_l.c
(____wcstof128_l_internal): Likewise.
* wcsmbs/wcstod.c (____wcstod_l_internal): Likewise.
* wcsmbs/wcstod_l.c (____wcstod_l_internal): Likewise.
* wcsmbs/wcstof.c (____wcstof_l_internal): Likewise.
* wcsmbs/wcstof_l.c (____wcstof_l_internal): Likewise.
* wcsmbs/wcstol_l.c (____wcstol_l_internal): Likewise.
* wcsmbs/wcstold.c (____wcstold_l_internal): Likewise.
* wcsmbs/wcstold_l.c (____wcstold_l_internal): Likewise.
* wcsmbs/wcstoll_l.c (____wcstoll_l_internal): Likewise.
* wcsmbs/wcstoul_l.c (____wcstoul_l_internal): Likewise.
* wcsmbs/wcstoull_l.c (____wcstoull_l_internal): Likewise.

6 years agoMark __internal_statvfs[64] with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:08:14 +0000 (15:08 -0700)] 
Mark __internal_statvfs[64] with attribute_hidden [BZ #18822]

Mark __internal_statvfs[64] with attribute_hidden to allow direct access
to them within libc.so and libc.a without using GOT nor PLT.

[BZ #18822]
* sysdeps/unix/sysv/linux/fstatvfs.c: Include "internal_statvfs.h"
instead of <sys/statvfs.h>.
(__internal_statvfs): Removed.
* sysdeps/unix/sysv/linux/fstatvfs64.c Include "internal_statvfs.h"
instead of <sys/statvfs.h>.
(__internal_statvfs64): Removed.
* sysdeps/unix/sysv/linux/internal_statvfs.c: Include
"internal_statvfs.h" instead of <sys/statvfs.h>.
* sysdeps/unix/sysv/linux/internal_statvfs.h: New file.
* sysdeps/unix/sysv/linux/statvfs.c Include "internal_statvfs.h"
instead of <sys/statvfs.h>.
(__internal_statvfs): Removed.
* sysdeps/unix/sysv/linux/statvfs64.c Include "internal_statvfs.h"
instead of <sys/statvfs.h>.
(__internal_statvfs64): Removed.

6 years agoMark internal functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 22:07:06 +0000 (15:07 -0700)] 
Mark internal functions with attribute_hidden [BZ #18822]

Mark internal functions with attribute_hidden to allow direct access to
internal functions within libc.so and libc.a without using GOT nor PLT.

Size comparison of libc.so:

On x86-64:
        text    data     bss     dec     hex
Before: 1728577   20584   17088 1766249  1af369
After : 1728593   20584   17088 1766265  1af379

The only change is __gconv_release_shlib in iconv/gconv_dl.c is inlined
since it is hidden, which increases the code size of gconv_dl.os by 18
bytes.

On i686:
        text    data     bss     dec     hex
Before: 1869039   11444   11112 1891595  1cdd0b
After : 1868635   11444   11112 1891191  1cdb77

The code size is decreased by avoiding GOT/PLT for hidden functions.

[BZ #18822]
* iconv/gconv_int.h (__gconv_open): Add attribute_hidden.
(__gconv_close): Likewise.
(__gconv): Likewise.
(__gconv_find_transform): Likewise.
(__gconv_lookup_cache): Likewise.
(__gconv_compare_alias_cache): Likewise.
(__gconv_load_cache): Likewise.
(__gconv_get_path): Likewise.
(__gconv_close_transform): Likewise.
(__gconv_release_cache): Likewise.
(__gconv_find_shlib): Likewise.
(__gconv_release_shlib): Likewise.
(__gconv_get_builtin_trans): Likewise.
(__gconv_compare_alias): Likewise.
* include/dlfcn.h (_dlerror_run): Likewise.
* include/stdio.h (__fortify_fail_abort): Likewise.
* include/time.h (__tz_compute): Likewise.
(__strptime_internal): Likewise.
* intl/gettextP.h (_nl_find_domain): Likewise.
(_nl_load_domain): Likewise.
(_nl_find_msg): Likewise.
* intl/plural-exp.h (FREE_EXPRESSION): Likewise.
(EXTRACT_PLURAL_EXPRESSION): Likewise.
* locale/coll-lookup.h (__collidx_table_lookup): Likewise.
* resolv/gai_misc.h (__gai_enqueue_request): Likewise.
(__gai_find_request): Likewise.
(__gai_remove_request): Likewise.
(__gai_notify): Likewise.
(__gai_notify_only): Likewise.
* sysdeps/generic/aio_misc.h (__aio_sigqueue): Likewise.
* sysdeps/generic/ldsodefs.h (_dl_fini): Likewise.
(_dl_non_dynamic_init): Likewise.
(_dl_aux_init): Likewise.
* sysdeps/i386/machine-gmon.h (mcount_internal): Likewise.
* sysdeps/unix/sysv/linux/i386/olddirent.h (__old_getdents64):
Likewise.
* wcsmbs/wcsmbsload.h (__wcsmbs_load_conv): Likewise.
(__wcsmbs_clone_conv): Likewise.
(__wcsmbs_named_conv): Likewise.

6 years agoMark internal stdlib functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 21:34:18 +0000 (14:34 -0700)] 
Mark internal stdlib functions with attribute_hidden [BZ #18822]

Mark internal stdlib functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.  __realpath
is hidden with libc_hidden_proto and libc_hidden_def since the exported
realpath is an alias of __realpath.

[BZ #18822]
* include/stdlib.h (__random): Add attribute_hidden.
(__random_r): Likewise.
(__srandom_r): Likewise.
(__initstate_r): Likewise.
(__setstate_r): Likewise.
(__erand48_r): Likewise.
(__nrand48_r): Likewise.
(__jrand48_r): Likewise.
(__srand48_r): Likewise.
(__seed48_r): Likewise.
(__lcong48_r): Likewise.
(__drand48_iterate): Likewise.
(__setenv): Likewise.
(__unsetenv): Likewise.
(__clearenv): Likewise.
(__ptsname_r): Likewise.
(__posix_openpt): Likewise.
(__add_to_environ): Likewise.
(__realpath): Add libc_hidden_proto.
(__ecvt_r): Likewise.
(__fcvt_r): Likewise.
(__qecvt_r): Likewise.
(__qfcvt_r): Likewise.
* misc/efgcvt_r.c (cvt_symbol_1): Add libc_hidden_def (local).
* stdlib/canonicalize.c (__realpath): Add libc_hidden_def.

6 years agoMark 3 *_internal functions with attribute_hidden [BZ #18822]
H.J. Lu [Sun, 1 Oct 2017 21:33:26 +0000 (14:33 -0700)] 
Mark 3 *_internal functions with attribute_hidden [BZ #18822]

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.

6 years agoFix return pointer save and PIC register restore in __getcontext and
John David Anglin [Sun, 1 Oct 2017 15:58:04 +0000 (11:58 -0400)] 
Fix return pointer save and PIC register restore in __getcontext and
__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.

6 years agoFix hppa text relocations in libc.so
John David Anglin [Sat, 30 Sep 2017 23:02:57 +0000 (19:02 -0400)] 
Fix hppa text relocations in libc.so

[BZ libc/22165]
* sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Use PIC
code to load address of __getcontext_ret when generating PIC code.

6 years agoAdd a test for non-PIE static executable
H.J. Lu [Sat, 30 Sep 2017 08:39:14 +0000 (01:39 -0700)] 
Add a test for non-PIE static executable

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.

6 years agoUse libm_alias_double for some dbl-64 functions.
Joseph Myers [Fri, 29 Sep 2017 23:54:33 +0000 (23:54 +0000)] 
Use libm_alias_double for some dbl-64 functions.

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.

6 years agoarm: Update elf_machine_load_address for static PIE
H.J. Lu [Fri, 29 Sep 2017 23:23:18 +0000 (16:23 -0700)] 
arm: Update elf_machine_load_address for static PIE

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.

6 years agomips: Update elf_machine_load_address for static PIE
H.J. Lu [Fri, 29 Sep 2017 23:21:49 +0000 (16:21 -0700)] 
mips: Update elf_machine_load_address for static PIE

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.

6 years agoarm: Check PIC instead of SHARED in start.S
H.J. Lu [Fri, 29 Sep 2017 23:20:26 +0000 (16:20 -0700)] 
arm: Check PIC instead of SHARED in start.S

Since start.o may be compiled as PIC, we should check PIC instead of
SHARED.

* sysdeps/arm/start.S (_start): Check PIC instead of SHARED.

6 years agoUpdate x86_64 libm-test-ulps.
Joseph Myers [Fri, 29 Sep 2017 18:03:48 +0000 (18:03 +0000)] 
Update x86_64 libm-test-ulps.

* sysdeps/x86_64/fpu/libm-test-ulps: Update.

6 years agoUse fabs(f/l) rather than __fabs
Wilco Dijkstra [Fri, 29 Sep 2017 17:54:24 +0000 (18:54 +0100)] 
Use fabs(f/l) rather than __fabs

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.

6 years agoRemove old cimag inlines
Wilco Dijkstra [Fri, 29 Sep 2017 16:52:06 +0000 (17:52 +0100)] 
Remove old cimag inlines

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.

6 years agoNew generic powf
Szabolcs Nagy [Mon, 4 Sep 2017 16:55:33 +0000 (17:55 +0100)] 
New generic powf

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.

6 years agoNew generic log2f
Szabolcs Nagy [Mon, 4 Sep 2017 16:53:47 +0000 (17:53 +0100)] 
New generic log2f

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.

6 years agomissed ChangeLog entry
Szabolcs Nagy [Fri, 29 Sep 2017 10:48:40 +0000 (11:48 +0100)] 
missed ChangeLog entry

6 years agoNew generic logf
Szabolcs Nagy [Mon, 4 Sep 2017 16:48:46 +0000 (17:48 +0100)] 
New generic logf

without wrapper on aarch64:
logf reciprocal-throughput: 2.2x faster
logf latency: 1.9x faster
old worst case error: 0.89 ulp
new worst case error: 0.82 ulp
aarch64 .text size: -356 bytes
aarch64 .rodata size: +240 bytes

Uses double precision arithmetics and a lookup table to allow smaller
polynomial and avoid the use of division.

Data is in a separate translation unit with fixed layout to prevent the
compiler generating suboptimal literal access.

Errors are handled inline according to POSIX rules, but this patch
keeps the wrapper with SVID compatible error handling.

Needs libm-test-ulps adjustment for clogf in non-nearest rounding mode.

* math/Makefile (type-float-routines): Add e_logf_data.
* sysdeps/ieee754/flt-32/e_logf.c: New implementation.
* sysdeps/ieee754/flt-32/e_logf_data.c: New file.
* sysdeps/ieee754/flt-32/math_config.h (__logf_data): Define.
(LOGF_TABLE_BITS, LOGF_POLY_ORDER): Define.
* sysdeps/i386/fpu/e_logf_data.c: New file.
* sysdeps/ia64/fpu/e_logf_data.c: New file.
* sysdeps/m68k/m680x0/fpu/e_logf_data.c: New file.

6 years agox86: Allow undefined _DYNAMIC in static executable
H.J. Lu [Thu, 28 Sep 2017 22:28:00 +0000 (15:28 -0700)] 
x86: Allow undefined _DYNAMIC in static executable

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.

6 years agoRemove ancient __signbit inlines
Wilco Dijkstra [Thu, 28 Sep 2017 18:52:13 +0000 (19:52 +0100)] 
Remove ancient __signbit inlines

Remove __signbit inlines from mathinline.h.  Math.h already uses
the builtin when supported, so additional inlines are only used
on pre 4.0 GCCs.  Similarly remove ancient copysign and fabs
inlines.

* sysdeps/alpha/fpu/bits/mathinline.h: Delete file.
* sysdeps/ia64/fpu/bits/mathinline.h: Delete file.
* sysdeps/m68k/coldfire/fpu/bits/mathinline.h: Delete file.
* sysdeps/m68k/m680x0/fpu/bits/mathinline.h: (__signbitf): Remove.
(__signbit): Remove.
(__signbitl): Remove.
* sysdeps/powerpc/bits/mathinline.h (__signbitf): Remove.
(__signbit): Remove.
(__signbitl): Remove.
* sysdeps/s390/fpu/bits/mathinline.h: (__signbitf): Remove.
(__signbit): Remove.
(__signbitl): Remove
* sysdeps/sparc/fpu/bits/mathinline.h (__signbitf): Remove.
(__signbit): Remove.
(__signbitl): Remove.
* sysdeps/tile/bits/mathinline.h: Delete file.
* sysdeps/x86/fpu/bits/mathinline.h (__signbitf): Remove.
(__signbit): Remove.
(__signbitl): Remove.

6 years agoSimplify C99 isgreater macros
Wilco Dijkstra [Thu, 28 Sep 2017 18:20:33 +0000 (19:20 +0100)] 
Simplify C99 isgreater macros

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.

6 years agoAArch64: update libm-test-ulps
Szabolcs Nagy [Mon, 18 Sep 2017 12:37:08 +0000 (13:37 +0100)] 
AArch64: update libm-test-ulps

Update for new expf and logf.

* sysdeps/aarch64/libm-test-ulps: Update.

6 years agoFix nearbyint arithmetic moved before feholdexcept (bug 22225).
Joseph Myers [Thu, 28 Sep 2017 01:59:02 +0000 (01:59 +0000)] 
Fix nearbyint arithmetic moved before feholdexcept (bug 22225).

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.