]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
7 years agoresolv: Deprecate unimplemented flags
Florian Weimer [Fri, 7 Oct 2016 15:41:45 +0000 (17:41 +0200)] 
resolv: Deprecate unimplemented flags

RES_AAONLY, RES_PRIMARY, RES_NOCHECKNAME, RES_KEEPTSIG result
in compile-time warnings.  Some of these flags are still used in
applications.

7 years agoUse libc_ifunc macro for siglongjmp, longjmp in libpthread.
Stefan Liebler [Fri, 7 Oct 2016 07:56:48 +0000 (09:56 +0200)] 
Use libc_ifunc macro for siglongjmp, longjmp in libpthread.

This patch uses the libc_ifunc macro to create already existing ifunc functions
longjmp_ifunc, siglongjmp_ifunc if HAVE_IFUNC is defined.
The s390 pt-longjmp.c includes the common pt-longjmp.c and uses strong_alias
to create the longjmp, siglongjmp symbols for glibc version 2.19.

ChangeLog:

* nptl/pt-longjmp.c (DEFINE_LONGJMP): Use libc_ifunc macro.
* sysdeps/unix/sysv/linux/s390/pt-longjmp.c (longjmp, siglongjmp):
Use strong_alias to create symbols for glibc verison 2.19.

7 years agoUse libc_ifunc macro for vfork in libpthread.
Stefan Liebler [Fri, 7 Oct 2016 07:56:47 +0000 (09:56 +0200)] 
Use libc_ifunc macro for vfork in libpthread.

This patch uses the libc_ifunc macro to create already existing ifunc functions
vfork_ifunc and __vfork_ifunc if HAVE_IFUNC is defined.

ChangeLog:

* nptl/pt-vfork.c (DEFINE_VFORK): Use libc_ifunc macro.

7 years agoUse libc_ifunc macro for system in libpthread.
Stefan Liebler [Fri, 7 Oct 2016 07:56:47 +0000 (09:56 +0200)] 
Use libc_ifunc macro for system in libpthread.

This patch uses the libc_ifunc macro to create already existing ifunc function
system_ifunc if HAVE_IFUNC is defined.

ChangeLog:

* nptl/pt-system.c (system_ifunc): Use libc_ifunc macro.

7 years agoUse libc_ifunc macro for clock_* symbols in librt.
Stefan Liebler [Fri, 7 Oct 2016 07:56:47 +0000 (09:56 +0200)] 
Use libc_ifunc macro for clock_* symbols in librt.

This patch uses the libc_ifunc macro to create already existing ifunc functions
clock_getres, clock_gettime, clock_settime, clock_getcpuclockid and
clock_nanosleep. If HAVE_IFUNC is defined, the macro COMPAT_REDIRECT uses
the libc_ifunc macro.
Furthermore some whitespace damage is cleaned.

ChangeLog:

* rt/clock-compat.c (COMPAT_REDIRECT): Use libc_ifunc macro.

7 years agoppc: Use libc_ifunc macro for time, gettimeofday.
Stefan Liebler [Fri, 7 Oct 2016 07:56:47 +0000 (09:56 +0200)] 
ppc: Use libc_ifunc macro for time, gettimeofday.

This patch uses the libc_ifunc_hidden macro to create already existing ifunc functions
time and gettimeofday on power. This way, the libc_hidden_def macro can be used
instead of inline assemblies.
On ppc32, the __GI_* symbols do not target the ifunc symbol and thus the
redirection construct has to be applied here.

ChangeLog:

* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c (__gettimeofday):
Use libc_ifunc_hidden and libc_hidden_def macro. Redirect ifunced function
in header for using it as type for ifunc function because __GI_* symbols
for ppc32 do not target the ifunc symbols.
* sysdeps/unix/sysv/linux/powerpc/time.c (time): Likewise.

7 years agoi386, x86: Use libc_ifunc macro for time, gettimeofday.
Stefan Liebler [Fri, 7 Oct 2016 07:56:47 +0000 (09:56 +0200)] 
i386, x86: Use libc_ifunc macro for time, gettimeofday.

This patch uses the libc_ifunc_hidden macro to create already existing ifunc functions
time and gettimeofday on intel. This way, the libc_hidden_def macro can be used
instead of the libc_ifunc_hidden_def one which was only used here. Thus the
macro is removed from libc-symbols.h.
On i386, the __GI_* symbols do not target the ifunc symbol and thus the
redirection construct has to be applied here.

ChangeLog:

* sysdeps/unix/sysv/linux/x86/gettimeofday.c (__gettimeofday):
Use libc_ifunc_hidden macro. Use libc_hidden_def instead of
libc_ifunc_hidden_def.
* sysdeps/unix/sysv/linux/x86/time.c (time): Likewise.
* sysdeps/unix/sysv/linux/i386/gettimeofday.c (__gettimeofday):
Redirect ifunced function in header for using it as type of ifunc'ed
function. Redefine libc_hidden_def to use fallback non ifunc'ed
function for __GI_* symbol.
* sysdeps/unix/sysv/linux/i386/time.c (time): Likewise.
* include/libc-symbols.h
(libc_ifunc_hidden_def, libc_ifunc_hidden_def1): Delete macro.

7 years agos390: Refactor ifunc resolvers due to false debuginfo.
Stefan Liebler [Fri, 7 Oct 2016 07:56:47 +0000 (09:56 +0200)] 
s390: Refactor ifunc resolvers due to false debuginfo.

This patch adjusts the s390 specific ifunc helper macros in ifunc-resolve.h to
use the common __ifunc macro, which uses gcc attribute ifunc to get rid of the
false debuginfo. Therefore the redirection construct is applied where needed.

Perhaps in future we can switch some of the internal symbols __GI_* from the
fallback variant to the ifunc function. But this change is not
straightforward due to a segmentation fault while linking libc.so with older
binutils on s390.

ChangeLog:

[BZ #20478]
* sysdeps/s390/multiarch/ifunc-resolve.h
(s390_vx_libc_ifunc2, s390_libc_ifunc): Use __ifunc from libc-symbols.h
to create ifunc symbols.
(s390_vx_libc_ifunc_init, s390_vx_libc_ifunc_redirected
, s390_vx_libc_ifunc2_redirected, s390_libc_ifunc_init): New define.
* sysdeps/s390/multiarch/memchr.c: Redirect ifunced function in header
for using it as type for ifunc function.
* sysdeps/s390/multiarch/mempcpy.c: Likewise.
* sysdeps/s390/multiarch/rawmemchr.c: Likewise.
* sysdeps/s390/multiarch/stpcpy.c: Likewise.
* sysdeps/s390/multiarch/stpncpy.c: Likewise.
* sysdeps/s390/multiarch/strcat.c: Likewise.
* sysdeps/s390/multiarch/strchr.c: Likewise.
* sysdeps/s390/multiarch/strcmp.c: Likewise.
* sysdeps/s390/multiarch/strcpy.c: Likewise.
* sysdeps/s390/multiarch/strcspn.c: Likewise.
* sysdeps/s390/multiarch/strlen.c: Likewise.
* sysdeps/s390/multiarch/strncmp.c: Likewise.
* sysdeps/s390/multiarch/strncpy.c: Likewise.
* sysdeps/s390/multiarch/strnlen.c: Likewise.
* sysdeps/s390/multiarch/strpbrk.c: Likewise.
* sysdeps/s390/multiarch/strrchr.c: Likewise.
* sysdeps/s390/multiarch/strspn.c: Likewise.
* sysdeps/s390/multiarch/wcschr.c: Likewise.
* sysdeps/s390/multiarch/wcscmp.c: Likewise.
* sysdeps/s390/multiarch/wcspbrk.c: Likewise.
* sysdeps/s390/multiarch/wcsspn.c: Likewise.
* sysdeps/s390/multiarch/wmemchr.c: Likewise.
* sysdeps/s390/multiarch/wmemset.c: Likewise.
* sysdeps/s390/s390-32/multiarch/memcmp.c: Likewise.
* sysdeps/s390/s390-32/multiarch/memcpy.c: Likewise.
* sysdeps/s390/s390-32/multiarch/memset.c: Likewise.
* sysdeps/s390/s390-64/multiarch/memcmp.c: Likewise.
* sysdeps/s390/s390-64/multiarch/memcpy.c: Likewise.
* sysdeps/s390/s390-64/multiarch/memset.c: Likewise.

7 years agoUse gcc attribute ifunc in libc_ifunc macro instead of inline assembly due to false...
Stefan Liebler [Fri, 7 Oct 2016 07:56:46 +0000 (09:56 +0200)] 
Use gcc attribute ifunc in libc_ifunc macro instead of inline assembly due to false debuginfo.

The current s390 ifunc resolver for vector optimized functions and the common
libc_ifunc macro in include/libc-symbols.h uses something like that to generate ifunc'ed functions:
extern void *__resolve___strlen(unsigned long int dl_hwcap) asm (strlen);
asm (".type strlen, %gnu_indirect_function");

This leads to false debug information:
objdump --dwarf=info libc.so:
...
<1><1e6424>: Abbrev Number: 43 (DW_TAG_subprogram)
    <1e6425>   DW_AT_external    : 1
    <1e6425>   DW_AT_name        : (indirect string, offset: 0x1146e): __resolve___strlen
    <1e6429>   DW_AT_decl_file   : 1
    <1e642a>   DW_AT_decl_line   : 23
    <1e642b>   DW_AT_linkage_name: (indirect string, offset: 0x1147a): strlen
    <1e642f>   DW_AT_prototyped  : 1
    <1e642f>   DW_AT_type        : <0x1e4ccd>
    <1e6433>   DW_AT_low_pc      : 0x998e0
    <1e643b>   DW_AT_high_pc     : 0x16
    <1e6443>   DW_AT_frame_base  : 1 byte block: 9c     (DW_OP_call_frame_cfa)
    <1e6445>   DW_AT_GNU_all_call_sites: 1
    <1e6445>   DW_AT_sibling     : <0x1e6459>
 <2><1e6449>: Abbrev Number: 44 (DW_TAG_formal_parameter)
    <1e644a>   DW_AT_name        : (indirect string, offset: 0x1845): dl_hwcap
    <1e644e>   DW_AT_decl_file   : 1
    <1e644f>   DW_AT_decl_line   : 23
    <1e6450>   DW_AT_type        : <0x1e4c8d>
    <1e6454>   DW_AT_location    : 0x122115 (location list)
...

The debuginfo for the ifunc-resolver function contains the DW_AT_linkage_name
field, which names the real function name "strlen". If you perform an inferior
function call to strlen in lldb, then it fails due to something like that:
"error: no matching function for call to 'strlen'
candidate function not viable: no known conversion from 'const char [6]'
to 'unsigned long' for 1st argument"

The unsigned long is the dl_hwcap argument of the resolver function.
The strlen function itself has no debufinfo.

The s390 ifunc resolver for memset & co uses something like that:
asm (".globl FUNC"
     ".type FUNC, @gnu_indirect_function"
     ".set FUNC, __resolve_FUNC");

This way the debuginfo for the ifunc-resolver function does not conain the
DW_AT_linkage_name field and the real function has no debuginfo, too.

Using this strategy for the vector optimized functions leads to some troubles
for functions like strnlen. Here we have __strnlen and a weak alias strnlen.
The __strnlen function is the ifunc function, which is realized with the asm-
statement above. The weak_alias-macro can't be used here due to undefined symbol:
gcc ../sysdeps/s390/multiarch/strnlen.c -c ...
In file included from <command-line>:0:0:
../sysdeps/s390/multiarch/strnlen.c:28:24: error: ‘strnlen’ aliased to undefined symbol ‘__strnlen’
 weak_alias (__strnlen, strnlen)
                        ^
./../include/libc-symbols.h:111:26: note: in definition of macro ‘_weak_alias’
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
                          ^
../sysdeps/s390/multiarch/strnlen.c:28:1: note: in expansion of macro ‘weak_alias’
 weak_alias (__strnlen, strnlen)
 ^
make[2]: *** [build/string/strnlen.o] Error 1

As the __strnlen function is defined with asm-statements the function name
__strnlen isn't known by gcc. But the weak alias can also be done with an
asm statement to resolve this issue:
__asm__ (".weak  strnlen\n\t"
         ".set   strnlen,__strnlen\n");

In order to use the weak_alias macro, gcc needs to know the ifunc function. The
minimum gcc to build glibc is currently 4.7, which supports attribute((ifunc)).
See https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html.
It is only supported if gcc is configured with --enable-gnu-indirect-function
or gcc supports it by default for at least intel and s390x architecture.
This patch uses the old behaviour if gcc support is not available.
Usage of attribute ifunc is something like that:
__typeof (FUNC) FUNC __attribute__ ((ifunc ("__resolve_FUNC")));

Then gcc produces the same .globl, .type, .set assembler instructions like above.
And the debuginfo does not contain the DW_AT_linkage_name field and there is no
debuginfo for the real function, too.

But in order to get it work, there is also some extra work to do.
Currently, the glibc internal symbol on s390x e.g. __GI___strnlen is not the
ifunc symbol, but the fallback __strnlen_c symbol. Thus I have to omit the
libc_hidden_def macro in strnlen.c (here is the ifunc function __strnlen)
because it is already handled in strnlen-c.c (here is __strnlen_c).

Due to libc_hidden_proto (__strnlen) in string.h, compiling fails:
gcc ../sysdeps/s390/multiarch/strnlen.c -c ...
In file included from <command-line>:0:0:
../sysdeps/s390/multiarch/strnlen.c:53:24: error: ‘strnlen’ aliased to undefined symbol ‘__strnlen’
 weak_alias (__strnlen, strnlen)
                        ^
./../include/libc-symbols.h:111:26: note: in definition of macro ‘_weak_alias’
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
                          ^
../sysdeps/s390/multiarch/strnlen.c:53:1: note: in expansion of macro ‘weak_alias’
 weak_alias (__strnlen, strnlen)
 ^
make[2]: *** [build/string/strnlen.os] Error 1

I have to redirect the prototypes for __strnlen in string.h and create a copy
of the prototype for using as ifunc function:
__typeof (__redirect___strnlen) __strnlen __attribute__ ((ifunc ("__resolve_strnlen")));
weak_alias (__strnlen, strnlen)

This way there is no trouble with the internal __GI_* symbols.
Glibc builds fine with this construct and the debuginfo is "correct".
For functions without a __GI_* symbol like memccpy this redirection is not needed.

This patch adjusts the common libc_ifunc and libm_ifunc macro to use gcc
attribute ifunc. Due to this change, the macro users where the __GI_* symbol
does not target the ifunc symbol have to be prepared with the redirection
construct.
Furthermore a configure check to test gcc support is added. If it is not supported,
the old behaviour is used.

This patch also prepares the libc_ifunc macro to be useable in s390-ifunc-macro.
The s390 ifunc-resolver-functions do have an hwcaps parameter and not all
resolvers need the same initialization code. The next patch in this series
changes the s390 ifunc macros to use this common one.

ChangeLog:

* include/libc-symbols.h (__ifunc_resolver):
New macro is used by __ifunc* macros.
(__ifunc): New macro uses gcc attribute ifunc or inline assembly
depending on HAVE_GCC_IFUNC.
(libc_ifunc, libm_ifunc): Use __ifunc as base macro.
(libc_ifunc_redirected, libc_ifunc_hidden, libm_ifunc_init): New macro.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c:
Redirect ifunced function in header for using as type for ifunc function.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/memcmp.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/memmove.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/memset.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/rawmemchr.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/strchr.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/strlen.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/strncmp.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/multiarch/strnlen.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memcmp.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/mempcpy.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/stpncpy.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcat.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strchr.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcmp.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcpy.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strncmp.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strncpy.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strnlen.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strrchr.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strstr.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/wcschr.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c:
Add libc_hidden_def() and use libc_ifunc_hidden() macro
instead of libc_ifunc() macro.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Likewise.

7 years agoAdd configure check to test if gcc supports attribute ifunc.
Stefan Liebler [Fri, 7 Oct 2016 07:56:46 +0000 (09:56 +0200)] 
Add configure check to test if gcc supports attribute ifunc.

This patch adds a configure check to test if gcc supports attribute ifunc.
The support can either be enabled in <gcc-src>/gcc/config.gcc for one
architecture in general by setting default_gnu_indirect_function variable to yes
or by configuring gcc with --enable-gnu-indirect-function.

The next patch rewrites libc_ifunc macro to use gcc attribute ifunc instead
of inline assembly to generate the IFUNC symbols due to false debuginfo.

If gcc does not support attribute ifunc, the old approach for generating
ifunc'ed symbols is used. Then the debug-information is false. Thus it is
recommended to use a gcc with indirect function support (See notes in INSTALL).
After this patch-series these inline assemblies for ifunc-handling are not
scattered in multiple files but are used only indirect via ifunc-macros
and can simply removed in libc-symbols.h in future.

If glibc is configured with --enable-multi-arch and gcc does not support
attribute ifunc, a configure warning is dumped!

ChangeLog:

* config.h.in (HAVE_GCC_IFUNC): New undef.
* configure.ac: Add check if gcc supports attribute ifunc feature.
* configure: Regenerated.
* manual/install.texi: Add recommendation for gcc with
indirect-function support.
* INSTALL: Regenerated.

7 years agoAdd iseqsig.
Joseph Myers [Thu, 6 Oct 2016 22:19:38 +0000 (22:19 +0000)] 
Add iseqsig.

TS 18661-1 adds an iseqsig type-generic comparison macro to <math.h>.
This macro is like the == operator except that unordered operands
result in the "invalid" exception and errno being set to EDOM.

This patch implements this macro for glibc.  Given the need to set
errno, this is implemented with out-of-line functions __iseqsigf,
__iseqsig and __iseqsigl (of which the last only exists at all if long
double is ABI-distinct from double, so no function aliases or compat
support are needed).  The present patch ignores excess precision
issues; I intend to deal with those in a followup patch.  (Like
comparison operators, type-generic comparison macros should *not*
convert operands to their semantic types but should preserve excess
range and precision, meaning that for some argument types and values
of FLT_EVAL_METHOD, an underlying function should be called for a
wider type than that of the arguments.)

The underlying functions are implemented with the type-generic
template machinery.  Comparing x <= y && x >= y is sufficient in ISO C
to achieve an equality comparison with "invalid" raised for unordered
operands (and the results of those two comparisons can also be used to
tell whether errno needs to be set).  However, some architectures have
GCC bugs meaning that unordered comparison instructions are used
instead of ordered ones.  Thus, a mechanism is provided for
architectures to use an explicit call to feraiseexcept to raise
exceptions if required.  If your architecture has such a bug you
should add a fix-fp-int-compare-invalid.h header for it, with a
comment pointing to the relevant GCC bug report; if such a GCC bug is
fixed, that header's contents should have a __GNUC_PREREQ conditional
added so that the workaround can eventually be removed for that
architecture.

Tested for x86_64, x86, mips64, arm and powerpc.

* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (iseqsig): New
macro.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(__iseqsig): New declaration.
* math/s_iseqsig_template.c: New file.
* math/Versions (__iseqsigf): New libm symbol at version
GLIBC_2.25.
(__iseqsig): Likewise.
(__iseqsigl): Likewise.
* math/libm-test.inc (iseqsig_test_data): New array.
(iseqsig_test): New function.
(main): Call iseqsig_test.
* math/Makefile (gen-libm-calls): Add s_iseqsigF.
* manual/arith.texi (FP Comparison Functions): Document iseqsig.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/generic/fix-fp-int-compare-invalid.h: New file.
* sysdeps/powerpc/fpu/fix-fp-int-compare-invalid.h: Likewise.
* sysdeps/x86/fpu/fix-fp-int-compare-invalid.h: Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.

7 years agoUpdate comments for some functions in s_sin.c
Siddhesh Poyarekar [Thu, 6 Oct 2016 07:39:02 +0000 (13:09 +0530)] 
Update comments for some functions in s_sin.c

Update comments for some functions to bring them in sync with what the
functions are actually doing.

7 years agoAdjust calls to do_sincos_1 and do_sincos_2 in s_sincos.c
Siddhesh Poyarekar [Thu, 6 Oct 2016 07:27:07 +0000 (12:57 +0530)] 
Adjust calls to do_sincos_1 and do_sincos_2 in s_sincos.c

Adjust calls to do_sincos_1 and do_sincos_2 to pass a boolean
shift_quadrant instead of the numeric 0 and 1.

This does not affect codegen.

7 years agoMake quadrant shift a boolean in reduce_and_compute in s_sin.c
Siddhesh Poyarekar [Thu, 6 Oct 2016 07:24:04 +0000 (12:54 +0530)] 
Make quadrant shift a boolean in reduce_and_compute in s_sin.c

Like the previous change, make the quadrant shift a boolean to make it
clearer that we will do at most a single rotation of the quadrants to
compute the cosine from the sine function.

This does not affect codegen.

7 years agoManual typos: System Databases and Name Service Switch
Siddhesh Poyarekar [Thu, 6 Oct 2016 07:06:25 +0000 (12:36 +0530)] 
Manual typos: System Databases and Name Service Switch

       * manual/nss.texi: Fix typos in the manual.

7 years agoManual typos: Contributors to
Rical Jasan [Thu, 6 Oct 2016 07:00:03 +0000 (12:30 +0530)] 
Manual typos: Contributors to

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/contrib.texi: Fix typos in the manual.

7 years agoManual typos: Library Maintenance
Rical Jasan [Thu, 6 Oct 2016 06:59:11 +0000 (12:29 +0530)] 
Manual typos: Library Maintenance

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/maint.texi: Fix typos in the manual.

7 years agoManual typos: Installing
Rical Jasan [Thu, 6 Oct 2016 06:58:45 +0000 (12:28 +0530)] 
Manual typos: Installing

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/install.texi: Fix typos in the manual.
* INSTALL: Regenerated.

7 years agoManual typos: C Language Facilities in the Library
Rical Jasan [Thu, 6 Oct 2016 06:57:48 +0000 (12:27 +0530)] 
Manual typos: C Language Facilities in the Library

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/lang.texi: Fix typos in the manual.

7 years agoManual typos: Internal probes
Rical Jasan [Thu, 6 Oct 2016 06:56:35 +0000 (12:26 +0530)] 
Manual typos: Internal probes

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/probes.texi: Fix typos in the manual.

7 years agoManual typos: POSIX Threads
Rical Jasan [Thu, 6 Oct 2016 06:56:06 +0000 (12:26 +0530)] 
Manual typos: POSIX Threads

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/threads.texi: Fix typos in the manual.

7 years agoManual typos: Debugging support
Rical Jasan [Thu, 6 Oct 2016 06:55:38 +0000 (12:25 +0530)] 
Manual typos: Debugging support

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/debug.texi: Fix typos in the manual.

7 years agoManual typos: DES Encryption and Password Handling
Rical Jasan [Thu, 6 Oct 2016 06:55:00 +0000 (12:25 +0530)] 
Manual typos: DES Encryption and Password Handling

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/crypt.texi: Fix typos in the manual.

7 years agoManual typos: System Configuration Parameters
Rical Jasan [Thu, 6 Oct 2016 06:54:07 +0000 (12:24 +0530)] 
Manual typos: System Configuration Parameters

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/conf.texi: Fix typos in the manual.

7 years agoManual typos: System Management
Rical Jasan [Thu, 6 Oct 2016 06:53:27 +0000 (12:23 +0530)] 
Manual typos: System Management

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/sysinfo.texi: Fix typos in the manual.

7 years agoManual typos: Users and Groups
Rical Jasan [Thu, 6 Oct 2016 06:51:46 +0000 (12:21 +0530)] 
Manual typos: Users and Groups

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/users.texi: Fix typos in the manual.

7 years agoManual typos: Job Control
Rical Jasan [Thu, 6 Oct 2016 06:50:28 +0000 (12:20 +0530)] 
Manual typos: Job Control

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/job.texi: Fix typos in the manual.

7 years agoManual typos: Processes
Rical Jasan [Thu, 6 Oct 2016 06:49:59 +0000 (12:19 +0530)] 
Manual typos: Processes

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/process.texi: Fix typos in the manual.

7 years agoManual typos: The Basic Program/System Interface
Rical Jasan [Thu, 6 Oct 2016 06:49:25 +0000 (12:19 +0530)] 
Manual typos: The Basic Program/System Interface

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/argp.texi: Fix typos in the manual.
* manual/getopt.texi: Likewise.
* manual/startup.texi: Likewise.

7 years agoManual typos: Signal Handling
Rical Jasan [Thu, 6 Oct 2016 06:48:05 +0000 (12:18 +0530)] 
Manual typos: Signal Handling

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/signal.texi: Fix typos in the manual.

7 years agoManual typos: Non-Local Exits
Rical Jasan [Thu, 6 Oct 2016 06:47:29 +0000 (12:17 +0530)] 
Manual typos: Non-Local Exits

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/setjmp.texi: Fix typos in the manual.

7 years agoManual typos: Resource Usage and Limitation
Rical Jasan [Thu, 6 Oct 2016 06:46:53 +0000 (12:16 +0530)] 
Manual typos: Resource Usage and Limitation

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/resource.texi: Fix typos in the manual.

7 years agoManual typos: Date and Time
Rical Jasan [Thu, 6 Oct 2016 06:44:36 +0000 (12:14 +0530)] 
Manual typos: Date and Time

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/time.texi: Fix typos in the manual.

7 years agoManual typos: Arithmetic Functions
Rical Jasan [Thu, 6 Oct 2016 06:42:26 +0000 (12:12 +0530)] 
Manual typos: Arithmetic Functions

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/arith.texi: Fix typos in the manual.

7 years agoManual typos: Mathematics
Rical Jasan [Thu, 6 Oct 2016 06:41:07 +0000 (12:11 +0530)] 
Manual typos: Mathematics

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/math.texi: Fix typos in the manual.

7 years agoManual typos: Syslog
Rical Jasan [Thu, 6 Oct 2016 06:38:46 +0000 (12:08 +0530)] 
Manual typos: Syslog

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/syslog.texi: Fix typos in the manual.

7 years agoManual typos: Low-Level Terminal Interface
Rical Jasan [Thu, 6 Oct 2016 06:37:28 +0000 (12:07 +0530)] 
Manual typos: Low-Level Terminal Interface

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/terminal.texi: Fix typos in the manual.

7 years agoManual typos: Sockets
Rical Jasan [Thu, 6 Oct 2016 06:35:11 +0000 (12:05 +0530)] 
Manual typos: Sockets

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/socket.texi: Fix typos in the manual.

7 years agoManual typos: File System Interface
Rical Jasan [Thu, 6 Oct 2016 06:31:51 +0000 (12:01 +0530)] 
Manual typos: File System Interface

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/filesys.texi: Fix typos in the manual.

7 years agoManual typos: Low-Level Input/Output
Rical Jasan [Thu, 6 Oct 2016 06:28:02 +0000 (11:58 +0530)] 
Manual typos: Low-Level Input/Output

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/llio.texi: Fix typos in the manual.

7 years agoManual typos: Input/Output on Streams
Rical Jasan [Thu, 6 Oct 2016 06:25:58 +0000 (11:55 +0530)] 
Manual typos: Input/Output on Streams

2016-05-06  Rical Jasan  <ricaljasan@pacific.net>

* manual/stdio.text: Fix typos in the manual.

7 years agoCheck n instead of k1 to decide on sign of sin/cos result
Siddhesh Poyarekar [Wed, 5 Oct 2016 19:04:26 +0000 (00:34 +0530)] 
Check n instead of k1 to decide on sign of sin/cos result

For k1 in 1 and 3, n can only have values of 0 and 2, so checking k1 &
2 is equivalent to checking n & 2.  We prefer the latter so that we
don't use k1 for anything other than selecting the quadrant in
do_sincos_1, thus dropping it completely.

The previous logic was:

    "Compute sine for the value and based on the new rotated quadrant
     (k1) negate the value if we're in the fourth quadrant."

With this change, the logic now is:

    "Compute sine for the value and negate it if we were either (1) in
     the fourth quadrant or (2) we actually wanted the cosine and were
     in the third quadrant."

* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Check N
instead of K1.

7 years agoMake the quadrant shift K a bool in do_sincos_* functions
Siddhesh Poyarekar [Wed, 5 Oct 2016 19:03:54 +0000 (00:33 +0530)] 
Make the quadrant shift K a bool in do_sincos_* functions

The do_sincos_* functions are helpers to compute sin/cos, where they
get cosine by computing sine for the next quadrant.  This is decided
with the value of K passed to it, which is the amount by which to
shift the quadrant.  Since we will only need the shift to be 0 or 1,
we make K a bool to make that explicit.

* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Rename K to
SHIFT_QUADRANT and make it bool.
(do_sincos_2): Likewise.
(sloww): Likewise.
(sloww1): Likewise.
(__sin): Adjust calls to do_sincos_1 and do_sincos_2.
(__cos): Likewise.

7 years agopowerpc: Regenerate ULPs
Tulio Magno Quites Machado Filho [Wed, 5 Oct 2016 11:57:47 +0000 (08:57 -0300)] 
powerpc: Regenerate ULPs

* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.

7 years agoFix LONG_WIDTH, ULONG_WIDTH include ordering issue.
Joseph Myers [Tue, 4 Oct 2016 16:17:59 +0000 (16:17 +0000)] 
Fix LONG_WIDTH, ULONG_WIDTH include ordering issue.

As described in
<https://sourceware.org/ml/libc-alpha/2016-10/msg00047.html>, there is
an include ordering issue with the integer width macros in glibc's
<limits.h>, where definitions conditional on LONG_MAX do not work as
intended because when the headers are installed, this part of glibc's
<limits.h> is processed before the part of GCC's <limits.h> that will
define LONG_MAX.  This patch changes the definitions just to use
__WORDSIZE for the expansion of LONG_WIDTH and ULONG_WIDTH rather than
making those definitions conditional on LONG_MAX.

Tested for x86_64 and x86.

* include/limits.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (LONG_WIDTH):
Define to __WORDSIZE, not conditional on [LONG_MAX ==
0x7fffffffL].
[__GLIBC_USE (IEC_60559_BFP_EXT)] (ULONG_WIDTH): Likewise.

7 years agopowerpc: Installed-header hygiene
Tulio Magno Quites Machado Filho [Tue, 4 Oct 2016 13:54:40 +0000 (10:54 -0300)] 
powerpc: Installed-header hygiene

Fix powerpc-specific headers:
 - Make it compatible to C89 by replace references to inline by __inline__.
 - Get the definition of sigset_t used by
   sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h.
 - Includes missing header file.

7 years agoS390: Regenerate ULPs
Stefan Liebler [Tue, 4 Oct 2016 13:27:40 +0000 (15:27 +0200)] 
S390: Regenerate ULPs

Regenerated ulps file after recent commit "Use __builtin_fma more in dbl-64 code.".

ChangeLog:

    * sysdeps/s390/fpu/libm-test-ulps: Regenerated.

7 years agoAdd TCP_REPAIR_WINDOW from Linux 4.8.
Joseph Myers [Mon, 3 Oct 2016 21:01:42 +0000 (21:01 +0000)] 
Add TCP_REPAIR_WINDOW from Linux 4.8.

Linux 4.8 adds TCP_REPAIR_WINDOW to include/uapi/linux/tcp.h.  This
patch adds it to sysdeps/gnu/netinet/tcp.h accordingly, along with
struct tcp_repair_window as requested in
<https://sourceware.org/ml/libc-alpha/2016-10/msg00019.html>.

Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).

* sysdeps/gnu/netinet/tcp.h (TCP_REPAIR_WINDOW): New macro.
(struct tcp_repair_window): New type.

7 years agoFix tst-memstream3 build failure
Adhemerval Zanella [Sun, 2 Oct 2016 13:24:32 +0000 (10:24 -0300)] 
Fix tst-memstream3 build failure

Add string.h to avoid tst-memstream3 build failure in some environments:

 tst-memstream3.c:32:17: error: implicit declaration of function 'strcmp' [-Werror=implicit-function-declaration]
  # define STRCMP strcmp
                  ^
 tst-memstream3.c:96:7: note: in expansion of macro 'STRCMP'
    if (STRCMP (buf, W("b")) != 0)

Checked on x86_64.

* libio/tst-memstream3.c: Include string.h.

7 years agolibio: Multiple fixes for open_{w}memstram (BZ#18241 and BZ#20181)
Adhemerval Zanella [Mon, 25 Jul 2016 17:54:29 +0000 (14:54 -0300)] 
libio: Multiple fixes for open_{w}memstram (BZ#18241 and BZ#20181)

This patches fixes multiples issues on open_{w}memstream reported on both
BZ#18241 and BZ#20181:

  - failed fseek does not set errno.
  - negative offset in fseek fails even when resulting position is
    a valid one.
  - a flush after write if the current write position is not at the
    end of the stream currupt data.

The main fix is on seek operation for memstream (_IO_{w}str_seekoff), where
both _IO_read_ptr and _IO_read_end pointer are updated if a write operation
has occured (similar to default file operations).  Also, to calculate the
offset on both read and write pointers, a temporary value is instead of
updating the argument supplied value.  Negative offset are valid if resulting
internal pointer is within the range of _IO_{read,write}_base and
_IO_{read,write}_end.

Also POSIX states that a null or wide null shall be appended to the current
buffer iff a write moves the position to a value larger than the current
lenght.  Current implementation appends a null or wide null regardless
of this condition.  This patch fixes it by removing the 'else' condition
on _IO_{w}mem_sync.

Checked on x86_64.

[BZ #18241]
[BZ #20181]
* libio/Makefile (test): Add tst-memstream3 and tst-wmemstream3.
* libio/memstream.c (_IO_mem_sync): Only append a null byte if
write position is at the end the buffer.
* libio/wmemstream.c (_IO_wmem_sync): Likewise.
* libio/strops.c (_IO_str_switch_to_get_mode): New function.
(_IO_str_seekoff): Set correct offset from negative displacement and
set EINVAL for invalid ones.
* libio/wstrops.c (enlarge_userbuf): Use correct function to calculate
buffer length.
(_IO_wstr_switch_to_get_mode): New function.
(_IO_wstr_seekoff): Set correct offset from negative displacement and
set EINVAL for invalid ones.
* libio/tst-memstream3.c: New file.
* libio/tst-wmemstream3.c: Likewise.
* manual/examples/memstrm.c: Remove warning when priting size_t.

7 years agoUse __builtin_fma more in dbl-64 code.
Joseph Myers [Fri, 30 Sep 2016 15:49:51 +0000 (15:49 +0000)] 
Use __builtin_fma more in dbl-64 code.

sysdeps/ieee754/dbl-64/dla.h can use a macro DLA_FMS for more
efficient double-width operations when fused multiply-subtract is
supported.  However, this macro is only defined for x86_64,
conditional on architecture-specific __FMA4__.  This patch makes the
code use __builtin_fma conditional on __FP_FAST_FMA, as used elsewhere
in glibc.

Tested for x86_64, x86 and powerpc.  On powerpc (where this is causing
fused operations to be used where they weren't previously) I see an
increase from 1ulp to 2ulp in the imaginary part of clog10:

testing double (without inline functions)
Failure: Test: Imaginary part of: clog10 (0x1.7a858p+0 - 0x6.d940dp-4 i)
Result:
 is:         -1.2237865208199886e-01  -0x1.f5435146bb61ap-4
 should be:  -1.2237865208199888e-01  -0x1.f5435146bb61cp-4
 difference:  2.7755575615628914e-17   0x1.0000000000000p-55
 ulp       :  2.0000
 max.ulp   :  1.0000
Maximal error of real part of: clog10
 is      : 3 ulp
 accepted: 3 ulp
Maximal error of imaginary part of: clog10
 is      : 2 ulp
 accepted: 1 ulp

This is actually resulting from atan2 becoming *more* accurate (atan2
(-0x6.d940dp-4, 0x1.7a858p+0) should ideally be -0x1.208cd6e841554p-2
but was -0x1.208cd6e841555p-2 from a powerpc libm built before this
change, and is -0x1.208cd6e841554p-2 from a powerpc libm built after
this change).  Since these functions are not expected to be correctly
rounding by glibc's accuracy goals, neither result is a problem, but
this does imply that some of this code, although designed to be
correctly rounding, is not in fact correctly rounding (possibly
because of GCC creating fused operations where the code does not
expect it, something we've only disabled for specific functions where
it was found to cause large errors).  (Of course as previously
discussed I think we should remove the slow cases where an error
analysis shows this wouldn't increase the errors much above 0.5ulp;
it's only functions such as cratan2 that are expected to be correctly
rounding, not atan2.)

* sysdeps/ieee754/dbl-64/dla.h [__FP_FAST_FMA] (DLA_FMS): Define
macro to use __builtin_fma.
* sysdeps/x86_64/fpu/dla.h: Remove file.

7 years agoFix ldbl-128ibm iscanonical for -mlong-double-64.
Joseph Myers [Fri, 30 Sep 2016 15:08:08 +0000 (15:08 +0000)] 
Fix ldbl-128ibm iscanonical for -mlong-double-64.

This patch fixes the ldbl-128ibm version of the iscanonical macro not
to use __iscanonicall when long double = double (-mlong-double-64).

Tested for powerpc.

* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
[__NO_LONG_DOUBLE_MATH] (__iscanonicall): Do not declare.
[__NO_LONG_DOUBLE_MATH] (iscanonical): Define to evaluate to 1.

7 years agoBug 20292 - Simplify and test _dl_addr_inside_object
Carlos O'Donell [Fri, 30 Sep 2016 01:54:31 +0000 (21:54 -0400)] 
Bug 20292 - Simplify and test _dl_addr_inside_object

The function _dl_addr_inside_object is simplified by removing
the conditional 'reladdr - l->l_phdr[n].p_vaddr >= 0' which is
always true. The function is refactored into it's own object file
and a unit test added to verify the correct behaviour of the
function.

7 years agoAdd iscanonical.
Joseph Myers [Fri, 30 Sep 2016 00:24:19 +0000 (00:24 +0000)] 
Add iscanonical.

TS 18661-1 adds an iscanonical classification macro to <math.h>.

The motivation for this is decimal floating-point, where some values
have both canonical and noncanonical encodings.  For IEEE binary
interchange formats, all encodings are canonical.  For x86/m68k
ldbl-96, and for ldbl-128ibm, there are encodings that do not
represent any valid value of the type; although formally iscanonical
does not need to handle trap representations (and so could just always
return 1), it seems useful, and in line with the description in the TS
of "representations that are extraneous to the floating-point model"
as being non-canonical (as well as "redundant representations of some
or all of its values"), for it to detect those representations and
return 0 for them.

This patch adds iscanonical to glibc.  It goes in a header
<bits/iscanonical.h>, included under appropriate conditions in
<math.h>.  The default header version just evaluates the argument
(converted to its semantic type, though current GCC will probably
discard that conversion and any exceptions resulting from it) and
returns 1.  ldbl-96 and ldbl-128ibm then have versions of the header
that call a function __iscanonicall for long double (the sizeof-based
tests will of course need updating for float128 support, like other
such type-generic macro implementations).  The ldbl-96 version of
__iscanonicall has appropriate conditionals to reflect the differences
in the m68k version of that format (where the high mantissa bit may be
either 0 or 1 when the exponent is 0 or 0x7fff).  Corresponding tests
for those formats are added as well.  Other architectures do not have
any new functions added because just returning 1 is correct for all
their floating-point formats.

Tested for x86_64, x86, mips64 (to test the default macro version) and
powerpc.

* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)]: Include
<bits/iscanonical.h>.
* bits/iscanonical.h: New file.
* math/s_iscanonicall.c: Likewise.
* math/Versions (__iscanonicall): New libm symbol at version
GLIBC_2.25.
* math/libm-test.inc (iscanonical_test_data): New array.
(iscanonical_test): New function.
(main): Call iscanonical_test.
* math/Makefile (headers): Add bits/iscanonical.h.
(type-ldouble-routines): Add s_iscanonicall.
* manual/arith.texi (Floating Point Classes): Document
iscanonical.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h: New file.
* sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/test-iscanonical-ldbl-128ibm.c:
Likewise.
* sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Add
test-iscanonical-ldbl-128ibm.
* sysdeps/ieee754/ldbl-96/bits/iscanonical.h: New file.
* sysdeps/ieee754/ldbl-96/s_iscanonicall.c: Likewise.
* sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c: Likewise.
* sysdeps/ieee754/ldbl-96/Makefile: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Update.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.

7 years agoRemove C++ style comments from string3.h
Adhemerval Zanella [Thu, 29 Sep 2016 19:02:16 +0000 (12:02 -0700)] 
Remove C++ style comments from string3.h

The new check-installed-headers rule check now complains with C++
comment from string3.h with:

../string/bits/string3.h:129:1: error: C++ style comments are not allowed in ISO C90
 // XXX We have no corresponding builtin yet.

Let use old C style comment to make compiler happy in old modes.

Tested on x86_64.

* string/bits/string3.h: Remove C++ style comments.

7 years agoUse copysign instead of ternary for some sin/cos input ranges
Siddhesh Poyarekar [Thu, 29 Sep 2016 23:49:05 +0000 (05:19 +0530)] 
Use copysign instead of ternary for some sin/cos input ranges

These are remaining cases where we can deduce and conclude that the
sign of the result should be the same as the sign of the input being
checked.  For example, for sin(x), the sign of the result is the same
as the result itself for x < pi.  Likewise, for sine values where x
after range reduction falls into this range and its sign is preserved.

* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Use copysign
instead of ternary condition.
(do_sincos_2): Likewise.
(__sin): Likewise.
(__cos): Likewise.
(slow): Likewise.
(sloww): Likewise.
(sloww1): Likewise.
(bsloww): Likewise.
(bsloww1): Likewise.

7 years agoUse copysign instead of ternary conditions for positive constants
Siddhesh Poyarekar [Thu, 29 Sep 2016 23:47:55 +0000 (05:17 +0530)] 
Use copysign instead of ternary conditions for positive constants

This is the first very simple substitution of ternary conditions for
correction adjustments with __copysign for positive constants.

* sysdeps/ieee754/dbl-64/s_sin.c (do_cos_slow): use copysign
instead of ternary condition.
(do_sin_slow): Likewise.
(do_sincos_1): Likewise.
(do_sincos_2): Likewise.
(__cos): Likewise.
(sloww): Likewise.
(sloww1): Likewise.
(sloww2): Likewise.
(bsloww): Likewise.
(bsloww1): Likewise.
(bsloww2): Likewise.

7 years agoconsolidate sign checks for slow2
Siddhesh Poyarekar [Thu, 29 Sep 2016 23:45:55 +0000 (05:15 +0530)] 
consolidate sign checks for slow2

Simplify the code a bit by consolidating sign checks in slow1 and
slow2 into __sin at the higher level.

* sysdeps/ieee754/dbl-64/s_sin.c (slow1): Consolidate sign
check from here...
(slow2): ... and here...
(__sin): ... to here.

7 years agoFix iszero for excess precision.
Joseph Myers [Wed, 28 Sep 2016 21:11:58 +0000 (21:11 +0000)] 
Fix iszero for excess precision.

Floating-point classification macros are supposed to remove any excess
range or precision from their arguments.  This patch fixes the
non-sNaN version of iszero to do so, by casting the argument to its
own type.  (This will of course work only for standard-conforming
excess precision, not for what GCC does on 32-bit x86 by default where
the back end hides excess precision from the front end; the same
applies to most of the classification macros in that case, as showed
up when we made them use GCC built-in functions.)

(iseqsig will have the reverse issue, needing to ensure that when an
underlying function is used it's for a type wide enough not to remove
any excess precision, since comparison macros must not remove excess
precision.)

Tested for x86_64 and x86.

* math/math.h
[__GLIBC_USE (IEC_60559_BFP_EXT) && !__SUPPORT_SNAN__] (iszero):
Cast argument to its own type.
* math/test-iszero-excess-precision.c: New file.
* math/Makefile (tests): Add test-iszero-excess-precision.
(CFLAGS-test-iszero-excess-precision.c): New variable.

7 years agoposix: Fix open file action for posix_spawn on Linux
Adhemerval Zanella [Fri, 16 Sep 2016 20:44:50 +0000 (17:44 -0300)] 
posix: Fix open file action for posix_spawn on Linux

On posix_spawn open file action (issued by posix_spawn_file_actions_addopen)
POSIX states that if fildes was already an open file descriptor, it shall be
closed before the new file is openedi [1].  This avoid pontential issues when
posix_spawn plus addopen action is called with the process already at maximum
number of file descriptor opened and also for multiple actions on single-open
special paths (like /dev/watchdog).

This fixes its behavior on Linux posix_spawn implementation and also adds
a tests to check for its behavior.

Checked on x86_64.

* posix/Makefile (tests): Add tst-spawn3.
* posix/tst-spawn3.c: New file.
* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Close file descriptor
if it is already opened for open action.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addclose.html

7 years agolinux: spawni.c: simplify error reporting to parent
Rasmus Villemoes [Wed, 28 Sep 2016 00:52:17 +0000 (17:52 -0700)] 
linux: spawni.c: simplify error reporting to parent

Using CLONE_VFORK already ensures that the parent does not run until the
child has either exec'ed succesfully or called _exit. Hence we don't
need to read from a CLOEXEC pipe to ensure proper synchronization - we
just make explicit use of the fact the the child and parent run in the
same VM, so the child can write an error code to a field of the
posix_spawn_args struct instead of sending it through a pipe.

To ensure that this mechanism really works, the parent initializes the
field to -1 and the child writes 0 before execing.

This eliminates some annoying bookkeeping that is necessary to avoid
the file actions from clobbering the write end of the pipe, and
getting rid of the pipe creation in the first place means fewer system
calls (four in the parent, usually one in the child) and fewer
chanches for the spawn to fail (e.g. if we're close to EMFILE).

Checked on x86_64 and i686.

* sysdeps/unix/sysv/linux/spawni.c (posix_spawn_args): Remove pipe
field, add err field.
(__spawni_child): Report error through err member instead of pipe.
(__spawnix): Likewise.

7 years agoMinor corrections to scripts/check-installed-headers.sh.
Zack Weinberg [Wed, 28 Sep 2016 11:28:00 +0000 (07:28 -0400)] 
Minor corrections to scripts/check-installed-headers.sh.

* scripts/check-installed-headers.sh: Generalize treatment of
sys/elf.h to all target architectures.

7 years agoMinor correction to the "installed header hygiene" patches.
Zack Weinberg [Wed, 28 Sep 2016 11:19:59 +0000 (07:19 -0400)] 
Minor correction to the "installed header hygiene" patches.

   * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Restore accidentally-
deleted typedef ucontext_t.

7 years agoAdd INTERNAL_SYSCALL_CALL
Adhemerval Zanella [Thu, 30 Jun 2016 19:34:18 +0000 (16:34 -0300)] 
Add INTERNAL_SYSCALL_CALL

This patch adds two new macros for internal and inline syscall to use
within GLIBC: INTERNAL_SYSCALL_CALL and INLINE_SYSCALL_CALL.  They are
similar to the old INTERNAL_SYSCALL and INLINE_SYSCALL with the difference
the new macros accept a variable argument call and do not require to pass
the expected argument size.

The advantage is it is possible to use variable argument macros like
SYSCALL_LL{64} without the need to also handle the argument size.  So
for an ABI where SYSCALL_LL might split the argument in high and low
parts, instead of:

  INTERNAL_SYSCALL_DECL (err);
 #if ...
  INTERNAL_SYSCALL (syscall, err, 2, SYSCALL_LL (len));
 #else
  INTERNAL_SYSCALL (syscall, err, 1, SYSCALL_LL (len));
 #endif

It will be just:

  INTERNAL_SYSCALL_CALL (syscall, err, SYSCALL_LL (len));

The INLINE_SYSCALL_CALL follows the same semanthic regarding the argument
and is similar to INLINE_SYSCALL regarding setting errno.

Checked with a build for x86_64, i386, aach64, armhf, powerpc64le, powerpc32,
and mips32.  No code generation changed.

* sysdeps/unix/sysdep.h (__INTERNAL_SYSCALL0): New macro.
(__INTERNAL_SYSCALL1): Likewise.
(__INTERNAL_SYSCALL2): Likewise.
(__INTERNAL_SYSCALL3): Likewise.
(__INTERNAL_SYSCALL4): Likewise.
(__INTERNAL_SYSCALL5): Likewise.
(__INTERNAL_SYSCALL6): Likewise.
(__INTERNAL_SYSCALL7): Likewise.
(__INTERNAL_SYSCALL_NARGS_X): Likewise.
(__INTERNAL_SYSCALL_NARGS): Likewise.
(__INTERNAL_SYSCALL_DISP): Likewise.
(INTERNAL_SYSCALL_CALL): Likewise.
(__SYSCALL0): Rename to __INLINE_SYSCALL0.
(__SYSCALL1): Rename to __INLINE_SYSCALL1.
(__SYSCALL2): Rename to __INLINE_SYSCALL2.
(__SYSCALL3): Rename to __INLINE_SYSCALL3.
(__SYSCALL4): Rename to __INLINE_SYSCALL4.
(__SYSCALL5): Rename to __INLINE_SYSCALL5.
(__SYSCALL6): Rename to __INLINE_SYSCALL6.
(__SYSCALL7): Rename to __INLINE_SYSCALL7.
(__SYSCALL_NARGS_X): Rename to __INLINE_SYSCALL_NARGS_X.
(__SYSCALL_NARGS): Rename to __INLINE_SYSCALL_NARGS.
(__SYSCALL_DISP): Rename to __INLINE_SYSCALL_DISP.
(__SYSCALL_CALL): Rename to INLINE_SYSCALL_CALL.
(SYSCALL_CANCEL): Replace __SYSCALL_CALL with INLINE_SYSCALL_CALL.

7 years agoAdd iszero.
Joseph Myers [Fri, 23 Sep 2016 21:54:21 +0000 (21:54 +0000)] 
Add iszero.

TS 18661-1 adds an iszero classification macro to <math.h>.  This
patch implements it for glibc.  There are no new underlying functions
in libm because the implementation uses fpclassify when sNaN support
is required and a direct comparison otherwise; any optimizations for
this macro should be done through adding __builtin_iszero in GCC and
using it in the header for suitable GCC versions, not through adding
other optimized inline or out-of-line versions to glibc.

Tested for x86_64 and x86.

* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (iszero): New
macro.
* math/libm-test.inc (iszero_test_data): New array.
(iszero_test): New function.
(main): Call iszero_test.
* manual/arith.texi (Floating Point Classes): Document iszero.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.

7 years agoInstalled header hygiene (BZ#20366): Test of installed headers.
Zack Weinberg [Wed, 24 Aug 2016 01:19:17 +0000 (21:19 -0400)] 
Installed header hygiene (BZ#20366): Test of installed headers.

This adds a test to ensure that the problems fixed in the last several
patches do not recur.  Each directory checks the headers that it
installs for two properties: first, each header must be compilable in
isolation, as both C and C++, under a representative combination of
language and library conformance levels; second, there is a blacklist
of identifiers that may not appear in any installed header, currently
consisting of the legacy BSD typedefs.  (There is an exemption for the
headers that define those typedefs, and for the RPC headers.  It may be
necessary to make this more sophisticated if we add more stuff to the
blacklist in the future.)

In order for this test to work correctly, every wrapper header
that actually defines something must guard those definitions with
 #ifndef _ISOMAC.  This is the existing mechanism used by the conform/
tests to tell wrapper headers not to define anything that the public
header wouldn't, and not to use anything from libc-symbols.h.  conform/
only cares for headers that we need to check for standards conformance,
whereas this test applies to *every* header.  (Headers in include/ that
are either installed directly, or are internal-use-only and do *not*
correspond to any installed header, are not affected.)

* scripts/check-installed-headers.sh: New script.
* Rules: In each directory that defines header files to be installed,
run check-installed-headers.sh on them as a special test.
* Makefile: Likewise for the headers installed at top level.

* include/aliases.h, include/alloca.h, include/argz.h
* include/arpa/nameser.h, include/arpa/nameser_compat.h
* include/elf.h, include/envz.h, include/err.h
* include/execinfo.h, include/fpu_control.h, include/getopt.h
* include/gshadow.h, include/ifaddrs.h, include/libintl.h
* include/link.h, include/malloc.h, include/mcheck.h
* include/mntent.h, include/netinet/ether.h
* include/nss.h, include/obstack.h, include/printf.h
* include/pty.h, include/resolv.h, include/rpc/auth.h
* include/rpc/auth_des.h, include/rpc/auth_unix.h
* include/rpc/clnt.h, include/rpc/des_crypt.h
* include/rpc/key_prot.h, include/rpc/netdb.h
* include/rpc/pmap_clnt.h, include/rpc/pmap_prot.h
* include/rpc/pmap_rmt.h, include/rpc/rpc.h
* include/rpc/rpc_msg.h, include/rpc/svc.h
* include/rpc/svc_auth.h, include/rpc/xdr.h
* include/rpcsvc/nis_callback.h, include/rpcsvc/nislib.h
* include/rpcsvc/yp.h, include/rpcsvc/ypclnt.h
* include/rpcsvc/ypupd.h, include/shadow.h
* include/stdio_ext.h, include/sys/epoll.h
* include/sys/file.h, include/sys/gmon.h, include/sys/ioctl.h
* include/sys/prctl.h, include/sys/profil.h
* include/sys/statfs.h, include/sys/sysctl.h
* include/sys/sysinfo.h, include/ttyent.h, include/utmp.h
* sysdeps/arm/nacl/include/bits/setjmp.h
* sysdeps/mips/include/sys/asm.h
* sysdeps/unix/sysv/linux/include/sys/sysinfo.h
* sysdeps/unix/sysv/linux/include/sys/timex.h
* sysdeps/x86/fpu/include/bits/fenv.h:
Add #ifndef _ISOMAC guard around internal declarations.
Add multiple-inclusion guard if not already present.

7 years agoInstalled-header hygiene (BZ#20366): stack_t.
Zack Weinberg [Wed, 13 Jul 2016 20:11:57 +0000 (16:11 -0400)] 
Installed-header hygiene (BZ#20366): stack_t.

sys/ucontext.h unconditionally uses stack_t, and it does not make
sense to change that.  But signal.h only declares stack_t under
__USE_XOPEN_EXTENDED || __USE_XOPEN2K8.  The actual definition is
already in a bits header, bits/sigstack.h, but that header insists on
only being included by signal.h, so we have to change that as well as
all of the sys/ucontext.h variants.  (Some but not all variants of
bits/sigcontext.h, which sys/ucontext.h may also need, had already
received this adjustment; for consistency, I made them all the same,
even if that's not strictly necessary in some configurations.)
bits/sigcontext.h and bits/sigstack.h also all need to receive
multiple inclusion guards.

* sysdeps/generic/sys/ucontext.h
* sysdeps/arm/sys/ucontext.h
* sysdeps/i386/sys/ucontext.h
* sysdeps/m68k/sys/ucontext.h
* sysdeps/mips/sys/ucontext.h
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h:
Include both bits/sigcontext.h and bits/sigstack.h.
Fix grammar error in comment, if present.

* bits/sigstack.h
* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
* sysdeps/unix/sysv/linux/alpha/bits/sigstack.h
* sysdeps/unix/sysv/linux/bits/sigstack.h
* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
* sysdeps/unix/sysv/linux/mips/bits/sigstack.h
* sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
* sysdeps/unix/sysv/linux/sparc/bits/sigstack.h
* bits/sigcontext.h
* sysdeps/mach/hurd/i386/bits/sigcontext.h
* sysdeps/unix/sysv/linux/bits/sigcontext.h
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h:
Add multiple inclusion guard.  Permit inclusion by sys/ucontext.h
as well as signal.h, if this was not already allowed.  Request
definition of size_t if necessary.  Minimize semantically-null
differences across files.

7 years agoInstalled-header hygiene (BZ#20366): time.h types.
Zack Weinberg [Wed, 24 Aug 2016 15:54:34 +0000 (11:54 -0400)] 
Installed-header hygiene (BZ#20366): time.h types.

Many headers are expected to expose a subset of the type definitions
in time.h.  time.h has a whole bunch of messy logic for conditionally
defining some its types and structs, but, as best I can tell, this
has never worked 100%.  In particular, __need_timespec is ineffective
if _TIME_H has already been defined, which means that if you compile

  #include <time.h>
  #include <sched.h>

with e.g. -fsyntax-only -std=c89 -Wall -Wsystem-headers, you will get

In file included from test.c:2:0:
/usr/include/sched.h:74:57: warning: "struct timespec" declared inside
  parameter list will not be visible outside of this definition or declaration
 extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
                                                         ^~~~~~~~

And if you want to _use_ sched_rr_get_interval in a TU compiled that
way, you're hosed.

This patch replaces all of that with small bits/types/TYPE.h headers
as introduced earlier.  time.h and bits/time.h are now *much* simpler,
and a lot of other headers are slightly simpler.

* time/time.h, bits/time.h, sysdeps/unix/sysv/linux/bits/time.h:
Remove all logic conditional on __need macros.  Move all the
conditionally defined types to their own headers...
* time/bits/types/clock_t.h: Define clock_t here.
* time/bits/types/clockid_t.h: Define clockid_t here.
* time/bits/types/struct_itimerspec.h: Define struct itimerspec here.
* time/bits/types/struct_timespec.h: Define struct timespec here.
* time/bits/types/struct_timeval.h: Define struct timeval here.
* time/bits/types/struct_tm.h: Define struct tm here.
* time/bits/types/time_t.h: Define time_t here.
* time/bits/types/timer_t.h: Define timer_t here.
* time/Makefile: Install the new headers.

* bits/resource.h, io/fcntl.h, io/sys/poll.h, io/sys/stat.h
* io/utime.h, misc/sys/select.h, posix/sched.h, posix/sys/times.h
* posix/sys/types.h, resolv/netdb.h, rt/aio.h, rt/mqueue.h
* signal/signal.h, pthread/semaphore.h, sysdeps/nptl/pthread.h
* sysdeps/unix/sysv/linux/alpha/bits/resource.h
* sysdeps/unix/sysv/linux/alpha/sys/acct.h
* sysdeps/unix/sysv/linux/bits/resource.h
* sysdeps/unix/sysv/linux/bits/timex.h
* sysdeps/unix/sysv/linux/mips/bits/resource.h
* sysdeps/unix/sysv/linux/net/ppp_defs.h
* sysdeps/unix/sysv/linux/sparc/bits/resource.h
* sysdeps/unix/sysv/linux/sys/acct.h
* sysdeps/unix/sysv/linux/sys/timerfd.h
* sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h
* time/sys/time.h, time/sys/timeb.h
Use the new bits/types headers.

* include/time.h: Remove __need logic.
* include/bits/time.h
* include/bits/types/clock_t.h, include/bits/types/clockid_t.h
* include/bits/types/time_t.h, include/bits/types/timer_t.h
* include/bits/types/struct_itimerspec.h
* include/bits/types/struct_timespec.h
* include/bits/types/struct_timeval.h
* include/bits/types/struct_tm.h:
New wrapper headers.

7 years agoInstalled-header hygiene (BZ#20366): conditionally defined structures.
Zack Weinberg [Wed, 13 Jul 2016 19:20:29 +0000 (15:20 -0400)] 
Installed-header hygiene (BZ#20366): conditionally defined structures.

Several network-related structures are defined conditionally under
__USE_MISC, but unconditionally used by other headers.  The path of
least resistance is usually to condition the uses on __USE_MISC as
well.

* sysdeps/mach/hurd/net/if_ppp.h
* sysdeps/unix/sysv/linux/net/if_ppp.h:
        Only define struct ifpppstatsreq and struct ifpppcstatsreq
        if __USE_MISC is defined, to ensure struct ifreq is declared.

* inet/netinet/ether.h: Condition all function prototypes
        on __USE_MISC, to ensure struct ether_addr is declared.

sys/socket.h defines struct osockaddr only under __USE_MISC, whereas
protocols/talkd.h requires it unconditionally.  Here it doesn't make
sense to condition the entire body of protocols/talkd.h on __USE_MISC.
Rather than complicate sys/socket.h with a __need macro or duplicate
the definition, I am introducing a new concept: tiny headers named
bits/types/TYPE.h that define TYPE and nothing else.  This can, I hope,
ultimately replace *all* the __need macros.  The guard macro for such
headers will be __TYPE_defined, just in case application or third-party
library code is looking at them.

* socket/bits/types/struct_osockaddr.h: New header.
* include/bits/types/struct_osockaddr.h: New wrapper.
* socket/Makefile: Install the new header.
* socket/sys/socket.h,  inet/protocols/talkd.h:
Refer to bits/types/struct_osockaddr.h for the definition of
struct osockaddr.

7 years agoInstalled-header hygiene (BZ#20366): obsolete BSD u_* types.
Zack Weinberg [Sun, 21 Aug 2016 19:38:41 +0000 (15:38 -0400)] 
Installed-header hygiene (BZ#20366): obsolete BSD u_* types.

The types u_char, u_short, u_int, u_long, ushort, uint, ulong, u_int8_t,
u_int16_t, u_int32_t, u_int64_t, quad_t, and u_quad_t are BSDisms that
have never been standardized.  While glibc should continue to *provide*
these types for compatibility's sake, its public headers should not
use them.

The meat of this change was mechanically generated by the following
shell command:

    perl -pi~ -e '
        s/\b(__)?u_char\b/unsigned char/g;
        s/\b(__)?u_?short\b/unsigned short/g;
        s/\b(__)?u_?int\b/unsigned int/g;
        s/\b(__)?u_?long\b/unsigned long/g;
        s/\b(__)?u_int8_t\b/uint8_t/g;
        s/\b(__)?u_int16_t\b/uint16_t/g;
        s/\b(__)?u_int32_t\b/uint32_t/g;
        s/\b(__)?u_int64_t\b/uint64_t/g;
        s/\b(__)?u_quad_t\b/uint64_t/g;
        s/\b(__)?quad_t\b/uint64_t/g;
    ' $(grep -lE -e '\<((__)?(quad_t|u(short|int|long|_(char|short|int([0-9]+_t)?|long|quad_t))))\>' \
        $(grep -LE '\<(_(SYS|BITS)_TYPES_H|rpc/(rpc|rpc_msg|types|xdr)\.h)\>' \
          $(find . \( -false $(sed 's/^/-o -name /' all-installed-headers) \
                   \) -printf '%P\n' | sort -u)))

where 'all-installed-headers' was a list of the basenames of all installed
header files, manually extracted from the Makefiles.  Non-installed
wrapper headers in include/ are also adjusted, for consistency.
I then manually fixed up indentation and line-wrapping.

sys/types.h and bits/types.h are excluded because they must continue
to define the u_* types (under __USE_MISC) for compatibility with
applications.  They do not use these types themselves.

All headers that (transitively) include rpc/types.h are also excluded,
for three reasons.  First, the u_* types are defined by rpc/types.h,
unconditionally (not just under __USE_MISC) so they are logically part
of the SunRPC API.  Second, many of those headers appear to be
machine-generated.  Third, it's my understanding that we are getting
rid of as much of SunRPC as possible in the near future.

(The one file under sunrpc/ that's touched, sunrpc/rpc/rpc_des.h, does
*not* include rpc/types.h.  This may itself be a bug.)

After changing from u_intNN_t to uintNN_t, a number of headers now
need to include stdint.h to pick up those types.  It might be more
hygenic, namespace-wise, to use __uintNN_t instead, but none of these
headers are bound by ISO or POSIX to do so, and it's unlikely that
anyone using them will be bothered.  (The two files that were using
__-prefixed versions of the u_types, sysdeps/mach/hurd/net/route.h and
sysdeps/unix/sysv/linux/net/route.h, both already also contained uses of
the unprefixed versions.)

Some of these files directly included features.h and/or sys/cdefs.h,
which I removed, as the style generally seems to be to let sys/types.h
do that for us.  (This does not change the set of definitions exposed
by any header; sys/types.h unconditionally includes both features.h
and sys/cdefs.h.)

One file included asm/types.h unnecessarily.

* bits/in.h, gmon/sys/gmon.h, inet/netinet/igmp.h
* inet/protocols/routed.h, inet/protocols/talkd.h
* inet/protocols/timed.h, io/fts.h, nptl_db/thread_db.h
* resolv/arpa/nameser.h, resolv/resolv.h, sunrpc/rpc/rpc_des.h
* sysdeps/generic/netinet/if_ether.h
* sysdeps/generic/netinet/in_systm.h
* sysdeps/generic/netinet/ip.h, sysdeps/generic/netinet/tcp.h
* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
* sysdeps/gnu/netinet/udp.h, sysdeps/mach/hurd/net/ethernet.h
* sysdeps/mach/hurd/net/if_arp.h
* sysdeps/mach/hurd/net/if_ppp.h
* sysdeps/mach/hurd/net/route.h, sysdeps/mach/sys/reboot.h
* sysdeps/unix/sysv/linux/bits/in.h
* sysdeps/unix/sysv/linux/net/ethernet.h
* sysdeps/unix/sysv/linux/net/if_arp.h
* sysdeps/unix/sysv/linux/net/if_ppp.h
* sysdeps/unix/sysv/linux/net/if_shaper.h
* sysdeps/unix/sysv/linux/net/route.h
* sysdeps/unix/sysv/linux/netinet/if_ether.h
* sysdeps/unix/sysv/linux/netinet/if_fddi.h
* sysdeps/unix/sysv/linux/netinet/if_tr.h
* sysdeps/unix/sysv/linux/netipx/ipx.h
* sysdeps/unix/sysv/linux/sys/acct.h
* include/arpa/nameser.h, include/resolv.h:
Change all uses of u_char to unsigned char,
u_short and ushort to unsigned short, u_int and uint to unsigned int,
u_long and ulong to unsigned long, u_int8_t to uint8_t,
        u_int16_t to uint16_t, u_int32_t to uint32_t, quad_t to int64_t,
and u_int64_t and u_quad_t to uint64_t.

* mach/sys/reboot.h: Remove two casts of integer literals
to the types they already have.

* bits/in.h: Correct error in description of IP_MULTICAST_LOOP.
* sysdeps/unix/sysv/linux/bits/in.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/if_ether.h: Change a comment
from referring to 'unsigned char' to 'uint8_t' for consistency with
the macro definition below.

* gmon/sys/gmon.h, inet/netinet/igmp.h, inet/protocols/talkd.h
* io/fts.h, resolv/arpa/nameser.h, resolv/resolv.h
* sunrpc/rpc/rpc_des.h, sysdeps/generic/netinet/ip.h
* sysdeps/gnu/netinet/tcp.h, sysdeps/gnu/netinet/udp.h
* sysdeps/mach/hurd/net/if_ppp.h, sysdeps/unix/sysv/linux/net/if_ppp.h
* sysdeps/unix/sysv/linux/sys/acct.h
* include/arpa/nameser.h, include/resolv.h:
Fix indentation disrupted by mechanical edits.

* inet/protocols/talkd.h, resolv/arpa/nameser.h
* sysdeps/generic/netinet/in_systm.h
* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
* sysdeps/gnu/netinet/udp.h
* sysdeps/unix/sysv/linux/net/ethernet.h
* sysdeps/unix/sysv/linux/net/if_arp.h
* sysdeps/unix/sysv/linux/net/if_ppp.h
* sysdeps/unix/sysv/linux/net/if_shaper.h
* sysdeps/unix/sysv/linux/netinet/if_fddi.h
* sysdeps/unix/sysv/linux/netinet/if_tr.h
* sysdeps/unix/sysv/linux/netipx/ipx.h
* sysdeps/unix/sysv/linux/sys/acct.h
Include stdint.h for uintNN_t definitions.
Don't include sys/cdefs.h, features.h, or asm/types.h directly.

7 years agoInstalled-header hygiene (BZ#20366): Simple self-contained fixes.
Zack Weinberg [Mon, 22 Aug 2016 12:06:30 +0000 (08:06 -0400)] 
Installed-header hygiene (BZ#20366): Simple self-contained fixes.

Some headers did not include all of their prerequisite headers.

* rpcsvc/nislib.h: Include rpcsvc/nis.h.
* sysdeps/unix/sysv/linux/netrose/rose.h:
Include sys/socket.h and netax25/ax25.h.

<endian.h> only defines BYTE_ORDER, BIG_ENDIAN, LITTLE_ENDIAN,
etc. under __USE_MISC; glibc's headers should use __BYTE_ORDER,
__BIG_ENDIAN, __LITTLE_ENDIAN, etc. instead.

* inet/netinet/icmp6.h, inet/netinet/ip6.h
* resolv/arpa/nameser_compat.h:
Use __BYTE_ORDER etc. instead of BYTE_ORDER etc.

sys/types.h only conditionally defines caddr_t and clockid_t.

* sysdeps/unix/sysv/linux/sys/quota.h:
Use __caddr_t instead of caddr_t.
* sysdeps/unix/sysv/linux/sys/timerfd.h:
Use __clockid_t instead of clockid_t.

Remove a #warning that was the sole actual problem with using sys/ipc.h
without _GNU_SOURCE/_XOPEN_SOURCE.

* sysvipc/sys/ipc.h: Remove unnecessary #warning.

_LIBC, __USE_XOPEN2K8, and __STDC_VERSION__ are not always defined.

It seems to me that _LIBC should not appear in installed headers, but
avoiding that for argp specifically would require more surgery than
feels appropriate for this patch set.  It's possible that
"#ifdef _LIBC" would be sufficient, but I wanted to be conservative.

All three versions of bits/socket.h want to know whether __flexarr
will produce a real flexible array member -- specifically, one that
doesn't alter sizeof(the structure containing it).  They were testing
for this with a complicated #if condition that did not agree with
sys/cdefs.h and that tripped -Wundef warnings under -std=c90.
I added a new macro to sys/cdefs.h, __glibc_c99_flexarr_available,
which reveals exactly what these headers want to know.  I also took
the opportunity to flatten the rather messy conditional nest defining
__flexarr.

* argp/argp.h: Check whether _LIBC is defined before expanding it.
* posix/glob.h: Check whether __USE_XOPEN2K8 is defined instead
of expanding it.

* misc/sys/cdefs.h: Tidy up conditional nest defining __flexarr.
Define __glibc_c99_flexarr_available to 1 when the compiler
supports C99-compatible flexible array members, 0 otherwise.
* sysdeps/unix/sysv/linux/bits/socket.h
* sysdeps/mach/hurd/bits/socket.h
* bits/socket.h: Use __glibc_c99_flexarr_available in
definitions of struct cmsghdr and CMSG_DATA.

7 years agomanual: Clarify NSS error reporting
Florian Weimer [Fri, 23 Sep 2016 12:18:08 +0000 (14:18 +0200)] 
manual: Clarify NSS error reporting

The manual already required that NSS implementation functions set
error codes if they return a value that is not NSS_STATUS_SUCCESS,
but this was not very explicit.  The errnop parameter was omitted
in a few places, and the function return value was incorrect.

7 years agotst-open-tmpfile: Add checks for open64, openat64, linkat
Florian Weimer [Fri, 23 Sep 2016 11:38:09 +0000 (13:38 +0200)] 
tst-open-tmpfile: Add checks for open64, openat64, linkat

The /proc/self/fd approach is expected to work for all users
(with and without CAP_DAC_READ_SEARCH).

7 years agotest-skeleton.c: Remove unintended #include <stdarg.h>.
Florian Weimer [Fri, 23 Sep 2016 07:41:35 +0000 (09:41 +0200)] 
test-skeleton.c: Remove unintended #include <stdarg.h>.

7 years ago[PR19826] fix non-LE TLS in static programs
Alexandre Oliva [Thu, 22 Sep 2016 01:01:16 +0000 (22:01 -0300)] 
[PR19826] fix non-LE TLS in static programs

An earlier fix for TLS dropped early initialization of DTV entries for
modules using static TLS, leaving it for __tls_get_addr to set them
up.  That worked on platforms that require the GD access model to be
relaxed to LE in the main executable, but it caused a regression on
platforms that allow GD in the main executable, particularly in
statically-linked programs: they use a custom __tls_get_addr that does
not update the DTV, which fails when the DTV early initialization is
not performed.

In static programs, __libc_setup_tls performs the DTV initialization
for the main thread, but the DTV of other threads is set up in
_dl_allocate_tls_init, so that's the fix that matters.

Restoring the initialization in the remaining functions modified by
this patch was just for uniformity.  It's not clear that it is ever
needed: even on platforms that allow GD in the main executable, the
dynamically-linked version of __tls_get_addr would set up the DTV
entries, even for static TLS modules, while updating the DTV counter.

for  ChangeLog

[BZ #19826]
* elf/dl-tls.c (_dl_allocate_tls_init): Restore DTV early
initialization of static TLS entries.
* elf/dl-reloc.c (_dl_nothread_init_static_tls): Likewise.
* nptl/allocatestack.c (init_one_static_tls): Likewise.

7 years agohurd: Fix stack pointer corruption in syscall
Samuel Thibault [Thu, 22 Sep 2016 00:43:39 +0000 (02:43 +0200)] 
hurd: Fix stack pointer corruption in syscall

Thanks Justus Winter for the report.

* sysdeps/mach/i386/syscall.S (syscall): Push back syscall number.

7 years agohurdmalloc: Run fork handler as late as possible [BZ #19431]
Samuel Thibault [Wed, 21 Sep 2016 23:45:48 +0000 (01:45 +0200)] 
hurdmalloc: Run fork handler as late as possible [BZ #19431]

This is the hurd-specific follow-up for
29d794863cd6e03115d3670707cc873a9965ba92 : hurdmalloc also needs the
same fix

* hurd/hurdmalloc.c (malloc_fork_prepare): Rename to
_hurd_malloc_fork_prepare.
(malloc_fork_parent): Rename to _hurd_malloc_fork_parent.
(malloc_fork_child): Rename to _hurd_malloc_fork_child.
(_hurd_fork_prepare_hook): Drop malloc_fork_prepare.
(_hurd_fork_parent_hook): Drop malloc_fork_parent.
(_hurd_fork_child_hook): Drop malloc_fork_child.
* hurd/hurdmalloc.h (_hurd_malloc_fork_prepare,
_hurd_malloc_fork_parent, _hurd_malloc_fork_child): Add declarations.
* sysdeps/mach/hurd/fork.c (__fork): Call __malloc_fork_lock_parent
after locking locks (notably hurd_dtable_lock). Call
_hurd_malloc_fork_prepare after that. Call _hurd_malloc_fork_parent
before __malloc_fork_unlock_parent and _hurd_malloc_fork_child before
__malloc_fork_unlock_child.

7 years ago[soft-fp] Add support for various half-precision conversion routines.
James Greenhalgh [Wed, 21 Sep 2016 21:02:54 +0000 (21:02 +0000)] 
[soft-fp] Add support for various half-precision conversion routines.

This patch adds conversion routines required for _Float16 support in
AArch64.

These are one-step conversions to and from TImode and TFmode. We need
these on AArch64 regardless of presence of the ARMv8.2-A 16-bit
floating-point extensions.

In the patch, soft-fp/half.h is derived from soft-fp/single.h .  The
conversion routines are derivatives of their respective SFmode
variants.

* soft-fp/extendhftf2.c: New.
* soft-fp/fixhfti.c: Likewise.
* soft-fp/fixunshfti.c: Likewise.
* soft-fp/floattihf.c: Likewise.
* soft-fp/floatuntihf.c: Likewise.
* soft-fp/half.h: Likewise.
* soft-fp/trunctfhf2.c: Likewise.

7 years agoAdd issubnormal.
Joseph Myers [Wed, 21 Sep 2016 20:52:02 +0000 (20:52 +0000)] 
Add issubnormal.

TS 18661-1 adds an issubnormal classification macro to <math.h>.  This
patch implements it for glibc.  There are no new underlying functions
in libm because the implementation uses fpclassify; any optimizations
for this macro should be done through adding __builtin_subnormal in
GCC and using it in the header for suitable GCC versions, not through
adding other optimized inline or out-of-line versions to glibc.

The intended structure of the NEWS entry for <math.h> features from TS
18661-1 is like:

* New <math.h> features are added from TS 18661-1:2014:

  - Nearest integer functions: roundeven, roundevenf, roundevenl.

  - Comparison macros: iseqsig.

  - Classification macros: iscanonical, issubnormal, iszero.

(that is, following the grouping of interfaces in TS 18661-1:2014,
with any group where any interfaces are new in glibc 2.25 being listed
like that).

Tested for x86_64 and x86.

* math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (issubnormal): New
macro.
* math/libm-test.inc (issubnormal_test_data): New array.
(issubnormal_test): New function.
* manual/arith.texi (Floating Point Classes): Document
issubnormal.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.

7 years agoAdd <stdint.h> integer width macros.
Joseph Myers [Wed, 21 Sep 2016 17:06:36 +0000 (17:06 +0000)] 
Add <stdint.h> integer width macros.

TS 18661-1 defines macros for the width of integer types, intended for
use with the fromfp functions to convert from floating-point types to
integer types of any width, in any rounding mode and with control over
whether "inexact" is raised.  Such macros are, of course, more
generally useful than just with those functions.

Those macros are added to <limits.h> and <stdint.h>.  Having
previously added the <limits.h> macros, this patch adds the <stdint.h>
ones.  I've also added these macros to GCC's headers for GCC 7, but
for glibc systems, the definitions in GCC's <stdint.h> will only be
used with -ffreestanding.

Tested for x86_64 and x86.

* sysdeps/generic/stdint.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT8_WIDTH): New macro.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT8_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT16_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT16_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT32_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT32_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT64_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT64_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST8_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST8_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST16_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST16_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST32_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST32_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST64_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST64_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST8_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST8_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST16_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST16_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST32_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST32_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST64_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST64_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INTPTR_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINTPTR_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (INTMAX_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINTMAX_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (PTRDIFF_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (SIG_ATOMIC_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (SIZE_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (WCHAR_WIDTH): Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (WINT_WIDTH): Likewise.
* manual/arith.texi (Integers): Document these macros for types
specified by width properties.
* manual/lang.texi (Width of Type): Document these macros for
other standard typedefs.
* stdlib/tst-width-stdint.c: New file.
* stdlib/Makefile (tests): Add tst-width-stdint.

7 years agoresolv: Remove unsupported hook functions from the API [BZ #20016]
Florian Weimer [Wed, 21 Sep 2016 14:30:27 +0000 (16:30 +0200)] 
resolv: Remove unsupported hook functions from the API [BZ #20016]

7 years agomalloc: Manual part of conversion to __libc_lock
Florian Weimer [Wed, 21 Sep 2016 14:28:08 +0000 (16:28 +0200)] 
malloc: Manual part of conversion to __libc_lock

This removes the old mutex_t-related definitions from malloc-machine.h,
too.

7 years ago<arpa/nameser.h>: Remove RR type classification macros [BZ #20592]
Florian Weimer [Wed, 21 Sep 2016 14:27:14 +0000 (16:27 +0200)] 
<arpa/nameser.h>: Remove RR type classification macros [BZ #20592]

The macros are no longer up-to-date, and the classification is not
useful.  In this particular case, removal without prior deprecation
seems the right approach.

7 years ago<arpa/nameser.h>, <arpa/nameser_compat.h>: Remove versions
Florian Weimer [Wed, 21 Sep 2016 14:09:20 +0000 (16:09 +0200)] 
<arpa/nameser.h>, <arpa/nameser_compat.h>: Remove versions

Our header files no longer match the BIND versions.

7 years agoresolv: Remove the BIND_4_COMPAT macro
Florian Weimer [Wed, 21 Sep 2016 14:09:03 +0000 (16:09 +0200)] 
resolv: Remove the BIND_4_COMPAT macro

7 years agoRemove obsolete DNSSEC support [BZ #20591]
Florian Weimer [Wed, 21 Sep 2016 14:08:31 +0000 (16:08 +0200)] 
Remove obsolete DNSSEC support [BZ #20591]

The removed function declaration have never been implemented in libresolv.

7 years agomanual: Clarify the documentation of strverscmp [BZ #20524]
Florian Weimer [Wed, 21 Sep 2016 13:41:17 +0000 (15:41 +0200)] 
manual: Clarify the documentation of strverscmp [BZ #20524]

7 years agoAdd test case for O_TMPFILE handling in open, openat
Florian Weimer [Wed, 21 Sep 2016 13:24:01 +0000 (15:24 +0200)] 
Add test case for O_TMPFILE handling in open, openat

Also put xasprintf into test-skeleton.c (written in such a way that
including <stdarg.h> is not needed).

7 years agoAvoid running $(CXX) during build to obtain header file paths
Florian Weimer [Wed, 21 Sep 2016 08:45:32 +0000 (10:45 +0200)] 
Avoid running $(CXX) during build to obtain header file paths

This reduces the build time somewhat and is particularly noticeable
during rebuilds with few code changes.

7 years agoGenerate .op pattern rules for profiling builds only
Florian Weimer [Wed, 21 Sep 2016 08:45:19 +0000 (10:45 +0200)] 
Generate .op pattern rules for profiling builds only

.op pattern rules are not used in non-profiling builds.

This does not cause any changes to both profiling and non-profiling
builds.

7 years agosln: Preprocessor cleanups
Florian Weimer [Wed, 21 Sep 2016 08:42:52 +0000 (10:42 +0200)] 
sln: Preprocessor cleanups

7 years agoFix old-style function definition
Samuel Thibault [Tue, 20 Sep 2016 20:25:37 +0000 (22:25 +0200)] 
Fix old-style function definition

* mach/errstring.c (mach_error_type, mach_error_string): Fix old-style
function definition.

7 years agomach: Fix old-style function definition.
Samuel Thibault [Tue, 20 Sep 2016 20:24:13 +0000 (22:24 +0200)] 
mach: Fix old-style function definition.

* mach/mach_error.c (mach_error): Fix old-style function definition.

7 years agoposix: Correctly block/unblock all signals on Linux posix_spawn
Adhemerval Zanella [Wed, 14 Sep 2016 17:41:21 +0000 (14:41 -0300)] 
posix: Correctly block/unblock all signals on Linux posix_spawn

This patch correctly block and unblocks all signals when executing
Linux posix_spawn by using the __libc_signal_{un}block_all functions
instead of default sigprocmask.  The latter might remove both
SIGCANCEL and SIGSETXID from the blocked signal list.

Checked on x86_64, i686, powerpc64le, and aarch64.

* sysdeps/unix/sysv/linux/spawni.c (__spawnix): Correctly block and unblock
all signals when executing the clone vfork child.
(SIGALL_SET): Remove macro.

7 years agoposix: Correctly enable/disable cancellation on Linux posix_spawn
Adhemerval Zanella [Wed, 14 Sep 2016 17:07:20 +0000 (14:07 -0300)] 
posix: Correctly enable/disable cancellation on Linux posix_spawn

This patch correctly enable and disable asynchronous cancellation on
Linux posix_spawn.  Current code invert the logic by enabling and
disabling instead.  It also adds a new test to check if posix_spawn
is not a cancellation entrypoint.

Checked on x86_64, i686, powerpc64le, and aarch64.

* nptl/Makefile (tests): Add tst-exec5.
* nptl/tst-exec5.c: New file.
* sysdeps/unix/sysv/linux/spawni.c (__spawni): Correctly enable and disable
asynchronous cancellation.

7 years agoFix exc2signal.c template
Samuel Thibault [Tue, 20 Sep 2016 19:58:36 +0000 (21:58 +0200)] 
Fix exc2signal.c template

As a follow-up to 0e3426bbcf2ff61d06d580fc9362fde79953a281

* hurd/exc2signal.c: #include <hurd/signal.h>
(_hurd_exception2signal): Replace 'exception', 'code', 'subcode',
'sigcode', 'error' parameters with 'detail' parameter.  Fix code
accordingly.

7 years agoBuild s_nan* objects from a generic template
Paul E. Murphy [Mon, 12 Sep 2016 22:32:07 +0000 (17:32 -0500)] 
Build s_nan* objects from a generic template

This requires adding a macro to synthesize the call
to __strto*_nan.  Since this is likely to be the only
usage ever for strto* functions in generated libm
calls, a dedicated macro is defined for it.

7 years agoRemove __nan{f,,l} macros
Paul E. Murphy [Mon, 12 Sep 2016 22:11:45 +0000 (17:11 -0500)] 
Remove __nan{f,,l} macros

Use the GCC builtin instead.  With the exception of the
files built from a template, they are unused.  This
is preparation for making the s_nanF objects generated.

7 years agoMake ldexpF generic.
Paul E. Murphy [Thu, 8 Sep 2016 13:48:08 +0000 (08:48 -0500)] 
Make ldexpF generic.

This one is a little more tricky since it is built both for
libm and libc, and exports multiple aliases.

To simplify aliasing, a new macro is introduced which handles
aliasing to two symbols.  By default, it just applies
declare_mgen_alias to both target symbols.

Likewise, the makefile is tweaked a little to generate
templates for shared files too, and a new rule is added
to build m_*.c objects from the objpfx directory.

Verified there are no symbol or code changes using a script
to diff the *_ldexp* object files on s390x, aarch64, arm,
x86_64, and ppc64.

7 years agoRemove remnants of .og patterns
Florian Weimer [Tue, 20 Sep 2016 10:18:13 +0000 (12:18 +0200)] 
Remove remnants of .og patterns

This was used by --enable-omitfp, and the bulk of it was removed in this
commit:

commit bdeba1354b7364d9b7857a048286a71ddbcdff86
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sat Jan 7 11:29:31 2012 -0500

    Remove --enable-omitfp support