Commit Graph

20256 Commits

Author SHA1 Message Date
Tulio Magno Quites Machado Filho ca4dc74659 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.
2017-03-23 15:48:59 -03:00
Wainer dos Santos Moschetta fb82116f24 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.
2017-03-23 11:32:29 -03:00
Zack Weinberg b9e8c90875 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.
2017-03-22 08:44:32 -04:00
H.J. Lu c15f8eb50c 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.
2017-03-21 11:00:12 -07:00
Joseph Myers a640393a18 Regenerate INSTALL. 2017-03-21 16:40:16 +00:00
Thorsten Kukuk 261d0141b3 Merge branch 'master' of ssh://sourceware.org/git/glibc
Conflicts:
	ChangeLog
2017-03-21 16:47:00 +01:00
Stefan Liebler e4e26210c3 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"
(ae65d4f3c3) 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.
2017-03-21 16:41:56 +01:00
Thorsten Kukuk 1e4d83f6fe 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>
2017-03-21 15:14:27 +01:00
Joseph Myers 76b2c32a16 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.
2017-03-20 21:30:28 +00:00
Joseph Myers 112039611c 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.
2017-03-20 21:28:16 +00:00
Joseph Myers ba7fe6906d 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.
2017-03-20 17:32:19 +00:00
Mike Frysinger ddc3fb3334 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>
2017-03-20 10:42:34 -04:00
Christian Brauner 15e9a4f378 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>
2017-03-19 17:36:13 +00:00
Joseph Myers 345118d7f5 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.
2017-03-18 00:24:13 +00:00
Joseph Myers 19641dbd61 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.
2017-03-18 00:17:25 +00:00
Joseph Myers 22b72f356d 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.
2017-03-18 00:16:05 +00:00
DJ Delorie 17f487b7af 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.
2017-03-17 15:31:38 -04:00
H.J. Lu b170d2e7ab 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.
2017-03-17 11:38:13 -07:00
Joseph Myers 20409ce5e8 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].
2017-03-17 16:27:03 +00:00
Joseph Myers 0cb521871b 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.
2017-03-17 02:54:59 +00:00
Joseph Myers d19887f8bb Add missing piece to last ChangeLog entry. 2017-03-17 02:50:51 +00:00
Joseph Myers bb5cc234e1 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.
2017-03-17 02:42:16 +00:00
Joseph Myers c33eac51f4 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.
2017-03-17 01:21:10 +00:00
Joseph Myers 33c02810c5 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.
2017-03-17 01:08:27 +00:00
Joseph Myers 0fbca26c39 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.
2017-03-16 17:51:23 +00:00
Tulio Magno Quites Machado Filho 598fe6d9f4 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.
2017-03-16 10:36:37 -03:00
Joseph Myers 2072f5c34e 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.
2017-03-16 13:31:57 +00:00
Steve Ellcey d6fc3f6516 Add ChangeLog entry for aarch64 ifunc support patch.
Forgot to add ChangeLog entry.
2017-03-15 16:48:25 -07:00
Mike Frysinger fbe355fbd1 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.
2017-03-15 16:10:05 -07:00
Joseph Myers e4e52ff059 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.
2017-03-15 22:00:54 +00:00
John David Anglin 5d20a49aac 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
2017-03-15 13:37:16 -07:00
Alexey Neyman 3ab2021fea Fix build with --enable-static-nss [BZ #21088]
Signed-off-by: Alexey Neyman <stilor@att.net>
2017-03-15 13:32:23 -07:00
Alexey Neyman e37fc4aa68 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>
2017-03-15 13:26:13 -07:00
Adhemerval Zanella b36a65e5ca Fix test-errno issues
This patch fixes multiple issues of test-errno.c (9a56f87183):

  - 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.
2017-03-15 17:05:34 -03:00
Joseph Myers ffe308e4fc 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.
2017-03-15 17:32:46 +00:00
Gabriel F. T. Gomes ff80ec4283 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.
2017-03-15 09:39:16 -03:00
Gabriel F. T. Gomes 826aa1346f 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.
2017-03-15 09:39:16 -03:00
Florian Weimer 2bda2d820d support: Explain ignored failures of temporary file removal [BZ #21243] 2017-03-15 13:33:40 +01:00
Florian Weimer ed3ea040ba support: Add error checking to close system calls [BZ #21244] 2017-03-15 13:33:40 +01:00
Florian Weimer f889e73f60 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.
2017-03-15 13:33:40 +01:00
Adhemerval Zanella ed7d6072f2 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.
2017-03-14 16:42:08 -03:00
Andreas Schwab 605c5ef4fb Remove _dl_platform_string
There are no non-trivial uses of _dl_platform_string.
2017-03-14 17:18:52 +01:00
Samuel Thibault 9d067269f5 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.
2017-03-13 20:41:12 +01:00
Adhemerval Zanella c89721e25d 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.
2017-03-13 16:23:25 -03:00
Wilco Dijkstra ae65d4f3c3 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.
2017-03-13 18:45:42 +00:00
Joseph Myers 53a4608f8d 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.
2017-03-13 16:45:23 +00:00
Thorsten Kukuk d50a2c094c Add missing ChangeLog entries. 2017-03-13 17:43:10 +01:00
Alexey Neyman d40dbe722f 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.
2017-03-12 17:29:32 -03:00
Marko Myllynen cb09a3d497 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.
2017-03-12 17:25:00 -03:00
Stefan Liebler 93adfe2d79 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.
2017-03-10 08:45:29 +01:00