platform/upstream/glibc.git
7 years agoRemove duplicate inclusion of header math-svid-compat.h
Gabriel F. T. Gomes [Tue, 22 Aug 2017 14:14:15 +0000 (11:14 -0300)]
Remove duplicate inclusion of header math-svid-compat.h

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.

7 years agopowerpc: Shrink ULPs for float128
Gabriel F. T. Gomes [Tue, 8 Aug 2017 21:52:03 +0000 (18:52 -0300)]
powerpc: Shrink ULPs for float128

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.

7 years agoFix tgmath.h handling of complex integers (bug 21684).
Joseph Myers [Tue, 22 Aug 2017 17:55:42 +0000 (17:55 +0000)]
Fix tgmath.h handling of complex integers (bug 21684).

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.

7 years agoRemove non cancellable sigsuspend definition
Adhemerval Zanella [Tue, 22 Aug 2017 13:09:52 +0000 (10:09 -0300)]
Remove non cancellable sigsuspend definition

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.

7 years agoConsolidate non cancellable nanosleep call
Adhemerval Zanella [Mon, 3 Jul 2017 18:54:02 +0000 (15:54 -0300)]
Consolidate non cancellable nanosleep call

This patch consolidates all the non cancellable nanosleep calls to use
the __nanosleep_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Replace
nanosleep_not_cancel with __nanosleep_nocancel.
* sysdeps/generic/not-cancel.h (nanosleep_not_cancel): Remove macro.
(__nanosleep_nocancel): New macro.
* sysdeps/unix/sysv/linux/nanosleep.c (__nanosleep_nocancel): New
function.
* sysdeps/unix/sysv/linux/not-cancel.h (nanosleep_not_cancel): Remove
macro.
(__nanosleep_nocancel): New prototype.

7 years agoConsolidate non cancellable pause call
Adhemerval Zanella [Mon, 21 Aug 2017 20:23:56 +0000 (17:23 -0300)]
Consolidate non cancellable pause call

This patch consolidates all the non cancellable pause calls to use
the __pause_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full): Replace
pause_not_cancel with __pause_nocancel.
* sysdeps/generic/not-cancel.h (pause_not_cancel): Remove macro.
(__pause_nocancel): New macro.
* sysdeps/unix/sysv/linux/not-cancel.h (pause_not_cancel): Remove
macro.
(__pause_nocancel): New prototype.
* sysdeps/unix/sysv/linux/pause.c (__pause_nocancel): New function.

7 years agoDeclare ifunc resolver to return a pointer to the same type as the target
Martin Sebor [Tue, 22 Aug 2017 15:35:23 +0000 (09:35 -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.

7 years agoHide internal printf functions [BZ #18822/21986]
H.J. Lu [Tue, 22 Aug 2017 14:47:34 +0000 (07:47 -0700)]
Hide internal printf functions [BZ #18822/21986]

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

Since __guess_grouping has been changed to take 2 arguments by

commit a1d84548c8aa7023cd039c85f81b831eef6d4a4c
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Fri Feb 11 18:50:36 2000 +0000

the third argument passed to __guess_grouping is removed.

[BZ #18822]
[BZ #21986]
* include/printf.h (__printf_fphex): Add attribute_hidden.
(__guess_grouping): New prototype.
* stdio-common/printf_fp.c (__guess_grouping): Removed.
* stdio-common/reg-printf.c (__register_printf_specifier): Add
libc_hidden_proto and libc_hidden_def.
* stdlib/strfmon_l.c (__guess_grouping): Removed.
(__vstrfmon_l): Remove the third argument passed to
__guess_grouping.

7 years agoProvide a C++ version of issignaling that does not use __MATH_TG
Gabriel F. T. Gomes [Mon, 14 Aug 2017 16:46:15 +0000 (13:46 -0300)]
Provide a C++ version of issignaling that does not use __MATH_TG

The macro __MATH_TG contains the logic to select between long double and
_Float128, when these types are ABI-distinct.  This logic relies on
__builtin_types_compatible_p, which is not available in C++ mode.

On the other hand, C++ function overloading provides the means to
distinguish between the floating-point types.  The overloading
resolution will match the correct parameter regardless of type
qualifiers, i.e.: const and volatile.

Tested for powerpc64le, s390x, and x86_64.

* math/math.h [defined __cplusplus] (issignaling): Provide a C++
definition for issignaling that does not rely on __MATH_TG,
since __MATH_TG uses __builtin_types_compatible_p, which is only
available in C mode.
(CFLAGS-test-math-issignaling.cc): New variable.
* math/Makefile [CXX] (tests): Add test-math-issignaling.
* math/test-math-issignaling.cc: New test for C++ implementation
of type-generic issignaling.
* sysdeps/powerpc/powerpc64le/Makefile [subdir == math]
(CXXFLAGS-test-math-issignaling.cc): Add -mfloat128 to the build
options of test-math-issignaling on powerpc64le.

7 years agoAdd hidden visibility to internal function prototypes
H.J. Lu [Tue, 22 Aug 2017 11:49:14 +0000 (13:49 +0200)]
Add hidden visibility to internal function prototypes

Add hidden visibility to internal function prototypes to allow direct
access to internal functions within libc.a without using GOT when the
compiler defaults to -fPIE.

Size comparison of elf/ldconfig when the compiler defaults to -fPIE:

On x86-64:
        text    data     bss     dec     hex
Before: 619646   20132    5488  645266   9d892
After : 619502   20132    5488  645122   9d802
On i686:
        text    data     bss     dec     hex
Before: 550333   10748    3060  564141   89bad
After : 546453   10732    3060  560245   88c75

* include/libc-symbols.h (__hidden_proto_hiddenattr): New for
building libc.a.
(hidden_proto): Likewise.
(hidden_tls_proto): Likewise.
(__hidden_proto): Likewise.

(Reapplied after the revert in df1deda60050cc8a68156cf6c81ad42363647a29.)

7 years agomath: Statically link tests of internal functionality
Florian Weimer [Tue, 22 Aug 2017 10:45:16 +0000 (12:45 +0200)]
math: Statically link tests of internal functionality

7 years agoFix sparc32 bits/long-double.h (bug 21987).
Joseph Myers [Tue, 22 Aug 2017 00:59:43 +0000 (00:59 +0000)]
Fix sparc32 bits/long-double.h (bug 21987).

My refactoring of long double information

commit 0acb8a2a855395c25b1feef2470f4d7ca4bed589
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Dec 14 18:27:56 2016 +0000

    Refactor long double information into bits/long-double.h.

resulted in sparc32 configurations installing the ldbl-opt version of
bits/long-double.h instead of the intended
sysdeps/unix/sysv/linux/sparc version.

For sparc32 by itself, this is not a problem, since the ldbl-opt
version is correct for sparc32.  However, both sparc32 and sparc64 are
supposed to install sets of headers that work for both of them, so
that a single sysroot, whichever order the libraries are built and
installed in, works for both.  The effect of having the wrong version
installed is that you end up with a miscompiled sparc64 libstdc++
which fails glibc's configure tests for the C++ compiler.

This patch moves the header from sysdeps/unix/sysv/linux/sparc to
separate copies of the same file for sparc32 and sparc64, to ensure it
comes before ldbl-opt in the sysdeps directory ordering.

Tested with build-many-glibcs.py for sparc64-linux-gnu and
sparcv9-linux-gnu.

[BZ #21987]
* sysdeps/unix/sysv/linux/sparc/bits/long-double.h: Remove file
and copy to ...
* sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h:
... here.
* sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h:
... and here.

7 years agoFix position of tests-unsupported definition in assert/Makefile.
Joseph Myers [Tue, 22 Aug 2017 00:30:51 +0000 (00:30 +0000)]
Fix position of tests-unsupported definition in assert/Makefile.

tests-unsupported has to be defined before the inclusion of Rules in a
subdirectory Makefile; otherwise it is ineffective.  This patch fixes
the ordering in assert/Makefile, where a recent test addition put
tests-unsupported too late (resulting in build failures when the C++
compiler was missing or broken, and thereby showing up the unrelated
bug 21987).

Incidentally, I don't see why these tests depend on
$(have-cxx-thread_local) rather than just a working C++ compiler.

Tested in such a configuration (broken compiler/libstdc++) with
build-many-glibcs.py.

* assert/Makefile [$(have-cxx-thread_local)]: Move conditional
variable definitions above inclusion of ../Rules.

7 years agoFix GCC 7 build of k_standard.c.
Joseph Myers [Mon, 21 Aug 2017 21:43:32 +0000 (21:43 +0000)]
Fix GCC 7 build of k_standard.c.

This patch adds a default case to k_standard.c that calls
__builtin_unreachable, to avoid an uninitialized variable error from
GCC 7 (reported in
<https://sourceware.org/ml/libc-alpha/2017-08/msg01012.html>).

Tested for x86_64 (with GCC 7).

* sysdeps/ieee754/k_standard.c (__kernel_standard): Add default
case calling __builtin_unreachable.

7 years agoConsolidate non cancellable waitpid call
Adhemerval Zanella [Mon, 3 Jul 2017 18:43:51 +0000 (15:43 -0300)]
Consolidate non cancellable waitpid call

This patch consolidates all the non cancellable waitpid calls to use
the __waitpid_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* libio/ioopen.c (_IO_waitpid): Replace waitpid_not_cancel with
__waitpid_nocancel.
* sysdeps/generic/not-cancel.h (waitpid_not_cancel): Remove macro.
(__waitpid_nocancel): New macro.
* sysdeps/unix/sysv/linux/not-cancel.h (waitpid_not_cancel): Remove
macro.
(__waitpid_nocancel): Replace macro with a function.
* sysdeps/unix/sysv/linux/waitpid.c (__waitpid_nocancel): New
function.

7 years agoConsolidate non cancellable fcntl call
Adhemerval Zanella [Mon, 3 Jul 2017 18:37:16 +0000 (15:37 -0300)]
Consolidate non cancellable fcntl call

This patch consolidates all the non cancellable fcntl calls to use
the __fcntl_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Since its prototype is already defined at internal fcntl.h header, it
is removed from not-cancel.h one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with
__fcntl_nocancel.
* sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro.
* sysdeps/unix/sysv/linux/not-cancel.h (fcntl_not_cancel): Likewise.

7 years agoConsolidate non cancellable writev call
Adhemerval Zanella [Mon, 3 Jul 2017 18:33:23 +0000 (15:33 -0300)]
Consolidate non cancellable writev call

This patch consolidates all the non cancellable writev calls to use
the __writev_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* gmon/gmon.c (write_hist): Replace writev_not_cancel_no_status with
__writev_nocancel_nostatus.
(write_call_graph): Likewise.
(write_bb_counts): Likewise.
* resolv/herror.c (herror): Likewise.
* sysdeps/generic/not-cancel.h (writev_not_cancel_no_status): Remove
macro.
(__writev_nocancel_nostatus): New macro.
* sysdeps/unix/sysv/linux/not-cancel.h (writev_not_cancel_no_status):
Remove macro.
(__writev_nocancel_nostatus): New function.

7 years agoRevert "Add hidden visibility to internal function prototypes".
Joseph Myers [Mon, 21 Aug 2017 17:52:05 +0000 (17:52 +0000)]
Revert "Add hidden visibility to internal function prototypes".

The commit

commit 568ff4296c72534e49c8d9c83c33f3a0069cccc7
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 21 05:50:38 2017 -0700

    Add hidden visibility to internal function prototypes

breaks the build of the testsuite for many platforms:

https://sourceware.org/ml/libc-testresults/2017-q3/msg00300.html

The errors are of the following form, building math/atest-exp:

[...]
/scratch/jmyers/glibc-bot/build/glibcs/aarch64-linux-gnu/glibc/stdlib/rshift.o: In function `__mpn_rshift':
/scratch/jmyers/glibc-bot/build/glibcs/aarch64-linux-gnu/glibc-src/stdlib/rshift.c:45: undefined reference to `__assert_fail'
/scratch/jmyers/glibc-bot/install/compilers/aarch64-linux-gnu/lib/gcc/aarch64-glibc-linux-gnu/7.2.1/../../../../aarch64-glibc-linux-gnu/bin/ld: /scratch/jmyers/glibc-bot/build/glibcs/aarch64-linux-gnu/glibc/math/atest-exp: hidden symbol `__assert_fail' isn't defined
/scratch/jmyers/glibc-bot/install/compilers/aarch64-linux-gnu/lib/gcc/aarch64-glibc-linux-gnu/7.2.1/../../../../aarch64-glibc-linux-gnu/bin/ld: final link failed: Bad value

This test is using various objects from the build of libc.  Some of
those objects contain references to __assert_fail.  Because those
references are hidden, they cannot refer to __assert_fail from
libc.so.  Given the tests using internal objects those symbols in
libc.a can't safely be made hidden, so this patch reverts the problem
commit until any alternative approach that doesn't break the build can
be found.

7 years agoRemove SPARC sqrt wrappers (bug 21973).
Joseph Myers [Mon, 21 Aug 2017 17:46:34 +0000 (17:46 +0000)]
Remove SPARC sqrt wrappers (bug 21973).

This patch removes the SPARC-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.

The removal of the wrappers also uncovers, and fixes, an old bug.
32-bit SPARC libm used (checked with glibc 2.8 binaries) to have a
sqrtl compat symbol, version GLIBC_2.0, for old binaries when sqrtl
was an alias of sqrt (I don't have pre-glibc-2.4 binaries for SPARC to
hand to check for the sqrtl symbol in those).  This disappeared,
probably with:

commit 8847f0377003fbfe9cbe951ce9f8717d74f26247
Author: David S. Miller <davem@davemloft.net>
Date:   Tue Feb 28 22:37:58 2012 -0800

    Add sparc optimized sqrt{,f}.

Removing the wrappers brings back the generic ldbl-opt logic for
creating such compat symbols, and so restores the compat symbol that
should be there.  This could of course also be fixed in the wrappers -
but as noted above, the wrappers are optimizing a case it's not useful
to optimize, so the bug of the missing compat symbol serves to
illustrate the risks involved with the extra complexity of
architecture-specific function versions where not needed.

Tested with build-many-glibcs.py.

[BZ #21973]
* sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Remove file.
* sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S:
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S:
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S : Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
* sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
* sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Add
GLIBC_2.0 sqrtl symbol.

7 years agoObsolete matherr, _LIB_VERSION, libieee.a.
Joseph Myers [Mon, 21 Aug 2017 17:45:10 +0000 (17:45 +0000)]
Obsolete matherr, _LIB_VERSION, libieee.a.

This patch obsoletes support for SVID libm error handling (the system
where a user-defined function matherr is called on a libm function
error; only enabled if you also set _LIB_VERSION = _SVID_ or
_LIB_VERSION = _XOPEN_) and the use of the _LIB_VERSION global
variable to control libm error handling.  matherr and _LIB_VERSION are
made into compat symbols, not supported for new ports or for static
linking.  The libieee.a object file (which sets _LIB_VERSION = _IEEE_,
so disabling errno setting for some functions) is also removed, and
all the related definitions are removed from math.h.

The manual already recommends against using matherr, and it's already
not supported for _Float128 functions (those use new wrappers that
don't support matherr, only errno) - this patch means that it becomes
possible to e.g. add sinf32 as an alias to sinf without that resulting
in undesired matherr support in sinf32 for existing glibc ports.
matherr support is not part of any standard supported by glibc (it was
removed in XPG4).

Because matherr is a function to be defined by the user, of course
user programs defining such a function will still continue to link; it
just quietly won't be used.  If they try to write to the library's
copy of _LIB_VERSION to enable SVID error handling, however, they will
get a link error (but if they define their own _LIB_VERSION variable,
they won't).

I expect the most likely case of build failures from this patch to be
programs with unconditional cargo-culted uses of -lieee (based on a
notion of "I want IEEE floating point", not any actual requirement for
that library).

Ideally, the new-port-or-static-linking case would use the new
wrappers used for _Float128.  This is not implemented in this patch,
because of the complication of architecture-specific (powerpc32 and
sparc) sqrt wrappers that use _LIB_VERSION and __kernel_standard
directly.  Thus, the old wrappers and __kernel_standard are still
built unconditionally, and _LIB_VERSION still exists in static libm.
But when the old wrappers and __kernel_standard are built in the
non-compat case, _LIB_VERSION and matherr are defined as macros so
code to support those features isn't actually built into static libm
or new ports' shared libm after this patch.

I intend to move to the new wrappers for static libm and new ports in
followup patches.  I believe the sqrt wrappers for powerpc32 and sparc
can reasonably be removed.  GCC already optimizes the normal case of
sqrt by generating code that uses a hardware instruction and only
calls the sqrt function if the argument was negative (if
-fno-math-errno, of course, it just uses the hardware instruction
without any check for negative argument being needed).  Thus those
wrappers will only actually get called in the case of negative
arguments, which is not a case it makes sense to optimize for.  But
even without removing the powerpc32 and sparc wrappers it should still
be possible to move to the new wrappers for static libm and new ports,
just without having those dubious architecture-specific optimizations
in static libm.

Everything said about matherr equally applies to matherrf and matherrl
(IA64-specific, undocumented), except that the structure of IA64 libm
means it won't be converted to using the new wrappers (it doesn't use
the old ones either, but its own error-handling code instead).

As with other tests of compat symbols, I expect test-matherr and
test-matherr-2 to need to become appropriately conditional once we
have a system for disabling such tests for ports too new to have the
relevant symbols.

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

* math/math.h [__USE_MISC] (_LIB_VERSION_TYPE): Remove.
[__USE_MISC] (_LIB_VERSION): Likewise.
[__USE_MISC] (struct exception): Likewise.
[__USE_MISC] (matherr): Likewise.
[__USE_MISC] (DOMAIN): Likewise.
[__USE_MISC] (SING): Likewise.
[__USE_MISC] (OVERFLOW): Likewise.
[__USE_MISC] (UNDERFLOW): Likewise.
[__USE_MISC] (TLOSS): Likewise.
[__USE_MISC] (PLOSS): Likewise.
[__USE_MISC] (HUGE): Likewise.
[__USE_XOPEN] (MAXFLOAT): Define even if [__USE_MISC].
* math/math-svid-compat.h: New file.
* conform/linknamespace.pl (@whitelist): Remove matherr, matherrf
and matherrl.
* include/math.h [!_ISOMAC] (__matherr): Remove.
* manual/arith.texi (FP Exceptions): Do not document matherr.
* math/Makefile (tests): Change test-matherr to test-matherr-3.
(tests-internal): New variable.
(install-lib): Do not add libieee.a.
(non-lib.a): Likewise.
(extra-objs): Do not add libieee.a and ieee-math.o.
(CPPFLAGS-s_lib_version.c): Remove variable.
($(objpfx)libieee.a): Remove rule.
($(addprefix $(objpfx), $(tests-internal)): Depend on $(libm).
* math/ieee-math.c: Remove.
* math/libm-test-support.c (matherr): Remove.
* math/test-matherr.c: Use <support/test-driver.c>.  Add copyright
and license notices.  Include <math-svid-compat.h> and
<shlib-compat.h>.
(matherr): Undefine as macro.  Use compat_symbol_reference.
(_LIB_VERSION): Likewise.
* math/test-matherr-2.c: New file.
* math/test-matherr-3.c: Likewise.
* sysdeps/generic/math_private.h (__kernel_standard): Remove
declaration.
(__kernel_standard_f): Likewise.
(__kernel_standard_l): Likewise.
* sysdeps/ieee754/s_lib_version.c: Do not include <math.h> or
<math_private.h>.  Include <math-svid-compat.h>.
(_LIB_VERSION): Undefine as macro.
(_LIB_VERSION_INTERNAL): Always initialize to _POSIX_.  Define
only if [LIBM_SVID_COMPAT || !defined SHARED].  If
[LIBM_SVID_COMPAT], use compat_symbol.
* sysdeps/ieee754/s_matherr.c: Do not include <math.h> or
<math_private.h>.  Include <math-svid-compat.h>.
(matherr): Undefine as macro.
(__matherr): Define only if [LIBM_SVID_COMPAT].  Use
compat_symbol.
* sysdeps/ia64/fpu/libm_error.c: Include <math-svid-compat.h>.
[_LIBC && LIBM_SVID_COMPAT] (matherrf): Use
compat_symbol_reference.
[_LIBC && LIBM_SVID_COMPAT] (matherrl): Likewise.
[_LIBC && !LIBM_SVID_COMPAT] (matherrf): Define as macro.
[_LIBC && !LIBM_SVID_COMPAT] (matherrl): Likewise.
* sysdeps/ia64/fpu/libm_support.h: Include <math-svid-compat.h>.
(MATHERR_D): Remove declaration.
[!_LIBC] (_LIB_VERSION_TYPE): Likewise
[!LIBM_BUILD] (_LIB_VERSIONIMF): Likewise.
[LIBM_BUILD] (pmatherrf): Likewise.
[LIBM_BUILD] (pmatherr): Likewise.
[LIBM_BUILD] (pmatherrl): Likewise.
(DOMAIN): Likewise.
(SING): Likewise.
(OVERFLOW): Likewise.
(UNDERFLOW): Likewise.
(TLOSS): Likewise.
(PLOSS): Likewise.
* sysdeps/ia64/fpu/s_matherrf.c: Include <math-svid-compat.h>.
(__matherrf): Define only if [LIBM_SVID_COMPAT].  Use
compat_symbol.
* sysdeps/ia64/fpu/s_matherrl.c: Include <math-svid-compat.h>.
(__matherrl): Define only if [LIBM_SVID_COMPAT].  Use
compat_symbol.
* math/lgamma-compat.h: Include <math-svid-compat.h>.
* math/w_acos_compat.c: Likewise.
* 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_main.c: Likewise.
* math/w_lgamma_r_compat.c: Likewise.
* math/w_lgammaf_main.c: Likewise.
* math/w_lgammaf_r_compat.c: Likewise.
* math/w_lgammal_main.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_scalb_compat.c: Likewise.
* math/w_scalbf_compat.c: Likewise.
* math/w_scalbl_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.
* sysdeps/ieee754/dbl-64/w_exp_compat.c: Likewise.
* 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/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/sparc/sparc32/fpu/w_sqrt_compat.S: Likewise.
* sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
* sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
* sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.

7 years agobenchtests: Do not compile benchmark objects as libc modules [BZ #21864]
Florian Weimer [Mon, 21 Aug 2017 17:28:54 +0000 (19:28 +0200)]
benchtests: Do not compile benchmark objects as libc modules [BZ #21864]

Otherwise, this will lead to link failures due to hidden symbol
references.

7 years agoassert: Support types without operator== (int) [BZ #21972]
Florian Weimer [Mon, 21 Aug 2017 11:03:29 +0000 (13:03 +0200)]
assert: Support types without operator== (int) [BZ #21972]

7 years agox86-64: Mark internal symbols with attribute_hidden [BZ #18822]
H.J. Lu [Mon, 21 Aug 2017 12:58:39 +0000 (05:58 -0700)]
x86-64: Mark internal symbols with attribute_hidden [BZ #18822]

Since __syscall_clock_gettime and __start_context are internal symbols
for Linux/x86-64, mark them with attribute_hidden.

[BZ #18822]
* sysdeps/unix/sysv/linux/x86_64/init-first.c
(__syscall_clock_gettime): Add attribute_hidden.
* sysdeps/unix/sysv/linux/x86_64/makecontext.c
(__start_context): Likewise.

7 years agoAdd hidden visibility to internal function prototypes
H.J. Lu [Mon, 21 Aug 2017 12:50:38 +0000 (05:50 -0700)]
Add hidden visibility to internal function prototypes

Add hidden visibility to internal function prototypes to allow direct
access to internal functions within libc.a without using GOT when the
compiler defaults to -fPIE.

Size comparison of elf/ldconfig when the compiler defaults to -fPIE:

On x86-64:
        text    data     bss     dec     hex
Before: 619646   20132    5488  645266   9d892
After : 619502   20132    5488  645122   9d802
On i686:
        text    data     bss     dec     hex
Before: 550333   10748    3060  564141   89bad
After : 546453   10732    3060  560245   88c75

* include/libc-symbols.h (__hidden_proto_hiddenattr): New for
building libc.a.
(hidden_proto): Likewise.
(hidden_tls_proto): Likewise.
(__hidden_proto): Likewise.

7 years agoEnable hidden visibility in libc.a compiled with PIE
H.J. Lu [Mon, 21 Aug 2017 12:47:10 +0000 (05:47 -0700)]
Enable hidden visibility in libc.a compiled with PIE

When building libc.a with PIE, enable hidden visibility to allow direct
access to definitions within libc.a without using GOT.

Size comparison of elf/ldconfig when the compiler defaults to -fPIE:

On x86-64:
        text    data     bss     dec     hex
Before: 619206   20132    5488  644826   9d6da
After : 619062   20132    5488  644682   9d64a
On i686:
        text    data     bss     dec     hex
Before: 556305   10816    3056  570177   8b341
After : 553688   10756    3056  567500   8a8cc

* include/libc-symbols.h (attribute_hidden): Enable hidden
visibility in libc.a compiled with PIE.

7 years agox86: Mark VDSO_SYMBOL(getcpu) with attribute_hidden [BZ #18822]
H.J. Lu [Mon, 21 Aug 2017 12:40:33 +0000 (05:40 -0700)]
x86: Mark VDSO_SYMBOL(getcpu) with attribute_hidden [BZ #18822]

VDSO_SYMBOL(getcpu) is defined as hidden in Linux/x86_64 init-first.c
and unused for Linux/i386.

[BZ #18822]
* sysdeps/unix/sysv/linux/x86/libc-vdso.h (VDSO_SYMBOL(getcpu)):
Add attribute_hidden.

7 years agoDon't compile non-lib modules as lib modules [BZ #21864]
H.J. Lu [Sun, 30 Jul 2017 04:04:09 +0000 (21:04 -0700)]
Don't compile non-lib modules as lib modules [BZ #21864]

Some programs have more than one source files.  These non-lib modules
should not be compiled with -DMODULE_NAME=libc.  This patch puts these
non-lib modules in $(others-extras) and adds $(others-extras) to
all-nonlib.

[BZ #21864]
* Makerules (all-nonlib): Add $(others-extras).
* catgets/Makefile (others-extras): New.
* elf/Makefile (others-extras): Likewise.
* nss/Makefile (others-extras): Likewise.

7 years agoMark __libc_multiple_libcs with attribute_hidden [BZ #18822]
H.J. Lu [Mon, 21 Aug 2017 12:32:21 +0000 (05:32 -0700)]
Mark __libc_multiple_libcs with attribute_hidden [BZ #18822]

Since __libc_multiple_libcs is defined as hidden symbol in init-first.c,
it should be always marked with attribute_hidden.

[BZ #18822]
* csu/libc-start.c (__libc_multiple_libcs): Removed.
* elf/dl-open.c: Include <libc-internal.h>.
(__libc_multiple_libcs): Removed.
* elf/dl-sysdep.c: Include <libc-internal.h> instead of
<hp-timing.h>.
* include/libc-internal.h (__libc_multiple_libcs): New.
* misc/sbrk.c: Include <libc-internal.h>.
(__libc_multiple_libcs): Removed.

7 years agoMark internal nss symbols with attribute_hidden [BZ #18822]
H.J. Lu [Mon, 21 Aug 2017 12:31:02 +0000 (05:31 -0700)]
Mark internal nss symbols with attribute_hidden [BZ #18822]

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

Tested on x86-64 with and without --disable-nscd.

[BZ #18822]
* grp/initgroups.c (__nss_group_database): Removed.
(__nss_initgroups_database): Likewise.
* nscd/gai.c (__nss_hosts_database): Likewise.
* nss/XXX-lookup.c (DATABASE_NAME_SYMBOL): Likewise.
* posix/tst-rfc3484-2.c (__nss_hosts_database): Likewise.
* posix/tst-rfc3484-3.c (__nss_hosts_database): Likewise.
* posix/tst-rfc3484.c (__nss_hosts_database): Likewise.
* sysdeps/posix/getaddrinfo.c (__nss_hosts_database): Likewise.
* nss/getXXent.c (INTERNAL (REENTRANT_GETNAME)): Add
attribute_hidden.
* nss/nsswitch.c (__nss_database_custom): Define only if
USE_NSCD is defined.
(__nss_configure_lookup): Use __nss_database_custom only if
USE_NSCD is defined.
* nss/nsswitch.h (__nss_database_custom): Declare only if
USE_NSCD is defined.  Add attribute_hidden.
(__nss_setent): Add attribute_hidden.
(__nss_endent): Likewise.
(__nss_getent_r): Likewise.
(__nss_getent): Likewise.
(DEFINE_DATABASE): Declare __nss_##arg##_database.

7 years agoi386: Hide __old_glob64 [BZ #18822]
H.J. Lu [Sun, 20 Aug 2017 17:46:47 +0000 (10:46 -0700)]
i386: Hide __old_glob64 [BZ #18822]

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

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

7 years agoi386: Hide __old_readdir64 [BZ #18822]
H.J. Lu [Sun, 20 Aug 2017 17:45:58 +0000 (10:45 -0700)]
i386: Hide __old_readdir64 [BZ #18822]

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

[BZ #18822]
* sysdeps/unix/sysv/linux/i386/olddirent.h (__old_readdir64):
Add libc_hidden_proto.
* sysdeps/unix/sysv/linux/i386/readdir64.c (__old_readdir64):
Add libc_hidden_def.

7 years agoRemove sysdeps/alpha/bb_init_func.S
H.J. Lu [Sun, 20 Aug 2017 13:50:59 +0000 (06:50 -0700)]
Remove sysdeps/alpha/bb_init_func.S

Since the generic __bb_init_func has been removed by commit 7ed87317c7fb,
there is no need for sysdeps/alpha/bb_init_func.S.

[BZ #21974]
* sysdeps/alpha/bb_init_func.S: Removed.

7 years agoUpdate ChangeLog
H.J. Lu [Sun, 20 Aug 2017 13:45:25 +0000 (06:45 -0700)]
Update ChangeLog

7 years agoRemove __bb_init_func and __bb_exit_func [BZ #21974]
H.J. Lu [Sun, 20 Aug 2017 13:39:10 +0000 (06:39 -0700)]
Remove __bb_init_func and __bb_exit_func [BZ #21974]

__bb_init_func and __bb_exit_func have been removed from GCC 3.3 in
2002 by

https://gcc.gnu.org/ml/gcc-patches/2002-09/msg00499.html

which also recommended that they should also be removed from glibc. These
functions exist only in libc.a and are used for gcov from versions of GCC
older than GCC 3.3.

[BZ #21974]
* gmon/Makefile (routines): Remove bb_init_func and
bb_exit_func.
(elide-routines.os): Removed.
* include/sys/gmon.h (__bb): Likewise.
(__bb_init_func): Likewise.
(__bb_exit_func): Likewise.

7 years agoMove ____longjmp_chk prototype to include/setjmp.h
H.J. Lu [Sun, 20 Aug 2017 13:30:29 +0000 (06:30 -0700)]
Move ____longjmp_chk prototype to include/setjmp.h

Move ____longjmp_chk prototype to include/setjmp.h and add
attribute_hidden.

* debug/longjmp_chk.c (____longjmp_chk): Moved to ...
* include/setjmp.h (____longjmp_chk): Here.  Add
attribute_hidden.

7 years agoMark internal SSE2 functions with attribute_hidden [BZ #18822]
H.J. Lu [Sat, 19 Aug 2017 23:46:33 +0000 (16:46 -0700)]
Mark internal SSE2 functions with attribute_hidden [BZ #18822]

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

[BZ #18822]
* sysdeps/x86_64/multiarch/strcspn-c.c (STRCSPN_SSE2): Add
attribute_hidden.
(__strspn_sse2): Likewise.

7 years agoConsolidate non cancellable close call
Adhemerval Zanella [Mon, 3 Jul 2017 18:22:58 +0000 (15:22 -0300)]
Consolidate non cancellable close call

This patch consolidates all the non cancellable close calls to use
the __close_nocancel{_nostatus} identifier.  For non cancellable targets
it will be just a macro to call the default respective symbol while on Linux
will be a internal one.

Also, since it is used on libcrypto it is also exported in GLIBC_PRIVATE
namespace.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* sysdeps/generic/not-cancel.h (close_not_cancel): Remove macro.
(close_not_cancel_no_status): Likewise.
(__close_nocancel): New macro.
(__close_nocancel_no_status): Likewise.
* sysdeps/unix/sysv/linux/not-cancel.h (__close_nocancel): Remove
macro.
(close_not_cancel): Likewise.
(close_not_cancel_no_status): Likewise.
(__close_nocancel): New prototype.
(__close_nocancel_no_status): New function.
* sysdeps/unix/sysv/linux/close.c (__close_nocancel): New function.
* catgets/open_catalog.c (__open_catalog): Replace
close_not_cancel{_no_status) with __close_nocancel{_nostatus}.
* gmon/gmon.c (write_gmon): Likewise.
* iconv/gconv_cache.c (__gconv_load_cache): Likewise.
* intl/loadmsgcat.c (close): Likewise.
* io/ftw.c (open_dir_stream): Likewise.
(ftw_startup): Likewise.
* libio/fileops.c (_IO_file_open): Likewise.
(_IO_file_close_mmap): Likewise.
(_IO_file_close): Likewise.
* libio/iopopen.c (_IO_dup2): Likewise.
* locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
* locale/loadlocale.c (_nl_load_locale): Likewise.
* login/utmp_file.c (pututline_file): Likewise.
(endutent_file): Likewise.
* misc/daemon.c (daemon): Likewise.
* nscd/nscd_getai.c (__nscd_getai): Likewise.
* nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise.
* nscd/nscd_gethst_r.c (nscd_gethst_r): Likewise.
* nscd/nscd_getpw_r.c (nscd_getpw_r): Likewise.
* nscd/nscd_getserv_r.c (nscd_getserv_r): Likewise.
* nscd/nscd_helper.c (open_socket): Likewise.
(__nscd_open_socket): Likewise.
* nscd/nscd_initgroups.c (__nscd_getgrouplist): Likewise.
* nscd/nscd_netgroup.c (__nscd_setnetgrent): Likewise.
(__nscd_innetgr): Likewise.
* nss/nss_db/db-open.c (internal_setent): Likewise.
* resolv/res-close.c (__res_iclose): Likewise.
* sunrpc/pm_getmaps.c (pmap_getmaps): Likewise.
* sysdeps/posix/closedir.c (__closedir): Likewise.
* sysdeps/posix/getaddrinfo.c (getaddrinfo): Likewise.
* sysdeps/posix/getcwd.c (__getcwd): Likewise.
* sysdeps/posix/opendir.c (tryopen_o_directory): Likewise.
(opendir_tail): Likewise.
* sysdeps/posix/spawni.c (__spawni_child): Likewise.
* sysdeps/unix/sysv/linux/check_native.c (__check_native): Likewise.
* sysdeps/unix/sysv/linux/check_pf.c (__check_pf): Likewise.
* sysdeps/unix/sysv/linux/fips-private.h (fips_enabled_p): Likewise.
* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
(gethostid): Likewise.
* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
Likewise.
* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Likewise.
* sysdeps/unix/sysv/linux/grantpt.c (close_all_fds): Likewise.
* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
Likewise.
* sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): Likewise.
* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps): Likewise.
* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
Likewise.
* sysdeps/unix/sysv/linux/mq_notify.c (init_mq_netlink): Likewise.
* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
Likewise.
* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
Likewise.
* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise.
* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.

7 years agoConsolidate non cancellable openat call
Adhemerval Zanella [Mon, 3 Jul 2017 18:00:26 +0000 (15:00 -0300)]
Consolidate non cancellable openat call

This patch consolidates all the non cancellable openat{64} calls to use
the __openat{64}_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* sysdeps/generic/not-cancel.h (openat_not_cancel): Remove macro.
(openat_not_cancel_3): Likewise.
(openat64_not_cancel_3): Likewise).
(openat_not_cancel_3): Likewise).
* sysdeps/unix/sysv/linux/not-cancel.h (openat_not_cancel): Remove
macro.
(openat_not_cancel_3): Likewise.
(openat64_not_cancel): Likewise.
(openat64_not_cancel_3): Likewise.
* sysdeps/unix/sysv/linux/openat.c (__openat_nocancel): New function.
* sysdeps/unix/sysv/linux/openat64.c (__openat64_nocancel): Likewise.
* io/ftw.c (open_dir_stream): Replace openat{64}_not_cancel{_3} with
__open{64}_nocancel.
* sysdeps/mach/hurd/opendir.c (__opendirat): Likewise.
* sysdeps/posix/getcwd.c (__getcwd): Likewise.
* sysdeps/posix/opendir.c (__opendirat): Likewise.

7 years agoMark internal argz functions with attribute_hidden [BZ #18822]
H.J. Lu [Fri, 18 Aug 2017 16:31:19 +0000 (09:31 -0700)]
Mark internal argz functions with attribute_hidden [BZ #18822]

Move internal argz function prototypes to include/argz.h and mark them
with attribute_hidden to allow direct access within libc.so and libc.a
without using GOT nor PLT.  This also brings string/argz.h closer to the
gnulib version.

[BZ #18822]
* include/argz.h (__argz_create_sep): New function prototype.
(__argz_append): Likewise.
(__argz_add): Likewise.
(__argz_add_sep): Likewise.
(__argz_delete): Likewise.
(__argz_insert): Likewise.
(__argz_replace): Likewise.
* string/argz.h (__argz_create_sep): Removed.
(__argz_append): Likewise.
(__argz_add): Likewise.
(__argz_add_sep): Likewise.
(__argz_delete): Likewise.
(__argz_insert): Likewise.
(__argz_replace): Likewise.

7 years agoAdd NT_GNU_PROPERTY_TYPE_0 macros
H.J. Lu [Fri, 18 Aug 2017 15:49:07 +0000 (08:49 -0700)]
Add NT_GNU_PROPERTY_TYPE_0 macros

Add macros used in GNU .note.gnu.property notes (NT_GNU_PROPERTY_TYPE_0).

* elf/elf.h (NT_GNU_PROPERTY_TYPE_0): New.
(NOTE_GNU_PROPERTY_SECTION_NAME): Likewise.
(GNU_PROPERTY_STACK_SIZE): Likewie.
(GNU_PROPERTY_NO_COPY_ON_PROTECTED): Likewie.
(GNU_PROPERTY_LOPROC): Likewise.
(GNU_PROPERTY_HIPROC): Likewise.
(GNU_PROPERTY_LOUSER): Likewise.
(GNU_PROPERTY_HIUSER): Likewise.
(GNU_PROPERTY_X86_ISA_1_USED): Likwise.
(GNU_PROPERTY_X86_ISA_1_NEEDED): Likwise.
(GNU_PROPERTY_X86_FEATURE_1_AND): Likwise.
(GNU_PROPERTY_X86_ISA_1_486): Likwise.
(GNU_PROPERTY_X86_ISA_1_586): Likwise.
(GNU_PROPERTY_X86_ISA_1_686): Likwise.
(GNU_PROPERTY_X86_ISA_1_SSE): Likwise.
(GNU_PROPERTY_X86_ISA_1_SSE2): Likwise.
(GNU_PROPERTY_X86_ISA_1_SSE3): Likwise.
(GNU_PROPERTY_X86_ISA_1_SSSE3): Likwise.
(GNU_PROPERTY_X86_ISA_1_SSE4_1): Likwise.
(GNU_PROPERTY_X86_ISA_1_SSE4_2): Likwise.
(GNU_PROPERTY_X86_ISA_1_AVX): Likwise.
(GNU_PROPERTY_X86_ISA_1_AVX2): Likwise.
(GNU_PROPERTY_X86_ISA_1_AVX512F): Likwise.
(GNU_PROPERTY_X86_ISA_1_AVX512CD): Likwise.
(GNU_PROPERTY_X86_ISA_1_AVX512ER): Likwise.
(GNU_PROPERTY_X86_ISA_1_AVX512PF): Likwise.
(GNU_PROPERTY_X86_ISA_1_AVX512VL): Likwise.
(GNU_PROPERTY_X86_ISA_1_AVX512DQ): Likwise.
(GNU_PROPERTY_X86_ISA_1_AVX512BW): Likwise.
(GNU_PROPERTY_X86_FEATURE_1_IBT): Likwise.
(GNU_PROPERTY_X86_FEATURE_1_SHSTK): Likwise.

7 years agoDo not use generic selection in C++ mode
Gabriel F. T. Gomes [Mon, 14 Aug 2017 20:51:51 +0000 (17:51 -0300)]
Do not use generic selection in C++ mode

The logic to protect the use of generic selection (_Generic) does not
check for C or C++ mode, however, generic selection is a C-only
feature.

Tested for powerpc64le.

* misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if
in C++ mode.

7 years agoDo not use __builtin_types_compatible_p in C++ mode (bug 21930)
Gabriel F. T. Gomes [Fri, 11 Aug 2017 17:29:06 +0000 (14:29 -0300)]
Do not use __builtin_types_compatible_p in C++ mode (bug 21930)

The logic to define isinf for float128 depends on the availability of
__builtin_types_compatible_p, which is only available in C mode,
however, the conditionals do not check for C or C++ mode.  This lead to
an error in libstdc++ configure, as reported by bug 21930.

This patch adds a conditional for C mode in the definition of isinf for
float128.  No definition is provided in C++ mode, since libstdc++
headers undefine isinf.

Tested for powerpc64le (glibc test suite and libstdc++-v3 configure).

[BZ #21930]
* math/math.h (isinf): Check if in C or C++ mode before using
__builtin_types_compatible_p, since this is a C mode feature.

7 years agoConsolidate non cancellable write call
Adhemerval Zanella [Mon, 3 Jul 2017 17:39:52 +0000 (14:39 -0300)]
Consolidate non cancellable write call

This patch consolidates all the non cancellable write calls to use
the __write_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* sysdeps/generic/not-cancel.h (write_not_cancel): Remove macro.
(__write_nocancel): New macro.
* sysdeps/unix/sysv/linux/not-cancel.h (__write_nocancel):
Rewrite as a function prototype.
(write_not_cancel): Remove macro.
* sysdeps/unix/sysv/linux/write.c (__write_nocancel): New function.
* gmon/gmon.c (ERR): Replace write_not_cancel with __write_nocancel.
(write_gmon): Likewise.
* libio/fileops.c (_IO_new_file_write): Likewise.
* login/utmp_file.c (pututline_file): Likewise.
(updwtmp_file): Likewise.
* stdio-common/psiginfo.c (psiginfo): Likewise.
* sysdeps/posix/spawni.c (__spawni_child): Likewise.
* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps):
Likewise.
* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
Likewise.

7 years agoConsolidate non cancellable read call
Adhemerval Zanella [Mon, 3 Jul 2017 17:20:46 +0000 (14:20 -0300)]
Consolidate non cancellable read call

This patch consolidates all the non cancellable read calls to use
the __read_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Also, since it is used on libcrypto it is also exported in GLIBC_PRIVATE
namespace.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* sysdeps/generic/not-cancel.h (read_not_cancel): Remove macro.
(__read_nocancel): New macro.
* sysdeps/unix/sysv/linux/Versions (libc) [GLIBC_PRIVATE]: Add
__read_nocancel.
* sysdeps/unix/sysv/linux/not-cancel.h (__read_nocancel): Remove
macro.
(__read_nocancel): New prototype.
* sysdeps/unix/sysv/linux/read.c (__read_nocancel): New function.
* catgets/open_catalog.c (__open_catalog): Replace read_not_cancel
with __read_nocancel.
* intl/loadmsgcat.c (read): Likewise.
* libio/fileops.c (_IO_file_read): Likewise.
* locale/loadlocale.c (_nl_load_locale): Likewise.
* login/utmp_file.c (getutent_r_file): Likewise.
(internal_getut_r): Likewise.
(getutline_r_file): Likewise.
* sysdeps/unix/sysv/linux/fips-private.h (fips_enable_p): Likewise.
* sysdeps/unix/sysv/linux/gethostid.c (gethostid): Likewise.
* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
Likewise.
* sysdeps/unix/sysv/linux/getsysstats.c (next_line): Likewise.
* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
Likewise.
* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps):
Likewise.
* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
Likewise.
* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
Likewise.
* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.

7 years agox86-64: Check FMA_Usable in ifunc-mathvec-avx2.h [BZ #21966]
H.J. Lu [Fri, 18 Aug 2017 13:18:55 +0000 (06:18 -0700)]
x86-64: Check FMA_Usable in ifunc-mathvec-avx2.h [BZ #21966]

Since the AVX2 version of mathvec functions uses FMA, it can only be
used when FMA is usable.

[BZ #21966]
* sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h
(IFUNC_SELECTOR): Don't use the AVX2 version if FMA isn't
usable.

7 years agoUse the range notation in charmaps/UTF-8 for all ranges of neighbouring characters...
Mike FABIAN [Fri, 18 Aug 2017 11:41:34 +0000 (13:41 +0200)]
Use the range notation in charmaps/UTF-8 for all ranges of neighbouring characters with the same width

[BZ #21750]
* charmaps/UTF-8: Use the range notation for all ranges
of neighbouring characters with the same width.

7 years agoUpdate nss tests to new skeleton
DJ Delorie [Thu, 17 Aug 2017 21:58:25 +0000 (17:58 -0400)]
Update nss tests to new skeleton

* bug17079.c: Update to new test harness.
* test-digits-dots.c: Likewise.
* test-netdb.c: Likewise.
* tst-field.c: Likewise.
* tst-nss-getpwent.c: Likewise.
* tst-nss-static.c: Likewise.
* tst-nss-test1.c: Likewise.
* tst-nss-test2.c: Likewise.
* tst-nss-test3.c: Likewise.
* tst-nss-test4.c: Likewise.
* tst-nss-test5.c: Likewise.

7 years agoConsolidate non cancellable open call
Adhemerval Zanella [Mon, 3 Jul 2017 14:11:24 +0000 (11:11 -0300)]
Consolidate non cancellable open call

This patch consolidates all the non cancellable open calls to use
the __open_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

To be consistent with the following non cancellable openat call, a
new __open64_nocancel is also added (although not currently used).

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

* sysdeps/generic/not-cancel.h (open_not_cancel): Remove macro.
(open_not_cancel_2): Likewise.
(open_nocancel): New macro.
(open64_nocancel): Likewise.
* sysdeps/unix/sysv/linux/not-cancel.h (open_not_cancel): Remove macro.
(open_not_cancel_2): Likewise.
(__open_nocancel): New prototype.
(__open64_nocancel): Likewise.
* sysdeps/unix/sysv/linux/Versions (libc) [GLIBC_PRIVATE]: Add
__open_nocancel.
* sysdeps/unix/sysv/linux/open.c (__open_nocancel): New function.
* sysdeps/unix/sysv/linux/open64.c (__open64_nocancel): Likewise.
* catgets/open_catalog.c (__open_catalog): Replace open_not_cancel{_2}
with __open_nocancel.
* csu/check_fds.c (check_one_fd): Likewise.
* gmon/gmon.c (write_gmon): Likewise.
* iconv/gconv_cache.c (__gconv_load_cached): Likewise.
* intl/loadmsgcat.c (open): Likewise.
* libio/fileops.c (_IO_file_open): Likewise.
* locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
* locale/loadlocale.c (_nl_load_locale): Likewise.
* login/utmp_file.c (setutent_file): Likewise.
* misc/daemon.c (daemon): Likewise.
* nss/nss_db/db-open.c (internal_setent): Likewise.
* sysdeps/mach/hurd/opendir.c (__opendirat): Likewise.
* sysdeps/posix/libc_fatal.c (__libc_message): Likewise.
* sysdeps/posix/opendir.c (tryopen_o_directory): Likewise.
(__opendir): Likewise.
* sysdeps/posix/spawni.c (__spawni_child): Likewise.
* sysdeps/unix/sysv/linux/fips-private.h (fips_enable_p): Likewise.
* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
(gethostid): Likewise.
* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
Likewise.
* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Likewise.
* sysdeps/unix/sysv/linux/grantpt.c (__close_all_fds): Likewise.
* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
Likewise.
* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps):
Likewise.
* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c (__get_clockfreq):
Likewise.
* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
Likewise.
* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
Likewise.
* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise.
* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.

7 years agoAdd math benchmark latency test
Wilco Dijkstra [Thu, 17 Aug 2017 15:27:20 +0000 (16:27 +0100)]
Add math benchmark latency test

This patch further improves math function benchmarking by adding a latency
test in addition to throughput.  This enables more accurate comparisons of the
math functions. The latency test works by creating a dependency on the previous
iteration: func_res = F (func_res * zero + input[i]). The multiply by zero
avoids changing the input.

It reports reciprocal throughput and latency in nanoseconds (depending on the
timing header used) and max/min throughput in iterations per second:

   "workload-spec2006.wrf": {
    "reciprocal-throughput": 100,
    "latency": 200,
    "max-throughput": 1.0e+07,
    "min-throughput": 5.0e+06
   }

* benchtests/bench-skeleton.c (main): Add support for
latency benchmarking.
* benchtests/scripts/bench.py: Add support for latency benchmarking.

7 years agoSupport mcount/gprof test with GCC defaulting to PIE
H.J. Lu [Thu, 17 Aug 2017 11:55:44 +0000 (04:55 -0700)]
Support mcount/gprof test with GCC defaulting to PIE

The mcount/gprof test should be linked with gcrt1.o, not Scrt1.o.

* Makeconfig (+link-pie-before-libc): Add CRT-* hook to override
the startup object.

7 years agoFix abmon for bem_ZM
Akhilesh Kumar [Wed, 16 Aug 2017 10:03:58 +0000 (15:33 +0530)]
Fix abmon for bem_ZM

Until now the abbreviated month names were in English.

[BZ #21960]
* locales/bem_ZM (LC_TIME): Fix abmon, make it agree with CLDR.

7 years agoFix country name for xh_ZA
Akhilesh Kumar [Wed, 16 Aug 2017 12:31:53 +0000 (18:01 +0530)]
Fix country name for xh_ZA

[BZ #21959]
* locales/xh_ZA (LC_ADDRESS): Fix country name.

7 years agoRefresh generated charmap data and ChangeLog
Thorsten Glaser [Fri, 14 Jul 2017 12:02:50 +0000 (14:02 +0200)]
Refresh generated charmap data and ChangeLog

[BZ #21750]
* charmaps/UTF-8: Refresh.

7 years agoResolve some historically special cases of ambiguous width
Thorsten Glaser [Fri, 14 Jul 2017 12:02:46 +0000 (14:02 +0200)]
Resolve some historically special cases of ambiguous width

[BZ #21750]
* unicode-gen/utf8_gen.py (U+00AD): Set width to 1.
* unicode-gen/utf8_gen.py (U+1160..U+11FF): Set width to 0.
* unicode-gen/utf8_gen.py (U+3248..U+324F): Set width to 2.
* unicode-gen/utf8_gen.py (U+4DC0..U+4DFF): Likewise.

7 years agoHandle more cases of combining characters
Thorsten Glaser [Fri, 14 Jul 2017 12:02:44 +0000 (14:02 +0200)]
Handle more cases of combining characters

[BZ #21750]
* unicode-gen/utf8_gen.py: Treat category Me and Mn as combining.

7 years agoUnicodeData has precedence over EastAsianWidth
Thorsten Glaser [Fri, 14 Jul 2017 12:02:37 +0000 (14:02 +0200)]
UnicodeData has precedence over EastAsianWidth

[BZ #19852]
[BZ #21750]
* unicode-gen/utf8_gen.py: Process EastAsianWidth lines before
  UnicodeData lines so the latter have precedence; remove hack
  to group output by EastAsianWidth ranges.

7 years ago__opensock: Remove internal_function attribute
Florian Weimer [Thu, 17 Aug 2017 08:18:04 +0000 (10:18 +0200)]
__opensock: Remove internal_function attribute

7 years agoFix sigval namespace (bug 21944).
Joseph Myers [Wed, 16 Aug 2017 20:33:59 +0000 (20:33 +0000)]
Fix sigval namespace (bug 21944).

XPG4.2 defines the siginfo_t type, but not union sigval or its
contents (which were added in the 1993 edition of POSIX.1), resulting
in namespace violations for sigval, sival_int and sival_ptr for
signal.h and sys/wait.h for that standard because those headers
incorrectly expose those names in that case.

This patch fixes this problem.  The public type in this case is union
sigval, but various places in the headers use the sigval_t name for
it; direct uses of union sigval are already properly guarded or in
headers not in XPG4.2.  Now, sigval_t, although not a standard name,
does seem to be widely used outside glibc.  The approach taken by this
patch is to make installed headers use the name __sigval_t instead.
__sigval_t is then defined to either union sigval or union __sigval
(where union __sigval has __-prefixed member names as well), depending
on whether there are any namespace issues with the union sigval name
and its members.  In the case where union __sigval is used, sigval_t
is not defined at all, to avoid the problem of sigval_t having a C++
mangled name that depends on feature test macros.  sigval_t is still
defined by signal.h if __USE_MISC (reflecting the nonstandard nature
of that name).

Tested for x86_64.

[BZ #21944]
* signal/bits/types/__sigval_t.h: New file.
* signal/Makefile (headers): Add bits/types/__sigval_t.h.
* signal/bits/types/sigval_t.h: Include <bits/types/__sigval_t.h>
and define sigval_t using __sigval_t.
* include/bits/types/__sigval_t.h: New file.
* bits/types/sigevent_t.h: Include <bits/types/__sigval_t.h>
instead of <bits/types/__sigval_t.h>.
(struct sigevent): Use __sigval_t instead of sigval_t.
* bits/types/siginfo_t.h: Include <bits/types/__sigval_t.h>
instead of <bits/types/__sigval_t.h>.
(siginfo_t): Use __sigval_t instead of sigval_t.
* sysdeps/unix/sysv/linux/bits/types/sigevent_t.h: Include
<bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>.
(struct sigevent): Use __sigval_t instead of sigval_t.
* sysdeps/unix/sysv/linux/bits/types/siginfo_t.h: Include
<bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>.
(siginfo_t): Use __sigval_t instead of sigval_t.
* signal/signal.h [__USE_MISC]: Include <bits/types/sigval_t.h>.

7 years agoRemove "[Add new features here]" for 2.27
H.J. Lu [Wed, 16 Aug 2017 18:05:55 +0000 (11:05 -0700)]
Remove "[Add new features here]" for 2.27

* NEWS: Remove "[Add new features here]" for 2.27.

7 years agoAllow abort PLT references in libc.so for SH.
Joseph Myers [Wed, 16 Aug 2017 17:01:27 +0000 (17:01 +0000)]
Allow abort PLT references in libc.so for SH.

Given my patch
<https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00965.html> for the
ICEs building a glibc string function test for SH, the testsuite can
build completely for SH with GCC 7 and mainline.  However, there is a
test failure that does not appear for GCC 6: check-localplt fails
because of an abort PLT reference in libc.so.

Given the lack of a trap insn pattern for SH, it seems unavoidable
that the compiler might sometimes generate abort calls, and such abort
calls (generated from __builtin_trap when there is no trap insn
pattern) will be unaffected by the normal mapping to __GI_abort for
calls within glibc.  Thus, this patch allows (but does not require) an
abort PLT reference in libc.so for SH.

Tested for sh4-linux-gnu with build-many-glibcs.py (GCC 7, with my
patch applied).

* sysdeps/unix/sysv/linux/sh/localplt.data: Allow abort in
libc.so.

7 years agoMention x86-64 FMA optimization in NEWS
H.J. Lu [Wed, 16 Aug 2017 16:17:34 +0000 (09:17 -0700)]
Mention x86-64 FMA optimization in NEWS

* NEWS: Mention x86-64 FMA optimization.

7 years agox86-64: Optimize e_expf with FMA [BZ #21912]
H.J. Lu [Wed, 16 Aug 2017 15:43:35 +0000 (08:43 -0700)]
x86-64: Optimize e_expf with FMA [BZ #21912]

FMA optimized e_expf improves performance by more than 50% on Skylake.

[BZ #21912]
* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
Add e_expf-fma.
* sysdeps/x86_64/fpu/multiarch/e_expf-fma.S: New file.
* sysdeps/x86_64/fpu/multiarch/e_expf.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/ifunc-fma.h: Likewise.

7 years agoAdd ChangeLog reference to bug 16750/CVE-2009-5064
Florian Weimer [Wed, 16 Aug 2017 14:47:20 +0000 (16:47 +0200)]
Add ChangeLog reference to bug 16750/CVE-2009-5064

7 years agoldd: never run file directly
Andreas Schwab [Wed, 16 Aug 2017 13:59:55 +0000 (15:59 +0200)]
ldd: never run file directly

7 years agox86-64: Align L(SP_RANGE)/L(SP_INF_0) to 8 bytes [BZ #21955]
H.J. Lu [Tue, 15 Aug 2017 21:04:59 +0000 (14:04 -0700)]
x86-64: Align L(SP_RANGE)/L(SP_INF_0) to 8 bytes [BZ #21955]

sysdeps/x86_64/fpu/e_expf.S has

        lea     L(SP_RANGE)(%rip), %rdx /* load over/underflow bound */
        cmpl    (%rdx,%rax,4), %ecx     /* |x|<under/overflow bound ? */
...
        /* Here if |x| is Inf */
        lea     L(SP_INF_0)(%rip), %rdx /* depending on sign of x: */
        movss   (%rdx,%rax,4), %xmm0    /* return zero or Inf */
        ret
...
         .section .rodata.cst8,"aM",@progbits,8
...
        .p2align 2
L(SP_RANGE): /* single precision overflow/underflow bounds */
        .long   0x42b17217      /* if x>this bound, then result overflows */
        .long   0x42cff1b4      /* if x<this bound, then result underflows */
        .type L(SP_RANGE), @object
        ASM_SIZE_DIRECTIVE(L(SP_RANGE))

        .p2align 2
L(SP_INF_0):
        .long   0x7f800000      /* single precision Inf */
        .long   0               /* single precision zero */
        .type L(SP_INF_0), @object
        ASM_SIZE_DIRECTIVE(L(SP_INF_0))

Since L(SP_RANGE) and L(SP_INF_0) are in .rodata.cst8 section, they must
be aligned to 8 bytes.

[BZ #21955]
* sysdeps/x86_64/fpu/e_expf.S (L(SP_RANGE)): Aligned to 8 bytes.
(L(SP_INF_0)): Likewise.

7 years agogmon: Run tst-gmon-prof only for run-built-tests=yes
Florian Weimer [Tue, 15 Aug 2017 16:35:42 +0000 (18:35 +0200)]
gmon: Run tst-gmon-prof only for run-built-tests=yes

7 years agoaio: Remove support for BROKEN_THREAD_SIGNALS
Florian Weimer [Tue, 15 Aug 2017 15:28:37 +0000 (17:28 +0200)]
aio: Remove support for BROKEN_THREAD_SIGNALS

This was originally added to support LinuxThreads and is not needed for
NPTL.

7 years agogmon: Add test for basic mcount/gprof functionality
Florian Weimer [Tue, 15 Aug 2017 13:49:40 +0000 (15:49 +0200)]
gmon: Add test for basic mcount/gprof functionality

7 years agopowerpc: Add values from Linux 4.8 to <elf.h>
Gustavo Romero [Tue, 15 Aug 2017 13:17:30 +0000 (10:17 -0300)]
powerpc: Add values from Linux 4.8 to <elf.h>

Add powerpc specific note sections available since Linux v4.8.

* elf/elf.h A (NT_PPC_TAR): New macro.
(NT_PPC_PPR): Likewise.
(NT_PPC_DSCR): Likewise.
(NT_PPC_EBB): Likewise.
(NT_PPC_PMU): Likewise.
(NT_PPC_TM_CGPR): Likewise.
(NT_PPC_TM_CFPR): Likewise.
(NT_PPC_TM_CVMX): Likewise.
(NT_PPC_TM_CVSX): Likewise.
(NT_PPC_TM_SPR): Likewise.
(NT_PPC_TM_CTAR): Likewise.
(NT_PPC_TM_CPPR): Likewise.
(NT_PPC_TM_CDSCR): Likewise.

7 years agoi386: Replace internal_function attribute for __mcount_internal
Florian Weimer [Tue, 15 Aug 2017 12:46:19 +0000 (14:46 +0200)]
i386: Replace internal_function attribute for __mcount_internal

__mcount_internal is called from assembler code.  Use an explicit
regparm attribute to pass both arguments in registers, to match what
used to happen with internal_function before commit
fbdc1e3e8de7f49e439b6e274d3e7e07da78416e (i386: Do not set
internal_function).

7 years agoS390: Add new s390 platform z14.
Stefan Liebler [Tue, 15 Aug 2017 12:00:07 +0000 (14:00 +0200)]
S390: Add new s390 platform z14.

The new IBM z14 is added to platform string array.
The macro _DL_PLATFORMS_COUNT is incremented.

ChangeLog:

* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags): Add z14.
* sysdeps/s390/dl-procinfo.h (_DL_PLATFORMS_COUNT): Increased.

7 years agoChange language name in LC_IDENTIFICATION of bn_BD and bn_IN from “Bengali” to “Bangla”
Mike FABIAN [Mon, 14 Aug 2017 17:48:27 +0000 (19:48 +0200)]
Change language name in LC_IDENTIFICATION of bn_BD and bn_IN from “Bengali” to “Bangla”

[BZ #14925]
* locales/bn_BD (LC_IDENTIFICATION): Change language name in
“title” and “language” from Bengali to Bangla.
* locales/bn_IN (LC_IDENTIFICATION): Likewise.

7 years agoUse “copy "i18n"” in km_KH locale
Mike FABIAN [Mon, 14 Aug 2017 17:05:17 +0000 (19:05 +0200)]
Use “copy "i18n"” in km_KH locale

The custom stuff which was in LC_CTYPE of the km_KH locale seems
to be a very incomplete subset of what one gets by using
“copy "i18n"”. I cannot find anything special there which is not
in “copy "i18n"”, only lots of stuff which is missing.

[BZ #20008]
* locales/km_KH (LC_CTYPE): Use “copy "i18n"”.

7 years agoconformtest: Disable si_value expectation for XPG42.
Joseph Myers [Mon, 14 Aug 2017 17:05:55 +0000 (17:05 +0000)]
conformtest: Disable si_value expectation for XPG42.

This patch corrects the conform/ expectations for sys/wait.h not to
expect si_value for XPG4.2.

Tested for x86_64.

* conform/data/sys/wait.h-data (si_value): Do not expect for
XPG42.

7 years agoNSS: Replace exported NSS lookup functions with stubs [BZ #21962]
Florian Weimer [Mon, 14 Aug 2017 15:12:05 +0000 (17:12 +0200)]
NSS: Replace exported NSS lookup functions with stubs [BZ #21962]

Commit 384ca551743318bd9c9e24a496d6397f2e3f2a49 from 2007 added this to
nss/XXX-lookup.c:

+#ifndef NO_COMPAT
+int
+internal_function attribute_compat_text_section
+DB_COMPAT_FCT (service_user **ni, const char *fct_name, void **fctp)
+{
+  return DB_LOOKUP_FCT (ni, fct_name, NULL, fctp);
+}
+#endif

That is, it adds a pseudo-compat function with an internal_function
attribute.  The function it was supposed to replace did not have the
attribute:

 extern int DB_LOOKUP_FCT (service_user **ni, const char *fct_name,
-   void **fctp) internal_function;
+   const char *fct2_name, void **fctp)
+  internal_function;

This changed the calling convention on i386 for the following
functions in the public ABI:

  __nss_passwd_lookup
  __nss_group_lookup
  __nss_hosts_lookup

This commit replaces the functions with always-failing stubs,
with true compat symbols.  Due to a happy accident, the calling
convention of the stub is identical for the internal_function
and non-internal_function case on i386.

In addition, this commit auto-generates the __nss_*_lookup2
function declarations as part of <nsswitch.h>.

7 years agoUse two letter abbreviations in abday in all German locales.
Mike FABIAN [Mon, 14 Aug 2017 15:12:37 +0000 (17:12 +0200)]
Use two letter abbreviations in abday in all German locales.

[BZ #20482]
* locales/de_AT (LC_TIME): Use 2 letter abbreviations in abday.
* locales/de_BE (LC_TIME): Use 2 letter abbreviations in abday.
* locales/de_CH (LC_TIME): Use 2 letter abbreviations in abday.
* locales/de_DE (LC_TIME): Use readable ASCII in abday.
* locales/de_IT (LC_TIME): Use readable ASCII in abday.
* locales/de_LU (LC_TIME): Use 2 letter abbreviations in abday.

7 years agoFix thousands_sep and grouping and use readable ASCII for decimal_point in eu_ES...
Julen Ruiz Aizpuru [Mon, 14 Aug 2017 13:56:00 +0000 (15:56 +0200)]
Fix thousands_sep and grouping and use readable ASCII for decimal_point in eu_ES locale

[BZ #12349]
* locales/eu_ES (LC_NUMERIC): Fix thousands_sep and grouping
and use readable ASCII for decimal_point.

7 years agoposix: Fix mmap for m68k and ia64 (BZ#21908)
Adhemerval Zanella [Sun, 6 Aug 2017 14:14:32 +0000 (11:14 -0300)]
posix: Fix mmap for m68k and ia64 (BZ#21908)

Default semantic for mmap2 syscall is to take the offset in 4096-byte
units.  However m68k and ia64 mmap2 implementation take in the
configured pageunit units and for both architecture it can be
different values.

This patch fixes the m68k runtime discover of mmap2 offset unit
and adds the ia64 definition to find it at runtime.

Checked the basic tst-mmap and tst-mmap-offset on m68k (the system
is configured with 4k, so current code is already passing on this
system) and a sanity check on x86_64-linux-gnu (which should not be
affected by this change).  Sergei also states that ia64 loader now
work correctly with this change.

Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Sergei Trofimovich  <slyfox@inbox.ru>

* sysdeps/unix/sysv/linux/m68k/mmap_internal.h (MMAP2_PAGE_SHIFT):
Rename to MMAP2_PAGE_UNIT.
* sysdeps/unix/sysv/linux/mmap.c: Include mmap_internal iff
__OFF_T_MATCHES_OFF64_T is not defined.
* sysdeps/unix/sysv/linux/mmap_internal.h (page_unit): Declare as
uint64_t.
(MMAP2_PAGE_UNIT) [MMAP2_PAGE_UNIT == -1]: Redefine to page_unit.
(page_unit) [MMAP2_PAGE_UNIT != -1]: Remove definition.

7 years agoi386: Do not set internal_function
Florian Weimer [Mon, 14 Aug 2017 11:03:34 +0000 (13:03 +0200)]
i386: Do not set internal_function

All calls to functions with the internal_function attribute
have been removed from assembler implementations, which means that
the definition of internal_function can be changed at the C level
without causing ABI issues with assembler code.

_dl_fixup still uses a regparm calling convention on i386, but this
is controlled through ARCH_FIXUP_ATTRIBUTE, not internal_function.

7 years ago_dl_init: Remove internal_function attribute
Florian Weimer [Mon, 14 Aug 2017 10:57:50 +0000 (12:57 +0200)]
_dl_init: Remove internal_function attribute

The function is called from the i386 startup code, which needs minor
adjustments due to the changed ABI.

7 years ago_dl_start: Remove internal_function attribute
Florian Weimer [Mon, 14 Aug 2017 10:29:21 +0000 (12:29 +0200)]
_dl_start: Remove internal_function attribute

The i386 startup code needs adjusting because it calls the function
and the ABI has changed.

7 years ago_dl_fini: Remove internal_function attribute
Florian Weimer [Mon, 14 Aug 2017 09:44:24 +0000 (11:44 +0200)]
_dl_fini: Remove internal_function attribute

Assembler code passes the address of _dl_fini to __libc_start_main,
whose function pointer argument lacks the attribute.  This means
that calls could use the wrong ABI.  Fortunately, for zero-parameter
void-returning functions, internal_function does not change ABI
on i386 (the only architecture which uses internal_function), so
this inconsistency was harmless (which is why it had not been
noticed so far).

7 years agox86: Add IBT/SHSTK bits to cpu-features
H.J. Lu [Mon, 14 Aug 2017 12:54:25 +0000 (05:54 -0700)]
x86: Add IBT/SHSTK bits to cpu-features

Add IBT/SHSTK bits to cpu-features for Shadow Stack in Intel Control-flow
Enforcement Technology (CET) instructions:

https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf

* sysdeps/x86/cpu-features.h (bit_cpu_BIT): New.
(bit_cpu_SHSTK): Likewise.
(index_cpu_IBT): Likewise.
(index_cpu_SHSTK): Likewise.
(reg_IBT): Likewise.
(reg_SHSTK): Likewise.
* sysdeps/x86/cpu-tunables.c (TUNABLE_CALLBACK (set_hwcaps)):
Handle index_cpu_IBT and index_cpu_SHSTK.

7 years agoFix spelling mistake in fr.po
Mike FABIAN [Mon, 14 Aug 2017 07:25:56 +0000 (09:25 +0200)]
Fix spelling mistake in fr.po

[BZ #19982]
* po/fr.po: Fix spelling mistake.

7 years agold.so: Remove internal_function attribute from various functions
Florian Weimer [Sun, 13 Aug 2017 19:11:54 +0000 (21:11 +0200)]
ld.so: Remove internal_function attribute from various functions

These functions are invoked from other DSOs and should therefore
use the standard calling convention.

7 years agoRemove internal_function attribute from string-to-float functions
Florian Weimer [Sun, 13 Aug 2017 19:11:47 +0000 (21:11 +0200)]
Remove internal_function attribute from string-to-float functions

These are called across DSO boundaries and should therefore use
the standard calling convention.

7 years agoNPTL: Remove internal_function from stack marking functions
Florian Weimer [Sun, 13 Aug 2017 19:11:38 +0000 (21:11 +0200)]
NPTL: Remove internal_function from stack marking functions

These are called across DSO boundaries and therefore should use
the ABI calling convention.

7 years ago__netlink_assert_response: Remove internal_function attribute
Florian Weimer [Sun, 13 Aug 2017 19:11:28 +0000 (21:11 +0200)]
__netlink_assert_response: Remove internal_function attribute

This function is called from nscd and should not use a non-standard
calling convention.

7 years ago__libc_rpc_getport: Remove internal_function attribute
Florian Weimer [Sun, 13 Aug 2017 19:11:06 +0000 (21:11 +0200)]
__libc_rpc_getport: Remove internal_function attribute

This function has a hidden alias and is therefore expected to be
called across DSO boundaries.

7 years agoNSS: Do not use internal_function for functions with hidden aliases
Florian Weimer [Sun, 13 Aug 2017 19:10:56 +0000 (21:10 +0200)]
NSS: Do not use internal_function for functions with hidden aliases

Such functions are called across DSO boundaries and should not
use a non-standard ABI.

7 years ago__fortify_fail: Remove internal_function attribute
Florian Weimer [Sun, 13 Aug 2017 19:10:44 +0000 (21:10 +0200)]
__fortify_fail: Remove internal_function attribute

__fortify_fail is called across DSO boundaries, so it should not
use a non-standard calling convention.

7 years agoAdapt test case data to the changes in the thousands separators
Mike FABIAN [Sat, 12 Aug 2017 15:15:25 +0000 (17:15 +0200)]
Adapt test case data to the changes in the thousands separators

[BZ #20756]
* localedata/tst-langinfo.sh: Adapt test case data.
* stdlib/tst-strfmon_l.c: Likewise.
* stdlib/tst-strtod4.c: Likewise.
* stdlib/tst-strtod5i.c: Likewise.

7 years agoUse U+202F instead of U+2009 as thousands_sep for es_MX
Mike FABIAN [Sat, 12 Aug 2017 13:34:36 +0000 (15:34 +0200)]
Use U+202F instead of U+2009 as thousands_sep for es_MX

See also [BZ #20756].

U+202F NARROW NO-BREAK SPACE: a narrow form of a no-break space,
typically the width of a thin space or a mid space.

U+2009 THIN SPACE.

7 years agoLocales: Use Unicode wise thousands separator
Stanislav Brabec [Wed, 2 Nov 2016 15:52:58 +0000 (16:52 +0100)]
Locales: Use Unicode wise thousands separator

Many languages use small gap as thousands separator.

Thousands separator should not be a plain space, but a narrow space.
And additionally, it is not allowed to wrap line in the middle of the
number.

Locale data were created in a deep age of 8-bit encodings, so most of
them use space (incorrect: it allows wrapping the line in the middle
of the number), or NBSP (better, but typographically incorrect: space
between groups is too wide).

Now UNICODE is widely supported, so we should leave legacy characters
in favor of correct UNICODE character.

UNICODE has a dedicated character for this purpose:

NNBSP
U+202F NARROW NO-BREAK SPACE: a narrow form of a no-break space,
typically the width of a thin space or a mid space

The NNBSP exists since Unicode 3.0.

Use of NNBSP will prevent line wrapping in the midle of number and
improve readability of numbers.

[BZ #20756]
* locales/aa_DJ (LC_MONETARY): Replace space by NNBSP as thousands separator.
* locales/az_AZ (LC_MONETARY): Likewise.
* locales/be_BY (LC_MONETARY): Likewise.
* locales/be_BY@latin (LC_MONETARY): Likewise.
* locales/bg_BG (LC_MONETARY): Likewise.
* locales/bs_BA (LC_MONETARY): Likewise.
* locales/ce_RU (LC_MONETARY): Likewise.
* locales/crh_UA (LC_MONETARY): Likewise.
* locales/cs_CZ (LC_MONETARY): Likewise.
* locales/cs_CZ (LC_NUMERIC): Likewise.
* locales/cv_RU (LC_MONETARY): Likewise.
* locales/de_AT (LC_MONETARY): Likewise.
* locales/eo (LC_MONETARY): Likewise.
* locales/es_CR (LC_MONETARY): Likewise.
* locales/es_CR (LC_NUMERIC): Likewise.
* locales/es_CU (LC_MONETARY): Likewise.
* locales/et_EE (LC_MONETARY): Likewise.
* locales/et_EE (LC_NUMERIC): Likewise.
* locales/fi_FI (LC_MONETARY): Likewise.
* locales/fi_FI (LC_NUMERIC): Likewise.
* locales/fr_CA (LC_MONETARY): Likewise.
* locales/fr_FR (LC_MONETARY): Likewise.
* locales/fr_FR (LC_NUMERIC): Likewise.
* locales/fr_LU (LC_MONETARY): Likewise.
* locales/fr_LU (LC_NUMERIC): Likewise.
* locales/hr_HR (LC_MONETARY): Likewise.
* locales/ht_HT (LC_NUMERIC): Likewise.
* locales/kk_KZ (LC_MONETARY): Likewise.
* locales/kk_KZ (LC_NUMERIC): Likewise.
* locales/ky_KG (LC_MONETARY): Likewise.
* locales/ky_KG (LC_NUMERIC): Likewise.
* locales/lv_LV (LC_MONETARY): Likewise.
* locales/lv_LV (LC_NUMERIC): Likewise.
* locales/mg_MG (LC_MONETARY): Likewise.
* locales/mhr_RU (LC_MONETARY): Likewise.
* locales/mk_MK (LC_MONETARY): Likewise.
* locales/mk_MK (LC_NUMERIC): Likewise.
* locales/mn_MN (LC_MONETARY): Likewise.
* locales/nb_NO (LC_MONETARY): Likewise.
* locales/nb_NO (LC_NUMERIC): Likewise.
* locales/nl_AW (LC_MONETARY): Likewise.
* locales/nl_NL (LC_MONETARY): Likewise.
* locales/nn_NO (LC_MONETARY): Likewise.
* locales/os_RU (LC_MONETARY): Likewise.
* locales/pap_AW (LC_MONETARY): Likewise.
* locales/pap_CW (LC_MONETARY): Likewise.
* locales/ru_RU (LC_MONETARY): Likewise.
* locales/ru_RU (LC_NUMERIC): Likewise.
* locales/ru_UA (LC_MONETARY): Likewise.
* locales/sk_SK (LC_MONETARY): Likewise.
* locales/sk_SK (LC_NUMERIC): Likewise.
* locales/sl_SI (LC_MONETARY): Likewise.
* locales/sl_SI (LC_NUMERIC): Likewise.
* locales/sq_MK (LC_MONETARY): Likewise.
* locales/sv_SE (LC_MONETARY): Likewise.
* locales/sv_SE (LC_NUMERIC): Likewise.
* locales/tg_TJ (LC_MONETARY): Likewise.
* locales/tt_RU (LC_MONETARY): Likewise.
* locales/tt_RU@iqtelif (LC_MONETARY): Likewise.
* locales/uk_UA (LC_MONETARY): Likewise.
* locales/uk_UA (LC_NUMERIC): Likewise.
* locales/unm_US (LC_MONETARY): Likewise.
* locales/unm_US (LC_NUMERIC): Likewise.
* locales/wo_SN (LC_MONETARY): Likewise.

7 years agoassert: Suppress pedantic warning caused by statement expression
Florian Weimer [Fri, 11 Aug 2017 13:36:08 +0000 (15:36 +0200)]
assert: Suppress pedantic warning caused by statement expression

7 years agobenchtests: Print json in memmove benchmark
Siddhesh Poyarekar [Fri, 11 Aug 2017 06:47:46 +0000 (12:17 +0530)]
benchtests: Print json in memmove benchmark

Make the memmove benchmarks (bench-memmove and bench-memmove-large)
print their output in JSON so that they can be evaluated using the
compare_strings.py script.

* benchtests/bench-memmove-large.c: Print output in JSON
format.
* benchtests/bench-memmove.c: Likewise.

7 years agobenchtests: Remove verification runs from benchmark tests
Siddhesh Poyarekar [Fri, 11 Aug 2017 06:47:24 +0000 (12:17 +0530)]
benchtests: Remove verification runs from benchmark tests

The test run is unnecessary and interferes with the benchmark.  The
tests are done during make check, so they're unnecessary here.

* benchtests/bench-memccpy.c (do_one_test): Remove checks.
* benchtests/bench-memchr.c (do_one_test): Likewise.
* benchtests/bench-memcpy-large.c (do_one_test): Likewise.
* benchtests/bench-memcpy.c (do_one_test): Likewise.
* benchtests/bench-memmove-large.c (do_one_test): Likewise.
* benchtests/bench-memmove.c (do_one_test): Likewise.
* benchtests/bench-memset-large.c (do_one_test): Likewise.
* benchtests/bench-memset.c (do_one_test): Likewise.
* benchtests/bench-string.h (test_init): Remove memsets.

7 years agomanual: Rewrite the section on widths of integer types.
Rical Jasan [Thu, 27 Jul 2017 12:04:48 +0000 (05:04 -0700)]
manual: Rewrite the section on widths of integer types.

The manual contradicted itself by saying the number of bits in an
integer type needed to be computed, and then listing a number of
macros that later standards provided for exactly that.  The entire
section has been reworked to provide those macros first, while
preserving the documentation of CHAR_BIT and the associated examples
within that context.

* manual/lang.texi
(Computing the Width of an Integer Data Type): Rename section
to "Width of an Integer Type".  Remove inaccurate statement
regarding lack of C language facilities for determining width
of integer types, and reorder content to improve flow and
context of discussion.

7 years agomanual: Update @standards for [__]va_copy.
Rical Jasan [Tue, 20 Jun 2017 10:46:24 +0000 (03:46 -0700)]
manual: Update @standards for [__]va_copy.

The ISO version in which va_copy was introduced is made explicit, and
__va_copy is given @standards.  The description is updated to be more
clear about the origins of each macro, and the reader is informed
these macros are now provided by the compiler (information previously
embedded in a Texinfo @comment).

* lang.texi (va_copy): Change standard from ISO to C99.
(__va_copy): Add standard and header annotation.
Update description for clarity of origins and current use.

7 years agopowerpc: Restrict xssqrtqp operands to Vector Registers (bug 21941)
Gabriel F. T. Gomes [Mon, 7 Aug 2017 12:14:14 +0000 (09:14 -0300)]
powerpc: Restrict xssqrtqp operands to Vector Registers (bug 21941)

POWER ISA 3.0 introduces the xssqrtqp instructions, which expects
operands to be in Vector Registers (Altivec/VMX), even though this
instruction belongs to the Vector-Scalar Instruction Set.

In GCC's Extended Assembly for POWER, the 'wq' register constraint is
provided for use with IEEE 754 128-bit floating-point values.  However,
this constraint does not limit the register allocation to Vector
Registers (Altivec/VMX) and could assign a Vector-Scalar Register (VSX)
to the operands of the instruction.

This patch changes the register constraint used in sqrtf128 from 'wq' to
'v', in order to request a Vector Register (Altivec/VMX) for use with
the xssqrtqp instruction.

Tested for powerpc64le and --with-cpu=power9.

[BZ #21941]
* sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrtf128): Since
xssqrtqp requires operands to be in Vector Registers
(Altivec/VMX), replace the register constraint 'wq' with 'v'.
* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
(__ieee754_sqrtf128): Likewise.