platform/upstream/glibc.git
7 years agoCall the right helper function when setting mallopt M_ARENA_MAX (BZ #21338)
Wladimir J. van der Laan [Sat, 1 Apr 2017 07:09:09 +0000 (12:39 +0530)]
Call the right helper function when setting mallopt M_ARENA_MAX (BZ #21338)

Fixes a typo introduced in commit
be7991c0705e35b4d70a419d117addcd6c627319. This caused
mallopt(M_ARENA_MAX) as well as the environment variable
MALLOC_ARENA_MAX to not work as intended because it set the
wrong internal parameter.

  [BZ #21338]
* malloc/malloc.c: Call do_set_arena_max for M_ARENA_MAX
instead of incorrect do_set_arena_test

7 years agoFix condition for inclusion of math-finite.h for long double
Gabriel F. T. Gomes [Fri, 31 Mar 2017 12:31:10 +0000 (09:31 -0300)]
Fix condition for inclusion of math-finite.h for long double

The condition for declaration of long double functions in
math-finite.h was #ifdef __MATH_DECLARE_LDOUBLE before the
macroization of this file.  After the macroization, it was incorreclty
changed to #if __MATH_DECLARE_LDOUBLE, which broke the build for arm.

* math/math.h: Fix check for __MATH_DECLARE_LDOUBLE.
* math/bits/math-finite.h: Likewise.

7 years agofts: Fix symbol redirect for fts_set [BZ #21289]
Slava Barinov [Fri, 31 Mar 2017 06:49:25 +0000 (08:49 +0200)]
fts: Fix symbol redirect for fts_set [BZ #21289]

In a 32-bit environment with _FILE_OFFSET_BITS=64, the __REDIRECT macro
combined with __THROW generates an invalid C++ declaration.

7 years agoFix more test-errno issues
Adhemerval Zanella [Tue, 28 Mar 2017 19:44:19 +0000 (16:44 -0300)]
Fix more test-errno issues

This patch fixes some test-errno-linux unexpected returns for the
tested syscalls on some older kernels (I saw it on a Linux 3.8 on
armv7l).  Basically:

   - inotify_add_watch: Linux v3.8 (676a0675c) removed the test to
     check at least one valid bit in flags (to return EINVAL).  It
     was later added back in v3.9 (04df32fa1).

   - quotactl: returns ENOSYS for kernels not configured with
     CONFIG_QUOTA.

Checked on x86_64-linux-gnu and armv7l-linux-gnueabihf.

* sysdeps/unix/sysv/linux/test-errno-linux.c (do_test): Handle
non expected inotify_add_watch and quotactl return.

7 years agoChange return type in the declaration of __ieee754_rem_pio2l
Gabriel F. T. Gomes [Tue, 28 Mar 2017 17:48:57 +0000 (14:48 -0300)]
Change return type in the declaration of __ieee754_rem_pio2l

The implementation of __ieee754_rem_pio2l in ldbl-128, ldbl-128ibm,
and ldbl-96 return the type int32_t, whereas math_private.h declares
it as returning int.  This patch changes the declaration to match the
declaration in thoses directories, as well as it changes the stub
implementation in math/e_rem_pio2l.c, similarly.

* math/e_rem_pio2l.c (__ieee754_rem_pio2l): Change return type
to int32_t.
* sysdeps/generic/math_private.h: Declare __ieee754_rem_pio2l
as returning int32_t.

7 years agoMacroize inclusion of math-finite.h
Gabriel F. T. Gomes [Fri, 10 Mar 2017 12:47:18 +0000 (09:47 -0300)]
Macroize inclusion of math-finite.h

This patch macroizes the declarations in math/bits/math-finite.h
similarly to what math/bits/mathcalls.h does.  For each floating-point
type, the file is included once in math/math.h.  This will reduce the
amount of repetitive boilerplate required when adding float128
versions of these declarations.

Tested for powerpc64le and s390x.

* math/math.h: Include bits/math-finite.h once per
floating-point type.
* math/bits/math-finite.h: Macroize all declarations by
floating-point type.

7 years agoFix i686 memchr overflow calculation (BZ#21182)
Adhemerval Zanella [Tue, 14 Mar 2017 17:16:13 +0000 (14:16 -0300)]
Fix i686 memchr overflow calculation (BZ#21182)

This patch fixes the regression added by 23d2770 for final address
overflow calculation.  The subtraction of the considered size (16)
at line 120 is at wrong place, for sizes less than 16 subsequent
overflow check will not take in consideration an invalid size (since
the subtraction will be negative).  Also, the lea instruction also
does not raise the carry flag (CF) that is used in subsequent jbe
to check for overflow.

The fix is to follow x86_64 logic from 3daef2c where the overflow
is first check and a sub instruction is issued.  In case of resulting
negative size, CF will be set by the sub instruction and a NULL
result will be returned.  The patch also add similar tests reported
in bug report.

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

* string/test-memchr.c (do_test): Add BZ#21182 checks for address
near end of a page.
* sysdeps/i386/i686/multiarch/memchr-sse2.S (__memchr): Fix
overflow calculation.

7 years agoChange TEST_NAME to memcpy to fix IFUNC testing of multiple versions.
Steve Ellcey [Tue, 28 Mar 2017 16:07:03 +0000 (09:07 -0700)]
Change TEST_NAME to memcpy to fix IFUNC testing of multiple versions.

* benchtests/bench-memcpy-random.c (TEST_NAME): Change to memcpy.
(IMPL) Call with 1 instead of 0 as argument.

7 years agoConsolidate set* Linux implementation
Adhemerval Zanella [Fri, 20 Jan 2017 21:01:59 +0000 (19:01 -0200)]
Consolidate set* Linux implementation

This patch consolidates the Linux setegid, seteuid, setgid, setgroups,
setregid, setresgid, setresuid, setreuid, and setuid implementation on
default sysdeps/unix/sysv/linux/set*.c implementation.  It basically
removes all the architecture define implementations and add support for
__NR_set*32 syscall on Linux default implementation.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

* sysdeps/unix/sysv/linux/arm/setegid.c: Remove file.
* sysdeps/unix/sysv/linux/arm/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/setegid.c (setegid): Use
INLINE_SYSCALL_ERROR_RETURN_VALUE.
* sysdeps/unix/sysv/linux/seteuid.c (seteuid): Likewise.
* sysdeps/unix/sysv/linux/setgid.c (setgid): Use __NR_setgid32 if
defined.
* sysdeps/unix/sysv/linux/setgroups.c (setgroups): Use
__NR_setgroups32 if defined.
* sysdeps/unix/sysv/linux/setregid.c (__setregid): Use __NR_setregid32
if defined.
* sysdeps/unix/sysv/linux/setresgid.c (__setresgid): Use
__NR_setresgid32 is defined.
* sysdeps/unix/sysv/linux/setresuid.c (__setresuid): Use
__NR_setresuid32 if defined.
* sysdeps/unix/sysv/linux/setreuid.c (__setreuid): Use
__NR_setreuid32 if defined.
* sysdeps/unix/sysv/linux/setuid.c (__setuid): Use __NR_setuid32 if
defined.

7 years agolocaledata: hu_HU: fix multiple sorting bugs (bug 18934)
Egmont Koblinger [Thu, 23 Mar 2017 01:27:30 +0000 (21:27 -0400)]
localedata: hu_HU: fix multiple sorting bugs (bug 18934)

Fix the incorrect sorting order of a digraph and its geminated variant,
regression introduced by a faulty fix to bug 13547 in commit
b008d4c85619a753e441d7f473ba8af0db400bd6.

Fix two inconsistencies in sorting unusual capitalization of digraphs
(bug #18587).

Enable DIACRIT_FORWARD to work around bug #17750.

Sort foreign accents after the Hungarian ones.

Add extensive unittests containing all the examples from The Rules of
Hungarian Orthography and many more, including explanatory comments.

7 years agoDefine more termios.h macros unconditionally for alpha (bug 21277).
Joseph Myers [Mon, 27 Mar 2017 15:07:38 +0000 (15:07 +0000)]
Define more termios.h macros unconditionally for alpha (bug 21277).

termios.h should define IUCLC for UNIX98 and older XSI standards.  The
sysdeps/unix/sysv/linux/alpha version defines it only if __USE_MISC,
so causing some conform/ tests to fail.

Other versions define it unconditionally (I* being a reserved
namespace for this header); the API should be consistent between
architectures in the absence of a clear reason for it to differ (and
given that a symbol is part of the API on two architectures, I don't
see any reason for the feature test macros required ever to differ
between those architectures), so this patch makes the alpha version
define it unconditionally as well.  Two non-POSIX macros alongside it,
IMAXBEL and IUTF8, are also defined unconditionally on other
architectures, so this patch makes them consistent by defining them
unconditionally on alpha as well.

Tested (compilation only) with build-many-glibcs.py.

[BZ #21277]
* sysdeps/unix/sysv/linux/alpha/bits/termios.h (IUCLC): Define
unconditionally.
(IMAXBEL): Likewise.
(IUTF8): Likewise.

7 years ago[AArch64] Update libm-test-ulps
Szabolcs Nagy [Mon, 27 Mar 2017 11:01:34 +0000 (12:01 +0100)]
[AArch64] Update libm-test-ulps

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

7 years agoActually add bench-memcpy-random
Siddhesh Poyarekar [Sun, 26 Mar 2017 13:31:50 +0000 (19:01 +0530)]
Actually add bench-memcpy-random

git-add and commit the benchmark that Wilco posted on the list.

7 years agoUpdate old tunables framework document/script.
Sunyeop Lee [Fri, 24 Mar 2017 05:38:28 +0000 (11:08 +0530)]
Update old tunables framework document/script.

Since commit 8b9e9c3c0bae497ad5e2d0ae2f333f62feddcc12, security_level replaces
is_secure. There were some old files need to be updated.

2017-03-23  Sunyeop Lee  <sunyeop97@gmail.com>

* README.tunables: Updated descriptions.
* elf/dl-tunables.list: Fixed typo: SXID_NONE -> NONE.
* scripts/gen-tunables.awk: Updated the code related to the commit.

7 years agoAdd a new randomized memcpy test for copies up to 256 bytes. The distribution
Wilco Dijkstra [Thu, 23 Mar 2017 19:00:02 +0000 (19:00 +0000)]
Add a new randomized memcpy test for copies up to 256 bytes.  The distribution
of the size and alignment is based on a trace of SPEC2006.  Instead of
repeating the same copy over and over again like the existing tests, it times
several thousand different copies to more accurately estimate the overhead of
branch prediction.

* benchtests/Makefile (string-benchset): Add memcpy-random.
* benchtests/bench-memcpy-random.c: New file.

7 years agoChange the order of function attributes in printf.h
Tulio Magno Quites Machado Filho [Thu, 23 Mar 2017 18:45:00 +0000 (15:45 -0300)]
Change the order of function attributes in printf.h

ISO C++ section 8.3.5 [dcl.fct] requires exception specifications
to appear before attribute specifiers in function declarations.

This patch fixes issues reported by stdio-common/check-installed-headers-cxx.

* stdio-common/printf.h (register_printf_modifier): Change the
order of __wur and __THROW.
(register_printf_type): Likewise.

7 years agoUpdate string tests to use the support test driver.
Wainer dos Santos Moschetta [Thu, 23 Mar 2017 14:32:17 +0000 (11:32 -0300)]
Update string tests to use the support test driver.

Replaced all imports of test-skeleton.c with support/test-driver.c.

In some cases it was needed to adjust do_test to return int
instead of static int since that is the method's signature expected by
test-driver.c.

Checked on x86_64.

* string/test-string.h (TEST_FUNCTION): Use test_main instead of
test_main ().
(CMDLINE_PROCESS): Use function instead of defined macro.
* debug/test-strcpy_chk.c: Import support/test-driver.c and also
<suppport/support.h> to use set_fortify_handler().
* string/bug-envz1.c: Import support/test-driver.c instead of
test-skeleton.c.
* string/bug-strcoll2.c: Likewise.
* string/bug-strtok1.c: Likewise.
* string/stratcliff.c: Likewise.
* string/test-ffs.c: Likewise.
* string/test-memccpy.c: Likewise.
* string/test-memchr.c: Likewise.
* string/test-memcmp.c: Likewise.
* string/test-memcpy.c: Likewise.
* string/test-memmem.c: Likewise.
* string/test-memmove.c: Likewise.
* string/test-memrchr.c: Likewise.
* string/test-memset.c: Likewise.
* string/test-rawmemchr.c: Likewise.
* string/test-strcasecmp.c: Likewise.
* string/test-strcasestr.c: Likewise.
* string/test-strcat.c: Likewise.
* string/test-strchr.c: Likewise.
* string/test-strcmp.c: Likewise.
* string/test-strcpy.c: Likewise.
* string/test-string.h: Likewise.
* string/test-strlen.c: Likewise.
* string/test-strncasecmp.c: Likewise.
* string/test-strncat.c: Likewise.
* string/test-strncmp.c: Likewise.
* string/test-strncpy.c: Likewise.
* string/test-strnlen.c: Likewise.
* string/test-strpbrk.c: Likewise.
* string/test-strrchr.c: Likewise.
* string/test-strspn.c: Likewise.
* string/test-strstr.c: Likewise.
* string/tst-bswap.c: Likewise.
* string/tst-cmp.c: Likewise.
* string/tst-endian.c: Likewise.
* string/tst-inlcall.c: Likewise.
* string/tst-strcoll-overflow.c: Likewise.
* string/tst-strfry.c: Likewise.
* string/tst-strlen.c: Likewise.
* string/tst-strtok.c: Likewise.
* string/tst-strtok_r.c: Likewise.
* string/tst-strxfrm.c: Likewise.
* string/tst-strxfrm2.c: Likewise.
* string/tst-svc.c: Likewise.
* string/tst-svc2.c: Likewise.

7 years agoAnother round of inclusion fixes for _ISOMAC testsuite.
Zack Weinberg [Wed, 22 Mar 2017 12:39:36 +0000 (08:39 -0400)]
Another round of inclusion fixes for _ISOMAC testsuite.

* stdio-common/bug25.c: Include stdlib.h.
* support/tst-support_format_dns_packet.c: Include stdio.h,
stdlib.h, and string.h.
* support/tst-support_record_failure.c: Include string.h.
* support/tst-support_record_failure-2.sh: Adjust line number
expectations and correct a typo in an error message.

7 years agox86-64: Improve branch predication in _dl_runtime_resolve_avx512_opt [BZ #21258]
H.J. Lu [Tue, 21 Mar 2017 17:59:31 +0000 (10:59 -0700)]
x86-64: Improve branch predication in _dl_runtime_resolve_avx512_opt [BZ #21258]

On Skylake server, _dl_runtime_resolve_avx512_opt is used to preserve
the first 8 vector registers.  The code layout is

  if only %xmm0 - %xmm7 registers are used
     preserve %xmm0 - %xmm7 registers
  if only %ymm0 - %ymm7 registers are used
     preserve %ymm0 - %ymm7 registers
  preserve %zmm0 - %zmm7 registers

Branch predication always executes the fallthrough code path to preserve
%zmm0 - %zmm7 registers speculatively, even though only %xmm0 - %xmm7
registers are used.  This leads to lower CPU frequency on Skylake
server.  This patch changes the fallthrough code path to preserve
%xmm0 - %xmm7 registers instead:

  if whole %zmm0 - %zmm7 registers are used
    preserve %zmm0 - %zmm7 registers
  if only %ymm0 - %ymm7 registers are used
     preserve %ymm0 - %ymm7 registers
  preserve %xmm0 - %xmm7 registers

Tested on Skylake server.

[BZ #21258]
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve_opt):
Define only if _dl_runtime_resolve is defined to
_dl_runtime_resolve_sse_vex.
* sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_opt):
Fallthrough to _dl_runtime_resolve_sse_vex.

7 years agoRegenerate INSTALL.
Joseph Myers [Tue, 21 Mar 2017 16:40:16 +0000 (16:40 +0000)]
Regenerate INSTALL.

7 years agoMerge branch 'master' of ssh://sourceware.org/git/glibc
Thorsten Kukuk [Tue, 21 Mar 2017 15:47:00 +0000 (16:47 +0100)]
Merge branch 'master' of ssh://sourceware.org/git/glibc

Conflicts:
ChangeLog

7 years agoFix failing test malloc/tst-interpose-nothread with GCC 7.
Stefan Liebler [Tue, 21 Mar 2017 15:41:56 +0000 (16:41 +0100)]
Fix failing test malloc/tst-interpose-nothread with GCC 7.

The test malloc/tst-interpose-nothread fails on s390x if built
with GCC 7 and glibc commit "Remove the str(n)dup inlines
from string/bits/string2.h. Although inlining"
(ae65d4f3c3995279ca458c460ebf8bab1885fa03) with output:
error: free: 0x3fffdffa010: invalid allocation index: 0 (not less than 0)

The destructor check_for_allocations in malloc/tst-interpose-aux.c is
called twice.  One time after the test-child-process has finished successfully
and once after the test-parent-process finishes.
During the latter invocation, allocation_index == 0.  GCC 7 is now inlining the
free function and calls unconditionally fail in get_header as
header->allocation_index (type == size_t) is always >= allocation_index (= 0).
Before the mentioned commit above, strdup was replaced by strlen, malloc and
memcpy.  The malloc call was also inlined and allocation_index was set to one.

This patch moves the already existing compiler barrier before the invocation
of free.

ChangeLog:

* malloc/tst-interpose-aux.c (check_for_allocations):
Move compiler barrier before free.

7 years agoDeprecate libnsl by default (only shared library will be
Thorsten Kukuk [Tue, 21 Mar 2017 14:14:27 +0000 (15:14 +0100)]
Deprecate libnsl by default (only shared library will be
build for backward compatibility, no linking possible) and disable building
of libnss_compat, libnss_nis and libnss_nisplus, except --enable-obsolete-nsl
option is given to configure.

        * config.h.in: Add LINK_OBSOLETE_NSL.
        * config.make.in: Add build-obsolete-nsl.
        * configure.ac: Add obsolete-nsl option.
        * include/libc-symbols.h: Define libnsl_hidden_nolink_def.
        * include/rpcsvc/yp.h: Add missing functions as libnsl_hidden_proto.
        * include/rpcsvc/nislib.h: Likewise.
        * include/rpcsvc/ypclnt.h: Likewise.
        * manual/install.texi: Document --enable-obsolete-nsl.
        * nis/Makefile: Build only libnsl by default (add build-obsolete-nsl).
        * nis/nis_add.c: Replace libnsl_hidden_def with
        libnsl_hidden_nolink_def.
        * nis/nis_addmember.c: Likewise.
        * nis/nis_call.c: Likewise.
        * nis/nis_clone_obj.c: Likewise.
        * nis/nis_defaults.c: Likeise.
        * nis/nis_domain_of_r.c: Likewise.
        * nis/nis_error.c: Likewise.
        * nis/nis_file.c: Likewise.
        * nis/nis_free.c: Likewise.
        * nis_local_names.c: Likewise.
        * nis/nis_lookup.c: Likewise.
        * nis/nis_modify.c: Likewise.
        * nis/nis_print.c: Likewise.
        * nis/nis_remove.c: Likewise.
        * nis/nis_table.c: Likewise.
        * nis/nis_util.c: Likewise.
        * nis/nis_xdr.c: Likewise.
        * nis/yp_xdr.c: Likewise.
        * nis/ypclnt.c: Likewise.
        * nis/ypupdate_xdr.c: Likewise.
        * nis/nis_checkpoint.c: Add libnsl_hidden_nolink_def to all functions.
        * nis/nis_clone_dir.c: Likewise.
        * nis/nis_clone_res.c: Likewise.
        * nis/nis_creategroup.c: Likewise.
        * nis/nis_destroygroup.c: Likewise.
        * nis/nis_domain_of.c: Likewise.
        * nis/nis_getservlist.c: Likewise.
        * nis/nis_ismember.c: Likewise.
        * nis/nis_mkdir.c: Likewise.
        * nis/nis_ping.c: Likewise.
        * nis/nis_print_group_entry.c: Likewise.
        * nis/nis_removemember.c: Likewise.
        * nis/nis_rmdir.c: Likewise.
        * nis/nis_server.c: Likewise.
        * nis/nis_subr.c: Likewise.
        * nis/nis_verifygroup.c: Likewise.

Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
7 years agoconformtest: Add x32 XFAILs for mq_attr element types (bug 21279).
Joseph Myers [Mon, 20 Mar 2017 21:30:28 +0000 (21:30 +0000)]
conformtest: Add x32 XFAILs for mq_attr element types (bug 21279).

POSIX specifies long as the type of elements of struct mq_attr.  For
x32, they are __syscall_slong_t (i.e. long long).  This patch XFAILs
the corresponding tests for x32 in the conformtest expectations (the
bug should not be closed without an actual fix).

Tested with build-many-glibcs.py.

[BZ #21279]
* sysdeps/unix/sysv/linux/x86_64/x32/Makefile
[$(subdir) = conform] (conformtest-xfail-conds): Update comment.
* conform/data/mqueue.h-data (mq_attr.mq_flags): XFAIL for
x86_64-x32-linux.
(mq_attr.mq_maxmsg): Likewise.
(mq_attr.mq_msgsize): Likewise.
(mq_attr.mq_curmsgs): Likewise.

7 years agoconformtest: Add mips XFAIL for struct stat st_rdev type (bug 21278).
Joseph Myers [Mon, 20 Mar 2017 21:28:16 +0000 (21:28 +0000)]
conformtest: Add mips XFAIL for struct stat st_rdev type (bug 21278).

MIPS o32 struct stat has the wrong type of st_rdev.  This patch XFAILs
that test in the conformtest expectations for this case (the bug
should not be closed without an actual fix, however).

Tested with build-many-glibcs.py.

[BZ #21278]
* sysdeps/unix/sysv/linux/mips/mips32/Makefile
[$(subdir) = conform] (conformtest-xfail-conds): Update comment.
* conform/data/sys/stat.h-data (stat.st_rdev): XFAIL for
mips-o32-linux.

7 years agoFix alpha termios.h NL2, NL3 namespace (bug 21268).
Joseph Myers [Mon, 20 Mar 2017 17:32:19 +0000 (17:32 +0000)]
Fix alpha termios.h NL2, NL3 namespace (bug 21268).

sysdeps/unix/sysv/linux/alpha/bits/termios.h defines NL2 and NL3 for
__USE_MISC || __USE_XOPEN.  These should only be defined for
__USE_MISC as they are not part of any standard namespace.  This patch
conditions them accordingly, matching the powerpc version of the
header (the only other one in glibc that defines these macros).

Tested (compilation only) with build-many-glibcs.py.

[BZ #21268]
* sysdeps/unix/sysv/linux/alpha/bits/termios.h (NL2): Define only
if [__USE_MISC]
(NL3): Likewise.

7 years agoposix_spawn: fix stack setup on ia64 [BZ #21275]
Mike Frysinger [Mon, 20 Mar 2017 08:47:56 +0000 (04:47 -0400)]
posix_spawn: fix stack setup on ia64 [BZ #21275]

The ia64-specific clone2 call expects the base of the stack mapping and
the stack size as sep arguments, not an initial stack value as on other
stack-grows-down architectures.  Reuse the stack-grows-up macro so we
pass in the right stack base.

Reported-by: Matt Turner <mattst88@gentoo.org>
7 years agolinux ttyname and ttyname_r: do not return wrong results
Christian Brauner [Fri, 27 Jan 2017 14:59:59 +0000 (15:59 +0100)]
linux ttyname and ttyname_r: do not return wrong results

If a link (say /proc/self/fd/0) pointing to a device, say /dev/pts/2, in a
parent mount namespace is passed to ttyname, and a /dev/pts/2 exists (in a
different devpts) in the current namespace, then it returns /dev/pts/2.
But /dev/pts/2 is NOT the current tty, it is a different file and device.

Detect this case and return ENODEV.  Userspace can choose to take this as a hint
that the fd points to a tty device but to act on the fd rather than the link.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconformtest: XFAIL tv_nsec tests for x32 (bug 16437).
Joseph Myers [Sat, 18 Mar 2017 00:24:13 +0000 (00:24 +0000)]
conformtest: XFAIL tv_nsec tests for x32 (bug 16437).

This patch XFAILs the conformtest tv_nsec tests for x32 so that the
incorrect type does not potentially hide other failures.  As this is
not a fix for the bug, it should remain open in Bugzilla.

Tested (compilation only) with build-many-glibcs.py.

[BZ #16437]
* sysdeps/unix/sysv/linux/x86_64/x32/Makefile
[$(subdir) = conform] (conformtest-xfail-conds): New variable.
* conform/data/signal.h-data (timespec.tv_nsec): XFAIL for
x86_64-x32-linux.
* conform/data/sys/select.h-data (timespec.tv_nsec): Likewise.
* conform/data/sys/stat.h-data (timespec.tv_nsec): Likewise.
* conform/data/time.h-data (timespec.tv_nsec): Likewise.

7 years agoFix sparc64 bits/setjmp.h namespace (bug 21261).
Joseph Myers [Sat, 18 Mar 2017 00:17:25 +0000 (00:17 +0000)]
Fix sparc64 bits/setjmp.h namespace (bug 21261).

sysdeps/unix/sysv/linux/sparc/bits/setjmp.h defines 64-bit __jmp_buf
with a load of identifiers that are not part of any standard
namespace, resulting in conform/ tests failing.  This patch fixes this
by moving those identifiers to the implementation namespace, so
enabling the conform/ tests to pass for sparc64.

Tested (compilation only) for sparc64 with build-many-glibcs.py.

[BZ #21261]
* sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
[__WORDSIZE == 64 && !_ASM] (__sparc64_jmp_buf): Use reserved
names for all fields.
* sysdeps/sparc/sparc64/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Update
for jmp_buf field renaming.
(_JMPBUF_UNWINDS_ADJ): Likewise.

7 years agoconformtest: Handle conditional XFAILs with allow-header.
Joseph Myers [Sat, 18 Mar 2017 00:16:05 +0000 (00:16 +0000)]
conformtest: Handle conditional XFAILs with allow-header.

This patch fixes the conformtest handling of headers listed in
allow-header to process xfail[cond]- in the expectations for those
headers.

Tested with build-many-glibcs.py.

* conform/conformtest.pl: Handle xfail[cond]- in header mentioned
with allow-header.

7 years agoFurther harden glibc malloc metadata against 1-byte overflows.
DJ Delorie [Fri, 17 Mar 2017 19:31:38 +0000 (15:31 -0400)]
Further harden glibc malloc metadata against 1-byte overflows.

Additional check for chunk_size == next->prev->chunk_size in unlink()

2017-03-17  Chris Evans  <scarybeasts@gmail.com>

* malloc/malloc.c (unlink): Add consistency check between size and
next->prev->size, to further harden against 1-byte overflows.

7 years agoUse CPU_FEATURES_CPU_P to check if AVX is available
H.J. Lu [Fri, 17 Mar 2017 18:38:13 +0000 (11:38 -0700)]
Use CPU_FEATURES_CPU_P to check if AVX is available

Don't use bit_cpu_AVX directly.

* sysdeps/x86/cpu-features.c (init_cpu_features): Check AVX with
CPU_FEATURES_CPU_P.

7 years agoMake alpha termios.h define IXANY unconditionally (bug 21259).
Joseph Myers [Fri, 17 Mar 2017 16:27:03 +0000 (16:27 +0000)]
Make alpha termios.h define IXANY unconditionally (bug 21259).

sysdeps/unix/sysv/linux/alpha/bits/termios.h defines IXANY only if
__USE_MISC.  But it's in the base standard for POSIX.1:2008, and
XSI-shaded in previous standards.  This patch makes the header define
it unconditionally, like other versions of this header do (it's always
reserved by standards that don't require it, so defining
unconditionally is OK by the standards).

Tested (compilation only) for alpha with build-many-glibcs.py.  Note
that there are still termios.h conformtest failures after this patch
because of other issues with the alpha version of this header.

[BZ #21259]
* sysdeps/unix/sysv/linux/alpha/bits/termios.h (IXANY): Define
unconditionally, not just for [__USE_MISC].

7 years agoconformtest: Add mips XFAIL for struct stat st_dev type (bug 17786).
Joseph Myers [Fri, 17 Mar 2017 02:54:59 +0000 (02:54 +0000)]
conformtest: Add mips XFAIL for struct stat st_dev type (bug 17786).

As noted in bug 17786, MIPS o32 struct stat has the wrong type of
st_dev.  This patch XFAILs that test in the conformtest expectations
for this case (the test still fails after the patch because there's
also a similar issue for st_rdev that needs reporting and XFAILing
separately, and the bug should not be closed without an actual fix,
not just XFAILing).

Tested for mips with build-many-glibcs.py.

[BZ #17786]
* sysdeps/unix/sysv/linux/mips/mips32/Makefile: New file.
* conform/data/sys/stat.h-data (stat.st_dev): XFAIL for
mips-o32-linux.

7 years agoAdd missing piece to last ChangeLog entry.
Joseph Myers [Fri, 17 Mar 2017 02:50:51 +0000 (02:50 +0000)]
Add missing piece to last ChangeLog entry.

7 years agoconformtest: Add alpha XFAIL for struct netent n_net type (bug 21260).
Joseph Myers [Fri, 17 Mar 2017 02:42:16 +0000 (02:42 +0000)]
conformtest: Add alpha XFAIL for struct netent n_net type (bug 21260).

As noted in bug 21260, sysdeps/unix/sysv/linux/alpha/bits/netdb.h
defines struct netent with n_net of type unsigned long instead of the
correct uint32_t.  This patch XFAILs that test in the conformtest
expectations for alpha.  (This is not a fix for the bug, and it should
not be closed without an actual fix.)

Tested for alpha with build-many-glibcs.py.

[BZ #21260]
* sysdeps/unix/sysv/linux/alpha/Makefile
[$(subdir) = conform] (conformtest-xfail-conds): New variable.

7 years agoconformtest: Skip execution tests when cross-compiling.
Joseph Myers [Fri, 17 Mar 2017 01:21:10 +0000 (01:21 +0000)]
conformtest: Skip execution tests when cross-compiling.

This patch makes conformtest skip execution tests when
cross-compiling, as an interim step towards running most of these
tests (presently disabled) in that case.  It omits the (obvious)
Makefile change to actually enable the conformtest tests when
cross-compiling, as there are still enough failures seen with
build-many-glibcs.py that I'd like to get the results cleaner before
enabling these tests.

Tested for x86_64, and with the tests actually enabled for
cross-compilation with build-many-glibcs.py.

* conform/conformtest.pl ($cross): New variable.
(--cross): New command-line option.
(runtest): Skip test execution when cross-compiling.
* conform/Makefile (conformtest-cross): New variable.
($(conformtest-header-tests)): Pass $(conformtest-cross) to
conformtest.pl.

7 years agoconformtest: Support system-specific XFAILs.
Joseph Myers [Fri, 17 Mar 2017 01:08:27 +0000 (01:08 +0000)]
conformtest: Support system-specific XFAILs.

conformtest has an internal XFAIL mechanism to allow failures of
individual expectations to be ignored, so that known hard-to-fix
failures (e.g. those affecting ABIs or requiring kernel changes) do
not cause the overall tests to FAIL and so hide other failures from
the same (header, standard) pair.

Various such bugs are system-specific, so this patch adds a mechanism
to allow system-specific XFAILs.  A system-independent XFAIL is
achieved by putting "xfail-" at the start of the relevant expectation
in the *-data files.  A system-specific XFAIL instead uses
"xfail[cond]-", where "cond" is a condition listed in
conformtest-xfail-conds in a sysdeps makefile (so one for x32 might
set conformtest-xfail-conds = x86_64-x32-linux, for example, and then
an expectation for tv_nsec's type could use
xfail[x86_64-x32-linux]-).  The actual names are arbitrary, just
needing to match between the makefiles and the expectations, and if
necessary you can use "xfail[cond1|cond2]-" for a test that is
expected to fail under multiple conditions.  As with
system-independent XFAILs, I think system-specific ones should have a
bug filed in Bugzilla and a comment referencing that bug.

Tested for x86_64, including with test expectations and makefiles
changed to use the new facility.

* conform/conformtest.pl ($xfail_str): New variable.
(--xfail=): New command-line option.
(top level): Handle expectations starting xfail[cond]-.
* conform/Makefile (conformtest-xfail): New variable.
($(conformtest-header-tests)): Pass $(conformtest-xfail) to
conformtest.pl.

7 years agoconformtest: Make more tests into compilation tests.
Joseph Myers [Thu, 16 Mar 2017 17:51:23 +0000 (17:51 +0000)]
conformtest: Make more tests into compilation tests.

The conformtest header tests test some things through compilation
tests and others through execution tests.  This patch makes more of
the tests into compilation tests, using _Static_assert (note: for
float.h tests on floating-point values this is depending on a GNU
extension, that those assertions are allowed in the absence of
-pedantic although they aren't strictly integer constant expressions).
The remaining execution tests are for values of things listed as
"symbol" (in fact no such things have a value expectation listed) and
for values of macros defined as string constants (three such values
listed in total).

This is intended as preparation for enabling the vast bulk of the
tests to run for cross compilation.  (Even the few remaining execution
tests ought in principle to run for cross compilation when a test
wrapper is defined, but that's more complicated.  The existing
execution tests for native builds in fact are linked and run with an
existing installed libc that's required to exist to link against,
rather than with the newly built libc; only the new headers are used.)

Tested for x86_64.

* conform/conformtest.pl: Use compilation instead of execution
tests for testing values of constants and usability in #if.

7 years agoXFAIL catan and catanh tests on ibm128
Tulio Magno Quites Machado Filho [Thu, 16 Mar 2017 13:18:46 +0000 (10:18 -0300)]
XFAIL catan and catanh tests on ibm128

Mark 4 catan and catanh tests as xfail-rounding:ibm128-libgcc.
After this patch all catan and catanh tests pass on ibm128.

Regenerated auto-libm-test-out using gmp 6.1.2, mpfr 3.1.5 and upstream
mpc (9ef8030e50),

Tested on powerpc, powerpc64 and powerpc64le.

* math/auto-libm-test-in: Mark some catan and catanh as
xfail-rounding:ibm128-libgcc.
* math/auto-libm-test-out-catan: Regenerate.
* math/auto-libm-test-out-catanh: Likewise.

7 years agoRemove C++ namespace handling from glibc headers.
Joseph Myers [Thu, 16 Mar 2017 13:31:57 +0000 (13:31 +0000)]
Remove C++ namespace handling from glibc headers.

glibc headers include some code (not particularly consistent or
systematic) to put various declarations in C++ namespaces std and
__c99, if _GLIBCPP_USE_NAMESPACES is defined.

As noted in <https://gcc.gnu.org/ml/libstdc++/2017-03/msg00025.html>,
this macro was removed from libstdc++ in 2000.  I don't expect
compilation with such old versions of libstdc++ to work with current
glibc headers anyway (whereas old *binaries* are expected to stay
working with current glibc); this patch (which should be a no-op with
any libstdc++ version postdating that removal) removes all this code
from the glibc headers.

The begin-end-check.pl test, whose comments say it is about checking
these namespace macro calls, is also removed.  The code in that test
would have covered __BEGIN_DECLS / __END_DECLS as well, but if those
weren't properly matched it would show up with the
check-installed-headers-cxx tests, so I don't think there is an actual
use for keeping begin-end-check.pl with the namespace code removed.

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

* misc/sys/cdefs.h (__BEGIN_NAMESPACE_STD): Remove macro.
(__END_NAMESPACE_STD): Likewise.
(__USING_NAMESPACE_STD): Likewise.
(__BEGIN_NAMESPACE_C99): Likewise.
(__END_NAMESPACE_C99): Likewise.
(__USING_NAMESPACE_C99): Likewise.
* math/math.h (_Mdouble_BEGIN_NAMESPACE): Do not define and
undefine macro.
(_Mdouble_END_NAMESPACE): Likewise.
* ctype/ctype.h: Do not handle C++ namespaces.
* libio/bits/stdio-ldbl.h: Likewise.
* libio/stdio.h: Likewise.
* locale/locale.h: Likewise.
* math/bits/mathcalls.h: Likewise.
* setjmp/setjmp.h: Likewise.
* signal/signal.h: Likewise.
* stdlib/bits/stdlib-float.h: Likewise.
* stdlib/bits/stdlib-ldbl.h: Likewise.
* stdlib/stdlib.h: Likewise.
* string/string.h: Likewise.
* sysdeps/x86/fpu/bits/mathinline.h: Likewise.
* time/bits/types/clock_t.h: Likewise.
* time/bits/types/struct_tm.h: Likewise.
* time/bits/types/time_t.h: Likewise.
* time/time.h: Likewise.
* wcsmbs/bits/wchar-ldbl.h: Likewise.
* wcsmbs/uchar.h: Likewise.
* wcsmbs/wchar.h: Likewise.
[_GLIBCPP_USE_NAMESPACES] (wint_t): Remove conditional definition.
* wctype/wctype.h: Do not handle C++ namespaces.
* scripts/begin-end-check.pl: Remove.
* Makefile (installed-headers): Likewise.
(tests-special): Do not add $(objpfx)begin-end-check.out.
($(objpfx)begin-end-check.out): Remove.

7 years agoAdd ChangeLog entry for aarch64 ifunc support patch.
Steve Ellcey [Wed, 15 Mar 2017 23:48:25 +0000 (16:48 -0700)]
Add ChangeLog entry for aarch64 ifunc support patch.

Forgot to add ChangeLog entry.

7 years agoAdd ifunc support for aarch64.
Steve Ellcey [Wed, 15 Mar 2017 23:46:26 +0000 (16:46 -0700)]
Add ifunc support for aarch64.

* sysdeps/aarch64/dl-machine.h: Include cpu-features.c.
(DL_PLATFORM_INIT): New define.
(dl_platform_init): New function.
* sysdeps/aarch64/ldsodefs.h: Include cpu-features.h.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.c: New file.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.h: Likewise.
* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libc-start.c: Likewise.

7 years agox86_64: fix static build of __mempcpy_chk for compilers defaulting to PIC/PIE
Mike Frysinger [Sun, 12 Mar 2017 22:12:21 +0000 (15:12 -0700)]
x86_64: fix static build of __mempcpy_chk for compilers defaulting to PIC/PIE

When glibc is compiled with gcc 6.2 that has been configured with
to default to PIC/PIE, the static version of __mempcpy_chk is not built,
as the test is done on PIC instead of SHARED.  Fix the test to check for
SHARED, like it is done for similar functions like __memcpy_chk.

2017-03-12  Mike Frysinger  <vapier@gentoo.org>

* sysdeps/x86_64/mempcpy_chk.S (__mempcpy_chk): Check for SHARED
instead of PIC.

7 years agoImprove float range reduction accuracy near pi/2 (bug 21094).
Joseph Myers [Wed, 15 Mar 2017 22:00:54 +0000 (22:00 +0000)]
Improve float range reduction accuracy near pi/2 (bug 21094).

Bug 21094 reports 3ulp errors of cosf and tanf for certain arguments
near pi/2 arising from the use of an insufficiently accurate range
reduction.  (To be clear, this is a quality-of-implementation issue
relating to the apparent intent of those particular cosf and tanf
implementations; 3ulp is within the general glibc accuracy goals, so
not inherently a bug.)

This patch fixes that error by making a wider range of cases use the
existing more accurate range reduction for arguments close to pi/2.
The wider range of values is still narrow enough for the "z -=
pio2_2;" in the more accurate case to be exact, as the code expects.

Tested for x86_64, x86 and mips64; no ulps updates needed (but at
least on mips64, the larger ulps were seen if the tests were added
without the substantive fix).

[BZ #21094]
* sysdeps/ieee754/flt-32/e_rem_pio2f.c (__ieee754_rem_pio2f): Use
24+24+24-bit pi for wider range of values around pi/2.
* math/auto-libm-test-in: Add more tests of cos and tan.
* math/auto-libm-test-out-cos: Regenerated.
* math/auto-libm-test-out-tan: Likewise.

7 years agohppa: Fix setting of __libc_stack_end
John David Anglin [Tue, 21 Feb 2017 01:31:57 +0000 (20:31 -0500)]
hppa: Fix setting of __libc_stack_end

The binutils package was recently changed to fix -z relro support on hppa.
See ld/21000 for details:
https://sourceware.org/bugzilla/show_bug.cgi?id=21000

This exposed a problem with the _dl_start_user function in the RTLD_START
define.  We need to set __libc_stack_end before it is made read only.  For
this, we need to define DL_STACK_END.  The offset of 0x160 gives the same
stack end as the code in _dl_start_user.

A build log with the attached patch is here:
https://buildd.debian.org/status/fetch.php?pkg=glibc&arch=hppa&ver=2.24-9&stamp=1487639205&raw=0

7 years agoFix build with --enable-static-nss [BZ #21088]
Alexey Neyman [Wed, 25 Jan 2017 20:54:57 +0000 (12:54 -0800)]
Fix build with --enable-static-nss [BZ #21088]

Signed-off-by: Alexey Neyman <stilor@att.net>
7 years agoFix combreloc test with BSD grep
Alexey Neyman [Sun, 12 Mar 2017 20:16:18 +0000 (13:16 -0700)]
Fix combreloc test with BSD grep

The test for "-z combreloc" fails when cross-compiling on a machine
that uses BSD grep (e.g. on macos). grep complains about empty
subexpression and exits with non-zero status, which is interpreted
by configure as "not found". As a result, support for "-z combreloc"
(HAVE_Z_COMBRELOC) is not detected, leading to link failure on SPARC.

While there, replace fgrep with 'grep -F', as fgrep is non-POSIX.

* configure.ac: Avoid empty subexpression in grep.

Signed-off-by: Alexey Neyman <stilor@att.net>
7 years agoFix test-errno issues
Adhemerval Zanella [Mon, 13 Mar 2017 13:20:05 +0000 (10:20 -0300)]
Fix test-errno issues

This patch fixes multiple issues of test-errno.c (9a56f8718341):

  - Rename Linux test-errno.c to test-errno-linux.c to avoid build
    the same source for both tests.

  - Add a mlock check for 32 bits build running on 64 bits kernels.
    Althuough man pages states that mlock fails with EINVAL if final
    address overflows, kernels does not return it for aforementioned
    condition (it returns ENOMEM instead).  Although it seems to be
    a kernel issue for compat syscall handling, I think it is worth
    to still check syscall return and document the behavior.

  - Initialize option lenght for setsockopt check.

  - Change open test from EINVAL to EISDIR.

Checked on x86_64-linux-gnu and i686-linux-gnu (running on 64 bits
kernel).

* posix/test-errno.c (do_test): Initialize setsockopt optlen.
* sysdeps/unix/sysv/linux/test-errno.c: Move to ...
* sysdeps/unix/sysv/linux/test-errno-linux.c: ... here.
(test_wrp_rv): Fix format.
(test_wrp_rv2): New macro.
(do_test): Handle mlock return on 64 bits kernels with 32 bits
binaries.

7 years agoFix test-math-vector-sincos.h aliasing.
Joseph Myers [Wed, 15 Mar 2017 17:32:46 +0000 (17:32 +0000)]
Fix test-math-vector-sincos.h aliasing.

x86_64 libmvec tests have been failing to build lately with GCC
mainline with -Wuninitialized errors, and Markus Trippelsdorf traced
this to an aliasing issue
<https://sourceware.org/ml/libc-alpha/2017-03/msg00169.html>.

This patch fixes the aliasing issue, so that the vectors-of-pointers
are initialized using a union instead of pointer casts.  This also
fixes the testsuite build failures with GCC mainline.

Tested for x86_64 (full testsuite with GCC 6; testsuite build with GCC
mainline with build-many-glibcs.py).

* sysdeps/x86/fpu/test-math-vector-sincos.h (INIT_VEC_PTRS_LOOP):
Use a union when storing pointers.
(VECTOR_WRAPPER_fFF_2): Do not take address of integer vector and
cast result when passing to INIT_VEC_PTRS_LOOP.
(VECTOR_WRAPPER_fFF_3): Likewise.
(VECTOR_WRAPPER_fFF_4): Likewise.

7 years agoSplit helper classification macros from mathcalls.h
Gabriel F. T. Gomes [Mon, 6 Mar 2017 20:02:37 +0000 (17:02 -0300)]
Split helper classification macros from mathcalls.h

The classification macros: finite, fpclassify, iseqsig, isinf, isnan,
issignaling, and signbit are defined by ISO C11 and declared in
mathcalls.h for each of the floating-point types: float, double, and
long double.

TS 18661-3 does not mention these macros for float128, however support
for them must be present when _Float128 is present.  This is true,
even when the feature test macro __STDC_WANT_IEC_60559_TYPES_EXT__ is
false.  Other function declarations in mathcalls.h, on the other hand,
depend on __STDC_WANT_IEC_60559_TYPES_EXT__.

This patch splits the helper functions (__finite, __fpclassify,
__iseqsig, __isinf, __isnan, __issignaling, and __signbit) from
mathcalls.h, so that these helper functions can be declared for
_Float128, even when __STDC_WANT_IEC_60559_TYPES_EXT__ is false.

Tested for powerpc64le, s390x, and x86_64.

* include/bits/mathcalls-helper-functions.h: New file.
* math/Makefile (headers): Add bits/mathcalls-helper-functions.h.
* math/bits/mathcalls.h (__finite, __fpclassify, __iseqsig)
(__isinf, __isnan, __issignaling, __signbit): Move declarations to
math/bits/mathcalls-helper-functions.h.
* math/bits/mathcalls-helper-functions.h: New file.
* math/math.h: Include bits/mathcalls-helper-functions.h for
float, double, and long double.

7 years agoUse internal __feraiseexcept in __iseqsig
Gabriel F. T. Gomes [Tue, 14 Mar 2017 20:36:08 +0000 (17:36 -0300)]
Use internal __feraiseexcept in __iseqsig

Replace the use of feraiseexcept with __feraiseexcept in the helper
function __iseqsig (math/s_iseqsig_template.c).

Tested for powerpc64le, s390x, and x86_64.

* math/s_iseqsig_template.c (__iseqsig): Use __feraiseexcept
instead of feraiseexcept.

7 years agosupport: Explain ignored failures of temporary file removal [BZ #21243]
Florian Weimer [Wed, 15 Mar 2017 12:14:54 +0000 (13:14 +0100)]
support: Explain ignored failures of temporary file removal [BZ #21243]

7 years agosupport: Add error checking to close system calls [BZ #21244]
Florian Weimer [Wed, 15 Mar 2017 12:13:58 +0000 (13:13 +0100)]
support: Add error checking to close system calls [BZ #21244]

7 years agosupport_format_dns_packet: Fix CNAME and multiple RR handling
Florian Weimer [Wed, 15 Mar 2017 11:57:12 +0000 (12:57 +0100)]
support_format_dns_packet: Fix CNAME and multiple RR handling

Before this change, the loop iterating over RRs in the answer
section stopped at the first CNAME record, never printing them.
The CNAME and PTR record contents was extracted from the wrong
buffer (whole packet instead RDATA).  This desynced the parsing
after the first CNAME or PTR record.

Also fix the AAAA record parsing by checking their sizes.

7 years agoFix missing posix_fadvise64 mips64 static build (BZ #21232)
Adhemerval Zanella [Tue, 14 Mar 2017 19:42:08 +0000 (16:42 -0300)]
Fix missing posix_fadvise64 mips64 static build (BZ #21232)

This patch fixes the missing posix_fadvise64 symbol for static build
required for _FILE_OFFSET_BITS=64 on mips64 build.

Checked on a mips64-linux-gnu build with run-built-tests=no.

[BZ #21232]
* sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c: Add
posix_fadvise64 weak_alias for static build.

7 years agoRemove _dl_platform_string
Andreas Schwab [Thu, 15 Dec 2016 11:17:19 +0000 (12:17 +0100)]
Remove _dl_platform_string

There are no non-trivial uses of _dl_platform_string.

7 years agohurd: Make send/recv more posixish
Samuel Thibault [Mon, 13 Mar 2017 19:41:12 +0000 (20:41 +0100)]
hurd: Make send/recv more posixish

Thanks David Michael for the suggestion.

* sysdeps/mach/hurd/send.c (__send): Convert hurdish error code into
posix error code.
* sysdeps/mach/hurd/recv.c (__recv): Likewise.

7 years agobuild-many-glibcs: Remove no_isolate from SH config
Adhemerval Zanella [Mon, 13 Mar 2017 11:04:22 +0000 (08:04 -0300)]
build-many-glibcs: Remove no_isolate from SH config

Now with d40dbe7 SH build does not require more the no_isolate gcc
options to correct build glibc (since SH build now does not generate
a trap anymore).  This patch removes the unrequired options from
SH config.

Checked with a build for sh3-linux-gnu, sh3eb-linux-gnu, sh4-linux-gnu,
and sh4eb-linux-gnu.

* scripts/build-many-glibcs.py (Context.add_all_configs): Remove
no_isolate usage for SH.

7 years ago Remove the str(n)dup inlines from string/bits/string2.h. Although inlining
Wilco Dijkstra [Mon, 13 Mar 2017 18:42:35 +0000 (18:42 +0000)]
 Remove the str(n)dup inlines from string/bits/string2.h.  Although inlining
calls with constant strings shows a small (~10%) performance gain, strdup is
typically used in error reporting code, so not performance critical.
Remove the now unused __need_malloc_and_calloc related defines from stdlib.h.

Rename existing uses of str(n)dup to __str(n)dup so it no longer needs to be
redirected to a builtin.  Also building GLIBC with -Os now no longer shows
localplt or linkname space failures (partial fix for BZ #15105 and BZ #19463).

        [BZ #15105]
        [BZ #19463]
        * elf/dl-cache.c (_dl_load_cache_lookup): Use __strdup.
        * inet/rcmd.c (rcmd_af): Likewise.
        * inet/rexec.c   (rexec_af): Likewise.
        * intl/dcigettext.c (_LIBC): Likewise.
        * intl/finddomain.c (_nl_find_domain): Use strdup expansion.
        * locale/loadarchive.c (_nl_load_locale_from_archive): Use __strdup.
        * locale/setlocale.c (setlocale): Likewise.
        * posix/spawn_faction_addopen.c
        (posix_spawn_file_actions_addopen): Likewise.
        * stdlib/putenv.c (putenv): Use __strndup.
        * sunrpc/svc_simple.c (__registerrpc): Use __strdup.
        * sysdeps/posix/getaddrinfo.c (gaih_inet): Use __strdup/__strndup.
        * include/stdlib.h (__need_malloc_and_calloc): Remove uses.
        (__Need_M_And_C) Remove define/undef.
        * stdlib/stdlib.h (__need_malloc_and_calloc): Remove uses.
        (__malloc_and_calloc_defined): Remove define.
        * string/bits/string2.h (__strdup): Remove define.
        (strdup): Likewise.
        (__strndup): Likewise.
        (strndup): Likewise.

7 years agoAdd more IPV6_* macros to sysdeps/unix/sysv/linux/bits/in.h.
Joseph Myers [Mon, 13 Mar 2017 16:44:19 +0000 (16:44 +0000)]
Add more IPV6_* macros to sysdeps/unix/sysv/linux/bits/in.h.

Linux 4.10 adds IPV6_RECVFRAGSIZE to include/uapi/linux/in6.h, which
shows that several such IPV6_* macros are missing from glibc's
sysdeps/unix/sysv/linux/bits/in.h (while older ones are present).  I
don't know whether any of these might be deliberately omitted, but
this patch adds what appear to be the missing more recent macros to
glibc.

Tested for x86_64.

* sysdeps/unix/sysv/linux/bits/in.h (IPV6_AUTOFLOWLABEL): New
macro.
(IPV6_ADDR_PREFERENCES): Likewise.
(IPV6_MINHOPCOUNT): Likewise.
(IPV6_ORIGDSTADDR): Likewise.
(IPV6_RECVORIGDSTADDR): Likewise.
(IPV6_TRANSPARENT): Likewise.
(IPV6_UNICAST_IF): Likewise.
(IPV6_RECVFRAGSIZE): Likewise.

7 years agoAdd missing ChangeLog entries.
Thorsten Kukuk [Mon, 13 Mar 2017 16:43:10 +0000 (17:43 +0100)]
Add missing ChangeLog entries.

7 years agoThe rpcgen tests should not run if we don't build rpcgen.
Thorsten Kukuk [Mon, 13 Mar 2017 16:26:43 +0000 (17:26 +0100)]
The rpcgen tests should not run if we don't build rpcgen.

* sunrpc/Makefile: only run rpcgen tests if we build rpcgen.

7 years agosh: Fix building with gcc5/6
Alexey Neyman [Wed, 8 Feb 2017 18:00:57 +0000 (16:00 -0200)]
sh: Fix building with gcc5/6

Build glibc for sh4-unknown-linux-gnu currently fails if one's
using GCC5/6: in dl-conflict.c, the elf_machine_rela() function
is called with NULL as its 3rd argument, sym. The implementation
of that function in sysdeps/sh/dl-machine.h dereferences that pointer:

const Elf32_Sym *const refsym = sym;
...
if (map == &GL(dl_rtld_map))
  value -= map->l_addr + refsym->st_value + reloc->r_addend;

GCC discovers a null pointer dereference, and in accordance with
-fdelete-null-pointer-checks (which is enabled in -O2) replaces this
code with a trap - which, as SH does not implement a trap pattern in
GCC, evaluates to an abort() call. This abort() call pulls many more
objects from libc_nonshared.a, eventually resulting in link failure
due to multiple definitions for a number of symbols.

As far as I see, the conditional before this code is always false in
rtld: _dl_resolve_conflicts() is called with main_map as the first
argument, not GL(_dl_rtld_map), but since that call is in yet another
compilation unit, GCC does not know about it. Patch that wraps this
conditional into !defined RESOLVE_CONFLICT_FIND_MAP attached.

* sysdeps/sh/dl-machine.h (elf_machine_rela): The condition
in R_SH_DIR32 case is always false when inlined from
dl-conflict.c. Ifdef out to prevent GCC from insertin an
abort() call.

7 years agoFix send consolidation typo
Marko Myllynen [Sun, 12 Mar 2017 20:23:52 +0000 (17:23 -0300)]
Fix send consolidation typo

Fix 60f9423b type for alpha kernel-features.h definition.

* sysdeps/unix/sysv/linux/alpha/kernel-features.h
        (__ASSUME_RECV_SYSCALL): Replace duplicate by
        __ASSUME_SEND_SYSCALL.

7 years agoIf sunrpc code is disabled, rpcsvc header files, rpcgen and
Thorsten Kukuk [Sat, 11 Mar 2017 10:36:58 +0000 (11:36 +0100)]
If sunrpc code is disabled, rpcsvc header files, rpcgen and
librpcsvc.a should not be installed, too.

* sunrpc/Makefile: don't build and install rpcsvc header
files, rpcgen and librpcsvc.a by default.

Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
7 years agoUpdate auto-libm-test-out for catan / catanh.
Stefan Liebler [Fri, 10 Mar 2017 07:45:29 +0000 (08:45 +0100)]
Update auto-libm-test-out for catan / catanh.

I've used gmp 6.1.2, mpfr 3.1.5 and upstream mpc with fix in mpc_atan
(https://scm.gforge.inria.fr/anonscm/gitweb?p=mpc/mpc.git;a=commit;h=958aac9b15a659d6fb5edcb11778123f8a35b14f)
to build gen-auto-libm-tests and regenerated  catan / catanh out files.
Regenerated ULPs for s390 from scratch.  Now the catan / catanh tests
are passing.

ChangeLog:

* math/auto-libm-test-out-catan: Regenerated.
* math/auto-libm-test-out-catanh: Likewise.
* sysdeps/s390/fpu/libm-test-ulps: Likewise.

7 years agoRegenerate MIPS catan, catanh long double ulps.
Joseph Myers [Thu, 9 Mar 2017 22:37:47 +0000 (22:37 +0000)]
Regenerate MIPS catan, catanh long double ulps.

This patch regenerates MIPS catan and catanh ulps for long double with
fixed expected results for the tests of those functions.  ulps for
other types (which may see variation depending on whether glibc is
built for a processor with fused multiply-add support) are
deliberately not reduced.  ulps are not regenerated for powerpc-nofpu
as such regeneration does not result in any changes for long double.

* sysdeps/mips/mips64/libm-test-ulps: Update catan and catanh ulps
for long double with corrected test expectations.

7 years agoConsolidate Linux send implementation
Adhemerval Zanella [Mon, 6 Mar 2017 14:13:03 +0000 (15:13 +0100)]
Consolidate Linux send implementation

This patch consolidates the send Linux syscall implementation on
sysdeps/unix/sysv/linux/send{to}.c.  The changes are:

  1. Remove send from auto-generation syscalls.list on the architecture
     that uses __NR_send.
  2. Define __NR_send for architectures that supports it. It was done instead
     of defining in default kernel-features.h because current Linux practice
     for new ports are to implement only __NR_sendto [1] and it will
     require adding new kernel-features for ports that do not require it
     (aarch64 for instance).
  3. Remove __ASSUME_SENDTO_FOR_SEND_SYSCALL and decide to use
     __NR_sendto for send generation based on __ASSUME_SENDTO_SYSCALL.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

* sysdeps/unix/sysv/linux/sysdep.h (HAVE_INTERNAL_SEND_SYMBOL):
Define.
* sysdeps/unix/sysv/linux/aarch64/sysdep.h
(HAVE_INTERNAL_SEND_SYMBOL): Undefine.
* sysdeps/unix/sysv/linux/nios2/sysdep.h
(HAVE_INTERNAL_SEND_SYMBOL): Likewise.
* sysdeps/unix/sysv/linux/tile/sysdep.h
(HAVE_INTERNAL_SEND_SYMBOL): Likewise.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h
(__ASSUME_RECV_SYSCALL): Define.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/hppa/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/ia64/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Remove define.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove send from
auto-generation list.
* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewike.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/send.c: Simplify includes.
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Replace by
__ASSUME_SENDTO_SYSCALL.
* sysdeps/unix/sysv/linux/x86_64/send.c: Remove file.
* sysdeps/unix/sysv/linux/mips/mips64/send.c: Likewise.
* sysdeps/unix/sysv/linux/generic/send.c: Likewise.

7 years agoConsolidate Linux sendto implementation
Adhemerval Zanella [Mon, 6 Mar 2017 13:51:51 +0000 (14:51 +0100)]
Consolidate Linux sendto implementation

This patch consolidates the sendto Linux syscall implementation on
sysdeps/unix/sysv/linux/sendto.c.  The changes are:

   1. Define __ASSUME_SENDTO_SYSCALL by default.
   2. Undef it for architectures that do not support __NR_sendto.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove sendto from
auto-generation list.
* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_SENDTO_SYSCALL): Define by default.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_SENDTO_SYSCALL): Undef it is kernel does not support
__NR_sendto.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_SENDTO_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_SENDTO_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_SENDTO_SYSCALL): Remove definition.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_SENDTO_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h:
(__ASSUME_SENDTO_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sendto.c: Simplify includes.

7 years agoConsolidate Linux recv implementation
Adhemerval Zanella [Thu, 17 Nov 2016 20:47:00 +0000 (18:47 -0200)]
Consolidate Linux recv implementation

This patch consolidates the recv Linux syscall implementation on
sysdeps/unix/sysv/linux/recv.c.  The changes are:

  1. Remove recv from auto-generation syscalls.list on the architecture
     that uses __NR_recv.
  2. Define __NR_recv for architectures that supports it.  It was done
     instead of defining in default kernel-features.h because current Linux
     practice for new ports is to implement only __NR_recvfrom [1] and it will
     require adding new kernel-features for ports that do not require it
     (aarch64 for instance).
  3. Remove __ASSUME_RECVFROM_FOR_RECV_SYSCALL and decide to use
     __NR_recvfrom for recv generation based on __ASSUME_RECVFROM_SYSCALL.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recv from
auto-generation list.
* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h
(__ASSUME_RECV_SYSCALL): New define.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/hppa/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/ia64/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define.
* sysdeps/unix/sysv/linux/generic/recv.c: Remove file.
* sysdeps/unix/sysv/linux/mips/mips64/recv.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/recv.c: Likewise.
* sysdeps/unix/sysv/linux/recv.c: Simplify includes.
(__libc_recv): Use __ASSUME_RECVFROM_SYSCALL instead of
__ASSUME_RECVFROM_FOR_RECV_SYSCALL to issue recvfrom syscall.

[1] include/asm-generic/unistd.h (__ARCH_WANT_SYSCALL_DEPRECATED)

7 years agoConsolidate Linux recvfrom implementation
Adhemerval Zanella [Mon, 6 Mar 2017 11:53:14 +0000 (12:53 +0100)]
Consolidate Linux recvfrom implementation

This patch consolidates the recvfrom Linux syscall implementation on
sysdeps/unix/sysv/linux/recvfrom.c.  The changes are:

  1. Define __ASSUME_RECVFROM_SYSCALL by default
  2. Undef it for  architectures that do not support __NR_recvfrom.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recvfrom from
auto-generation list.
* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define by default.
(__ASSUME_RECVFROM_SYSCALL): Undef it if kernel does not support
__NR_recvfrom.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Remove definition.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/recvfrom.c: Simplify includes.

7 years agoConsolidate Linux connect implementation
Adhemerval Zanella [Thu, 17 Nov 2016 20:15:52 +0000 (18:15 -0200)]
Consolidate Linux connect implementation

This patch consolidates the connect Linux syscall implementation on
sysdeps/unix/sysv/linux/accept.c.  The changes are:

  1. Remove connect from auto-generation syscalls.list on the architecture
     that uses __NR_connect.
  2. Define __NR_connect as default (__ASSUME_CONNECT_SYSCALL) and undef for
     architectures that do not support it.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove connect from
auto-generation list.
* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/connect.c: Simplify include list.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Define.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Undef if kernel does not support it.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Likewise.

7 years agoConsolidate Linux accept implementation
Adhemerval Zanella [Thu, 17 Nov 2016 20:13:44 +0000 (18:13 -0200)]
Consolidate Linux accept implementation

This patch consolidates the accept Linux syscall implementation on
sysdeps/unix/sysv/linux/accept.c.  The changes are:

  1. Remove accept from auto-generation syscalls.list on the architecture
     that uses __NR_accept.
  2. Define __NR_accept as default (__ASSUME_ACCEPT_SYSCALL) and undef for
     architectures that do not support it.
  3. Remove __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL and decide to use
     __NR_accept4 for accept generation based on __ASSUME_ACCEPT4_SYSCALL.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

* sysdeps/unix/sysv/linux/accept.c (__libc_accept): Replace
__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL by __ASSUME_ACCEPT4_SYSCALL.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove accept from
auto-generation list.
* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define.
(__ASSUME_ACCEPT_SYSCALL): Undefine.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_ACCEPT_SYSCALL): New define.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define.
(__ASSUME_ACCEPT_SYSCALL): Define wheter kernel version supports.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_ACCEPT_SYSCALL): Define.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_ACCEPT_SYSCALL): Undefine.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define.
(__ASSUME_ACCEPT_SYSCALL): Undefine.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_ACCEPT_SYSCALL): Undefine.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_ACCEPT_SYSCALL): Undefine for 32 bits.

7 years agoTest for correct setting of errno.
Yury Norov [Wed, 8 Mar 2017 16:18:08 +0000 (11:18 -0500)]
Test for correct setting of errno.

This patch adds tests for POSIX and Linux specific syscalls
that implemented with syscall templates machinery. The reason
of tests is to receive the expected error code and test if
it's handled properly by glibc.

2017-03-08  Yury Norov <ynorov@caviumnetworks.com>
    Zack Weinberg  <zackw@panix.com>

* posix/test-errno.c: New file.
* posix/Makefile (tests): Add test-errno.
* sysdeps/unix/sysv/linux/test-errno.c: New file.
* sysdeps/unix/sysv/linux/Makefile (tests): Add test-errno.

7 years agoS390: Regenerate ULPs
Stefan Liebler [Wed, 8 Mar 2017 07:34:58 +0000 (08:34 +0100)]
S390: Regenerate ULPs

Updated ulps file.
There are still fails for long double catan / catanh
due to MPC bug.  See post from Joseph Myers:
https://www.sourceware.org/ml/libc-alpha/2017-03/msg00099.html

ChangeLog:

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

7 years agoFix auto-merge issue in ChangeLog
Florian Weimer [Tue, 7 Mar 2017 16:47:17 +0000 (17:47 +0100)]
Fix auto-merge issue in ChangeLog

7 years agotzset: Clean up preprocessor macros min, max, sign
Florian Weimer [Tue, 7 Mar 2017 09:39:00 +0000 (10:39 +0100)]
tzset: Clean up preprocessor macros min, max, sign

7 years agotimezone: Remove TZNAME_MAX limit from sysconf [BZ #15576]
Florian Weimer [Tue, 7 Mar 2017 08:37:46 +0000 (09:37 +0100)]
timezone: Remove TZNAME_MAX limit from sysconf [BZ #15576]

glibc does not impose a limit, and POSIX does not allow a
sysconf limit which changes during the lifetime of a process.

7 years agoIgnore and remove LD_HWCAP_MASK for AT_SECURE programs (bug #21209)
Siddhesh Poyarekar [Tue, 7 Mar 2017 15:22:04 +0000 (20:52 +0530)]
Ignore and remove LD_HWCAP_MASK for AT_SECURE programs (bug #21209)

The LD_HWCAP_MASK environment variable may alter the selection of
function variants for some architectures.  For AT_SECURE process it
means that if an outdated routine has a bug that would otherwise not
affect newer platforms by default, LD_HWCAP_MASK will allow that bug
to be exploited.

To be on the safe side, ignore and disable LD_HWCAP_MASK for setuid
binaries.

[BZ #21209]
* elf/rtld.c (process_envvars): Ignore LD_HWCAP_MASK for
AT_SECURE processes.
* sysdeps/generic/unsecvars.h: Add LD_HWCAP_MASK.
* elf/tst-env-setuid.c (test_parent): Test LD_HWCAP_MASK.
(test_child): Likewise.
* elf/Makefile (tst-env-setuid-ENV): Add LD_HWCAP_MASK.

7 years agohppa: set __IPC_64 as zero for SysV IPC calls
Adhemerval Zanella [Tue, 7 Mar 2017 08:12:48 +0000 (09:12 +0100)]
hppa: set __IPC_64 as zero for SysV IPC calls

In 1e5834c38a22 ("Refactor Linux ipc_priv header") a different
approach to passing __IPC_64 as zero was created.  Hppa kernel ABI
requires to oass __IPC_64 as zero since it does not set
CONFIG_ARCH_WANT_IPC_PARSE_VERSION in the kernel.

Checked on hppa-linux-gnu with some adjustments to avoid BZ#21016
(basically by removing hppa compat implementations and adjusting
required headers).

* sysdeps/unix/sysv/linux/hppa/ipc_priv.h: New file.

7 years agoS390: Optimize atomic macros.
Stefan Liebler [Mon, 6 Mar 2017 14:28:25 +0000 (15:28 +0100)]
S390: Optimize atomic macros.

This patch activates C11 atomic builtins by defining
USE_ATOMIC_COMPILER_BUILTINS to 1.
Note:
E.g. in nptl/pthread_key_delete.c if compiled with GCCs 6 and before,
an extra stack-frame is generated and the old value is stored on stack
before cs instruction but it never loads this value from stack.
An unreleased GCC 7 omit those stack operations.

E.g. in nptl/pthread_once.c the condition code of cs instruction is
evaluated by a sequence of ipm, sra, compare and jump instructions instead
of one conditional jump instruction.  This also occurs with an unreleased
GCC 7.

These shortcomings does not really hurt.  Nevertheless, the gcc guys are
investigating those ones and plan to fix them before GCC 7 release.

The atomic_fetch_abc_def C11 builtins are now using load-and-abc instructions
on z196 zarch and higher cpus instead of a loop with compare-and-swap
instruction.

Some of the non-C11 atomic macros from include/atomic.h are now implemented
with help of the C11 atomic builtins.  The other non-C11 atomic macros
are using the macros defined here.

ChangeLog:

* sysdeps/s390/atomic-machine.h
(USE_ATOMIC_COMPILER_BUILTINS): Define to 1.
(__arch_compare_and_exchange_val_8_acq,
__arch_compare_and_exchange_val_16_acq,
__arch_compare_and_exchange_val_32_acq,
__arch_compare_and_exchange_val_64_acq):
Delete macro.
(atomic_compare_and_exchange_val_acq,
atomic_compare_and_exchange_val_rel,
atomic_compare_and_exchange_bool_acq,
catomic_compare_and_exchange_bool_acq,
atomic_exchange_acq, atomic_exchange_rel,
atomic_exchange_and_add_acq,
atomic_exchange_and_add_rel,
catomic_exchange_and_add, atomic_or_val,
atomic_or, catomic_or, atomic_bit_test_set,
atomic_and_val, atomic_and, catomic_and):
Define macros with help of C11 atomic builtins.

7 years agohurd: Provide truncate64 and ftruncate64.
Justus Winter [Fri, 3 Mar 2017 20:27:27 +0000 (21:27 +0100)]
hurd: Provide truncate64 and ftruncate64.

* sysdeps/mach/hurd/ftruncate64.c: New file.
* sysdeps/mach/hurd/truncate64.c: Likewise.

7 years agotzset: Remove unused NOID macro
Florian Weimer [Fri, 3 Mar 2017 10:25:44 +0000 (11:25 +0100)]
tzset: Remove unused NOID macro

7 years agotzset: Remove __attribute_noinline__ from compute_offset
Florian Weimer [Fri, 3 Mar 2017 08:06:54 +0000 (09:06 +0100)]
tzset: Remove __attribute_noinline__ from compute_offset

After commit 42261ad731991df345880b0b509d83b0b9a9b9d8,
compute_offset is only called once, so not inlining it
increases executable size.

7 years agoRemove header file inclusion guard from elf/get-dynamic-info.h
Florian Weimer [Thu, 2 Mar 2017 16:28:41 +0000 (17:28 +0100)]
Remove header file inclusion guard from elf/get-dynamic-info.h

This file is included multiple times, so the guard is harmful.
Fixes commit 9090848d0607e93fb08a1d68d9f263846ee33f02.

7 years agoDocument and fix --enable-bind-now [BZ #21015]
Florian Weimer [Thu, 2 Mar 2017 13:44:28 +0000 (14:44 +0100)]
Document and fix --enable-bind-now [BZ #21015]

7 years agoNarrowing the visibility of libc-internal.h even further.
Zack Weinberg [Mon, 27 Feb 2017 01:17:52 +0000 (20:17 -0500)]
Narrowing the visibility of libc-internal.h even further.

posix/wordexp-test.c used libc-internal.h for PTR_ALIGN_DOWN; similar
to what was done with libc-diag.h, I have split the definitions of
cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and PTR_ALIGN_DOWN
to a new header, libc-pointer-arith.h.

It then occurred to me that the remaining declarations in libc-internal.h
are mostly to do with early initialization, and probably most of the
files including it, even in the core code, don't need it anymore.  Indeed,
only 19 files actually need what remains of libc-internal.h.  23 others
need libc-diag.h instead, and 12 need libc-pointer-arith.h instead.
No file needs more than one of them, and 16 don't need any of them!

So, with this patch, libc-internal.h stops including libc-diag.h as
well as losing the pointer arithmetic macros, and all including files
are adjusted.

        * include/libc-pointer-arith.h: New file.  Define
cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and
        PTR_ALIGN_DOWN here.
        * include/libc-internal.h: Definitions of above macros
moved from here.  Don't include libc-diag.h anymore either.
* posix/wordexp-test.c: Include stdint.h and libc-pointer-arith.h.
        Don't include libc-internal.h.

* debug/pcprofile.c, elf/dl-tunables.c, elf/soinit.c, io/openat.c
* io/openat64.c, misc/ptrace.c, nptl/pthread_clock_gettime.c
* nptl/pthread_clock_settime.c, nptl/pthread_cond_common.c
* string/strcoll_l.c, sysdeps/nacl/brk.c
* sysdeps/unix/clock_settime.c
* sysdeps/unix/sysv/linux/i386/get_clockfreq.c
* sysdeps/unix/sysv/linux/ia64/get_clockfreq.c
* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c:
Don't include libc-internal.h.

* elf/get-dynamic-info.h, iconv/loop.c
* iconvdata/iso-2022-cn-ext.c, locale/weight.h, locale/weightwc.h
* misc/reboot.c, nis/nis_table.c, nptl_db/thread_dbP.h
* nscd/connections.c, resolv/res_send.c, soft-fp/fmadf4.c
* soft-fp/fmasf4.c, soft-fp/fmatf4.c, stdio-common/vfscanf.c
* sysdeps/ieee754/dbl-64/e_lgamma_r.c
* sysdeps/ieee754/dbl-64/k_rem_pio2.c
* sysdeps/ieee754/flt-32/e_lgammaf_r.c
* sysdeps/ieee754/flt-32/k_rem_pio2f.c
* sysdeps/ieee754/ldbl-128/k_tanl.c
* sysdeps/ieee754/ldbl-128ibm/k_tanl.c
* sysdeps/ieee754/ldbl-96/e_lgammal_r.c
* sysdeps/ieee754/ldbl-96/k_tanl.c, sysdeps/nptl/futex-internal.h:
Include libc-diag.h instead of libc-internal.h.

        * elf/dl-load.c, elf/dl-reloc.c, locale/programs/locarchive.c
        * nptl/nptl-init.c, string/strcspn.c, string/strspn.c
* malloc/malloc.c, sysdeps/i386/nptl/tls.h
* sysdeps/nacl/dl-map-segments.h, sysdeps/x86_64/atomic-machine.h
* sysdeps/unix/sysv/linux/spawni.c
        * sysdeps/x86_64/nptl/tls.h:
        Include libc-pointer-arith.h instead of libc-internal.h.

* elf/get-dynamic-info.h, sysdeps/nacl/dl-map-segments.h
* sysdeps/x86_64/atomic-machine.h:
        Add multiple include guard.

7 years agoMiscellaneous low-risk changes preparing for _ISOMAC testsuite.
Zack Weinberg [Mon, 21 Nov 2016 01:46:30 +0000 (20:46 -0500)]
Miscellaneous low-risk changes preparing for _ISOMAC testsuite.

These are a grab bag of changes where the testsuite was using internal
symbols of some variety, but this was straightforward to fix, and the
fixed code should work with or without the change to compile the
testsuite under _ISOMAC.

Four of these are just more #include adjustments, but I want to highlight
sysdeps/powerpc/fpu/tst-setcontext-fpscr.c, which appears to have been
written before the advent of sys/auxv.h.  I think a big chunk of this file
could be replaced by a simple call to getauxval, but I'll let someone who
actually has a powerpc machine to test on do that.

dlfcn/tst-dladdr.c was including ldsodefs.h just so it could use
DL_LOOKUP_ADDRESS to print an additional diagnostic; as requested by Carlos,
I have removed this.

math/test-misc.c was using #ifndef NO_LONG_DOUBLE, which is an internal
configuration macro, to decide whether to do certain tests involving
'long double'.  I changed the test to #if LDBL_MANT_DIG > DBL_MANT_DIG
instead, which uses only public float.h macros and is equivalent on
all supported platforms.  (Note that NO_LONG_DOUBLE doesn't mean 'the
compiler doesn't support long double', it means 'long double is the
same as double'.)

tst-writev.c has a configuration macro 'ARTIFICIAL_LIMIT' that the
Makefiles are expected to define, and sysdeps/unix/sysv/linux/Makefile
was using the internal __getpagesize in the definition; changed to
sysconf(_SC_PAGESIZE) which is the POSIX equivalent.

ia64-linux doesn't supply 'clone', only '__clone2', which is not
defined in the public headers(!)  All the other clone tests have local
extern declarations of __clone2, but tst-clone.c doesn't; it was
getting away with this because include/sched.h does declare __clone2.

* nss/tst-cancel-getpwuid_r.c: Include nss.h.
* string/strcasestr.c: No need to include config.h.
* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include
sys/auxv.h. Don't include sysdep.h.
* sysdeps/powerpc/tst-set_ppr.c: Don't include dl-procinfo.h.

* dlfcn/tst-dladdr.c: Don't include ldsodefs.h.  Don't use
DL_LOOKUP_ADDRESS.
* math/test-misc.c: Instead of testing NO_LONG_DOUBLE, test whether
LDBL_MANT_DIG is greater than DBL_MANT_DIG.
* sysdeps/unix/sysv/linux/Makefile (CFLAGS-tst-writev.c): Use
sysconf (_SC_PAGESIZE) instead of __getpagesize in definition
of ARTIFICIAL_LIMIT.
* sysdeps/unix/sysv/linux/tst-clone.c [__ia64__]: Add extern
declaration of __clone2.

7 years agoAdd scripts/backport-support.sh
Florian Weimer [Tue, 28 Feb 2017 15:36:26 +0000 (16:36 +0100)]
Add scripts/backport-support.sh

This script is intended for maintaining the stable branches and
distribution backports.

7 years agosunrpc: Improvements for UDP client timeout handling [BZ #20257]
Florian Weimer [Tue, 28 Feb 2017 14:28:45 +0000 (15:28 +0100)]
sunrpc: Improvements for UDP client timeout handling [BZ #20257]

This commit fixes various aspects in the UDP client timeout handling.
Timeouts are now applied in a more consistent fashion.  Discarded UDP
packets no longer prevent the timeout from happening at all.

7 years agosunrpc: Do not unregister services if not registered [BZ #5010]
Florian Weimer [Tue, 28 Feb 2017 14:22:13 +0000 (15:22 +0100)]
sunrpc: Do not unregister services if not registered [BZ #5010]

The change in commit 718946816cf60374f9d8f674d3ed649fdb33205a
has no effect because of two bugs which cancel each other out:
The svc_is_mapped condition is inverted, and svc_is_mapped
always returns false because the check is performed after
the service has already been unregistered.  As a result,
pmap_unset is called unconditionally, as before.

7 years agoRefer to <signal.h> instead of <pthread.h> in <bits/sigthread.h>
Andreas Schwab [Mon, 27 Feb 2017 21:55:00 +0000 (22:55 +0100)]
Refer to <signal.h> instead of <pthread.h> in <bits/sigthread.h>

The <bits/sigthread.h> header is included by <signal.h>, not <pthread.h>.

7 years agosunrpc: Avoid use-after-free read access in clntudp_call [BZ #21115]
Florian Weimer [Mon, 27 Feb 2017 18:05:13 +0000 (19:05 +0100)]
sunrpc: Avoid use-after-free read access in clntudp_call [BZ #21115]

After commit bc779a1a5b3035133024b21e2f339fe4219fb11c
(CVE-2016-4429: sunrpc: Do not use alloca in clntudp_call
[BZ #20112]), ancillary data is stored on the heap,
but it is accessed after it has been freed.

The test case must be run under a heap debugger such as valgrind
to observe the invalid access.  A malloc implementation which
immediately calls munmap on free would catch this bug as well.

7 years agoAllow direct use of math_ldbl.h in testsuite.
Zack Weinberg [Mon, 21 Nov 2016 01:46:30 +0000 (20:46 -0500)]
Allow direct use of math_ldbl.h in testsuite.

A few 'long double'-related tests include math_private.h just for
their variety of math_ldbl.h, which contains macros for assembling and
disassembling the binary representation of 'long double'.  math_ldbl.h
insists on being included from math_private.h, but if we relax this
restriction (and fix some portability sloppiness) we can use it
directly and not have to expose all of math_private.h to the testsuite.

* sysdeps/generic/math_private.h: Use __BIG_ENDIAN and
__LITTLE_ENDIAN, not BIG_ENDIAN and LITTLE_ENDIAN.

* sysdeps/generic/math_ldbl.h
* sysdeps/ia64/fpu/math_ldbl.h
* sysdeps/ieee754/ldbl-128/math_ldbl.h
* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
* sysdeps/ieee754/ldbl-96/math_ldbl.h
* sysdeps/powerpc/fpu/math_ldbl.h
* sysdeps/x86_64/fpu/math_ldbl.h:
Allow direct inclusion.  Use uintNN_t instead of u_intNN_t.
Use __BIG_ENDIAN and __LITTLE_ENDIAN, not BIG_ENDIAN and
LITTLE_ENDIAN.  Include endian.h and/or stdint.h if necessary.
Add copyright notices.

* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_canonicalize_int):
Don't use EXTRACT_WORDS64.

* sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c
* sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c
* sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c
* sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c:
Include math_ldbl.h, not math_private.h.

7 years agoSplit DIAG_* macros to new header libc-diag.h.
Zack Weinberg [Mon, 21 Nov 2016 01:46:30 +0000 (20:46 -0500)]
Split DIAG_* macros to new header libc-diag.h.

Quite a few tests include libc-internal.h just for the DIAG_* macros.
Split those macros to their own file, which can be included safely in
_ISOMAC mode.  I also moved ignore_value, since it seems logically
related, even though I didn't notice any tests needing it.

Also add -Wnonnull suppressions to two tests that _should_ have them,
but the error is masked when compiling against internal headers.

* include/libc-diag.h: New file.  Define ignore_value,
DIAG_PUSH_NEEDS_COMMENT, DIAG_POP_NEEDS_COMMENT,
DIAG_IGNORE_NEEDS_COMMENT, and DIAG_IGNORE_Os_NEEDS_COMMENT here.

* include/libc-internal.h: Definitions of above macros moved from
here.  Include libc-diag.h.  Add copyright notice.

* malloc/tst-malloc.c, malloc/tst-memcheck.c, malloc/tst-realloc.c
* misc/tst-error1.c, posix/tst-dir.c, stdio-common/bug21.c
* stdio-common/scanf14.c, stdio-common/scanf4.c, stdio-common/scanf7.c
* stdio-common/test-vfprintf.c, stdio-common/tst-printf.c
* stdio-common/tst-printfsz.c, stdio-common/tst-sprintf.c
* stdio-common/tst-unlockedio.c, stdio-common/tstdiomisc.c
* stdlib/bug-getcontext.c, string/tester.c, string/tst-endian.c
* time/tst-strptime2.c, wcsmbs/tst-wcstof.c:
Include libc-diag.h instead of libc-internal.h.

* stdlib/tst-environ.c: Include libc-diag.h.  Suppress -Wnonnull for
call to unsetenv (NULL).
* nptl/tst-mutex1.c: Include libc-diag.h.  Suppress -Wnonnull for
call to pthread_mutexattr_destroy (NULL).

7 years agoClean up conditionals for declaration of gets.
Zack Weinberg [Mon, 21 Nov 2016 13:16:27 +0000 (08:16 -0500)]
Clean up conditionals for declaration of gets.

gets has the dubious honor of being the only C89 library feature that
has been completely removed from the current C and C++ standards.
glibc follows suit by not declaring it in _GNU_SOURCE mode either,
but it remains present in older compatibility modes.  Internally,
two test cases need to see stdio.h make the declaration, but all our
internal code is of course compiled under _GNU_SOURCE.  This is currently
kludged by duplicating the gets declaration, fortify wrapper and all,
in include/stdio.h.  Also, the conditional in the public headers for
deciding when to declare gets is complicated and repeated in two places.

This patch adds a new macro to features.h that encapsulates the
complicated rule for when to declare gets.  stdio.h and bits/stdio2.h
then simply test __GLIBC_USE (DEPRECATED_GETS), and instead of having
a duplicate gets declaration in include/stdio.h, debug/tst-chk1.c and
stdio-common/tst-gets.c can force gets to be declared.

        * include/features.h (__GLIBC_USE_DEPRECATED_GETS): New macro.
        * libio/stdio.h, libio/bits/stdio2.h: Condition gets on
        __GLIBC_USE (DEPRECATED_GETS).  Update comments to indicate
        gets was removed from C++ in C++14.
        * include/stdio.h: Remove redundant declaration of gets.
        * debug/tst-chk1.c, stdio-common/tst-gets.c: Force gets to
        be declared, since we are testing it.
        * stdio-common/Makefile (tst-gets.c): Compile with
        -Wno-deprecated-declarations.
* debug/Makefile (tst-chk1.c, tst-chk2.c, tst-chk3.c, tst-chk4.cc)
(tst-chk5.cc, tst-chk6.cc, tst-lfschk1.c, tst-lfschk2.c)
(tst-lfschk3.c, tst-lfschk4.cc, tst-lfschk5.cc, tst-lfschk6.cc):
Compile with -Wno-deprecated-declarations.

7 years agoUse independent type literals in libm-test-support.c
Tulio Magno Quites Machado Filho [Sat, 25 Feb 2017 00:14:09 +0000 (21:14 -0300)]
Use independent type literals in libm-test-support.c

* math/libm-test-support.c (check_ulp): Use LIT() around literal
numbers.

7 years agoGet rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
Stefan Liebler [Fri, 24 Feb 2017 12:30:13 +0000 (13:30 +0100)]
Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.

Compiling resolv/tst-resolv-qtypes.c with GCC 7 results in:
tst-resolv-qtypes.c:53:14: error: duplicate â€˜const’ declaration specifier [-Werror=duplicate-decl-specifier]
 static const const char *domain = "www.example.com";

This patch removes the duplicate const and makes domain a const pointer
to const char literal.

ChangeLog:

* resolv/tst-resolv-qtypes.c (domain):
Change type to const pointer to const char.