Commit Graph

20839 Commits

Author SHA1 Message Date
John David Anglin df3d455b23 Fix [BZ 20098]. 2017-07-16 10:51:13 -04:00
Siddhesh Poyarekar 66cd050f26 Regenerate libc.pot 2017-07-16 15:30:27 +05:30
John David Anglin 32d9b0e7a6 Fix [BZ locale/19838]. 2017-07-15 12:54:14 -04:00
John David Anglin 075385f98a Fix guard alignment in allocate_stack when stack grows up. 2017-07-15 12:40:13 -04:00
John David Anglin 2759a2c1d8 Fix failing sNaN tests on hppa. 2017-07-15 12:18:03 -04:00
DJ Delorie 4fa8ae49aa Fix BZ #21654 - grp-merge.c alignment
* grp/grp_merge.c (__copy_grp): Align char** to minimum pointer
alignment not char alignment.
(__merge_grp): Likewise.
2017-07-14 21:46:42 -04:00
Szabolcs Nagy de895ddcd7 Disable single thread optimization for open_memstream
Single thread optimization is valid if at thread creation time the
optimization can be disabled.  This is in principle true for all
stream objects that user code can access (and thus needs locking),
using the same internal list as fflush(0) uses.  However in glibc
open_memstream is not on that list (BZ 21735) so the optimization
has to be disabled.

	* libio/memstream.c (__open_memstream): Set _IO_FLAGS2_NEED_LOCK.
	* libio/wmemstream.c (open_wmemstream): Likewise.
	* nptl/tst-memstream.c: New.
2017-07-14 16:09:56 +01:00
Jiong Wang 5ba6405338 [ARM] Fix ld.so crash when built using Binutils 2.29
There is bug report that ld.so in GLIBC 2.24 built by Binutils 2.29 will crash
on arm-linux-gnueabihf.  This is confirmed, and the details is at:

   https://sourceware.org/bugzilla/show_bug.cgi?id=21725.

As analyzed in the PR, the old code was with the assumption that assembler
won't set bit0 of thumb function address if it comes from PC-relative
instructions and the calculation can be finished during assembling.  This
assumption however does not hold after PR gas/21458.

	* sysdeps/arm/dl-machine.h (elf_machine_load_address):  Also strip bit 0
	of pcrel_address under Thumb mode.
2017-07-13 15:48:41 +01:00
Akhilesh Kumar 64bdd005b2 Added Fiji Hindi language locale for Fiji
[BZ #21207]
	* locales/hif_FJ: New file.
	* SUPPORTED: Add hif_FJ/UTF-8.
	* locale/iso-639.def: Add Fiji Hindi (hif).
2017-07-13 09:46:44 +02:00
John David Anglin 27f29b2dad Fix type in sysdeps/hppa/dl-machine.h. 2017-07-12 20:02:45 -04:00
H.J. Lu 06164c6773 Compile tst-ssp-1.c with -fstack-protector-all
Compile tst-ssp-1.c with -fstack-protector-all in case the the stack
protector heuristics do not instrument a thirty-byte array.

	* debug/Makefile (CFLAGS-tst-ssp-1.c): Set to
	-fstack-protector-all.
2017-07-12 07:53:09 -07:00
Chris Leonard 30200427a9 New locale for agr_PE.
[BZ #20496]
	* locale/iso-639.def: Add Awajún / Aguaruna (agr).

	[BZ #20496]
	* SUPPORTED: Add agr_PE.
	* locales/agr_PE: New file, Awajún / Aguaruna locale for Peru.
2017-07-12 09:08:44 +02:00
Gabriel F. T. Gomes 4de0cb2e9a powerpc64le: Iterate over all object suffixes when appending -mfloat128
On powerpc64le, the compilation of the files related to float128 support
requires the option -mfloat128 to be passed to gcc.  However, not all
possible object suffixes were covered in the Makefile.  This patch uses
$(all-object-suffixes) in all remaining rules.

Tested for powerpc64le.

	* sysdeps/powerpc/powerpc64le/Makefile: Use $(all-object-suffixes)
	to iterate over all possible object suffixes.  Add a comment
	explaining the use of sysdep-CFLAGS instead of CFLAGS.
2017-07-11 14:02:10 -03:00
H.J. Lu ed421fca42 Avoid backtrace from __stack_chk_fail [BZ #12189]
__stack_chk_fail is called on corrupted stack.  Stack backtrace is very
unreliable against corrupted stack.  __libc_message is changed to accept
enum __libc_message_action and call BEFORE_ABORT only if action includes
do_backtrace.  __fortify_fail_abort is added to avoid backtrace from
__stack_chk_fail.

	[BZ #12189]
	* debug/Makefile (CFLAGS-tst-ssp-1.c): New.
	(tests): Add tst-ssp-1 if -fstack-protector works.
	* debug/fortify_fail.c: Include <stdbool.h>.
	(_fortify_fail_abort): New function.
	(__fortify_fail): Call _fortify_fail_abort.
	(__fortify_fail_abort): Add a hidden definition.
	* debug/stack_chk_fail.c: Include <stdbool.h>.
	(__stack_chk_fail): Call __fortify_fail_abort, instead of
	__fortify_fail.
	* debug/tst-ssp-1.c: New file.
	* include/stdio.h (__libc_message_action): New enum.
	(__libc_message): Replace int with enum __libc_message_action.
	(__fortify_fail_abort): New hidden prototype.
	* malloc/malloc.c (malloc_printerr): Update __libc_message calls.
	* sysdeps/posix/libc_fatal.c (__libc_message): Replace int
	with enum __libc_message_action.  Call BEFORE_ABORT only if
	action includes do_backtrace.
	(__libc_fatal): Update __libc_message call.
2017-07-11 07:44:14 -07:00
Adhemerval Zanella 94070f86c0 posix: Add p{read,write}v2 RWF_NOWAIT flag (BZ#21738)
Linux 4.12 (b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e) adds a new
p{read,write}v2 flag RWF_NOWAIT.  This patch adds it for linux
uio-ext.h header.

Checked on x86_64-linux-gnu (on a 4.10 kernel).

	[BZ #21738]
	* manual/llio.texi (RWF_NOWAIT): New item.
	* misc/tst-preadvwritev2-common.c (do_test_with_invalid_flags):
	Add RWF_NOWAIT check.
	* sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_NOWAIT): New flag.
2017-07-11 11:06:44 -03:00
Stefan Liebler 2c80445787 S390: Fix tst-ptrace-singleblock if kernel does not support PTRACE_SINGLEBLOCK.
The request PTRACE_SINGLEBLOCK was introduced in Linux 3.15.  Thus the ptrace call
will fail on older kernels.
Thus the test is now testing PTRACE_SINGLEBLOCK with data argument pointing to a
buffer on stack which is assumed to fail.  If the request would be interpreted as
PTRACE_GETREGS, then the ptrace call will not fail and the regs are written to buf.

If we run with a kernel with support for PTRACE_SINGLEBLOCK a ptrace call with
data=NULL, returns zero with no error.  If we run with a kernel without support for
PTRACE_SINGLEBLOCK a ptrace call with data=NULL reports an error.
In the latter case, the test is just continuing with PTRACE_CONT.

ChangeLog:

	* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
	Support running on kernels without PTRACE_SINGLEBLOCK.
2017-07-11 10:38:44 +02:00
H.J. Lu eb73083e5e Don't include _dl_resolve_conflicts in libc.a [BZ #21742]
Since _dl_resolve_conflicts is only used in elf/rtld.c, don't include
it in libc.a.

	[BZ #21742]
	* elf/Makefile (dl-routines): Move dl-conflict to ...
	(rtld-routines): Here.
2017-07-10 05:16:40 -07:00
H.J. Lu 7a499756ab x86-64: Test memmove_chk and memset_chk only in libc.so [BZ #21741]
Since there are no multiarch versions of memmove_chk and memset_chk,
test multiarch versions of memmove_chk and memset_chk only in libc.so.

	[BZ #21741]
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Test memmove_chk and memset_chk only
	in libc.so.
2017-07-10 04:44:38 -07:00
John David Anglin 2e783eb905 Update hppa ulps. 2017-07-09 15:22:41 -04:00
John David Anglin c5f70682a5 Use generic pthread support on hppa. 2017-07-09 15:01:11 -04:00
H.J. Lu 58d021c836 x86-64: Update comments in IFUNC selectors
* sysdeps/x86_64/multiarch/memcmp.c: Update comments.
	* sysdeps/x86_64/multiarch/memmove.c: Likewise.
	* sysdeps/x86_64/multiarch/memrchr.c: Likewise.
	* sysdeps/x86_64/multiarch/memset.c: Likewise.
	* sysdeps/x86_64/multiarch/rawmemchr.c: Likewise.
	* sysdeps/x86_64/multiarch/strchrnul.c: Likewise.
	* sysdeps/x86_64/multiarch/strlen.c: Likewise.
	* sysdeps/x86_64/multiarch/strnlen.c: Likewise.
	* sysdeps/x86_64/multiarch/wcschr.c: Likewise.
	* sysdeps/x86_64/multiarch/wcscpy.c: Likewise.
	* sysdeps/x86_64/multiarch/wcslen.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsnlen.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemchr.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemcmp.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemset.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemset_chk.c: Likewise.
2017-07-09 11:43:20 -07:00
H.J. Lu 4df54c89bb x86-64: Update comments in ifunc-impl-list.c
All x86-64 IFUNC selectors are written in C now.  Update comments to
reflect it.

	* sysdeps/x86_64/multiarch/ifunc-impl-list.c: Update comments.
2017-07-09 11:38:37 -07:00
John David Anglin 7023e6db99 Fix BZ #21049. 2017-07-09 13:48:04 -04:00
Andreas Schwab 218bb835cd build-many-glibcs.py: also build profiled objects 2017-07-08 21:09:03 +02:00
DJ Delorie be8aa923a7 * manual/tunables.texi: Add missing @end deftp. 2017-07-06 19:54:13 -04:00
Florian Weimer 9f5a127131 resolv: Deal with non-deterministic address order in tst-resolv-basic 2017-07-06 22:55:53 +02:00
DJ Delorie d5c3fafc43 Add per-thread cache to malloc
* config.make.in: Enable experimental malloc option.
* configure.ac: Likewise.
* configure: Regenerate.
* manual/install.texi: Document it.
* INSTALL: Regenerate.
* malloc/Makefile: Likewise.
* malloc/malloc.c: Add per-thread cache (tcache).
(tcache_put): New.
(tcache_get): New.
(tcache_thread_freeres): New.
(tcache_init): New.
(__libc_malloc): Use cached chunks if available.
(__libc_free): Initialize tcache if needed.
(__libc_realloc): Likewise.
(__libc_calloc): Likewise.
(_int_malloc): Prefill tcache when appropriate.
(_int_free): Likewise.
(do_set_tcache_max): New.
(do_set_tcache_count): New.
(do_set_tcache_unsorted_limit): New.
* manual/probes.texi: Document new probes.
* malloc/arena.c: Add new tcache tunables.
* elf/dl-tunables.list: Likewise.
* manual/tunables.texi: Document them.
* NEWS: Mention the per-thread cache.
2017-07-06 13:37:30 -04:00
Joseph Myers 3cefdd7310 Increase some test timeouts.
This patch increases the timeouts for some tests that I've seen timing
out on slow systems in my 2.26 release testing.  (In the case of
tst-tsearch.c, increasing the timeout means removing a setting of 10
that was put there before the default timeout was increased to 20
seconds, so putting the default into effect.)

	* iconvdata/tst-loading.c (TIMEOUT): Define to 30.
	* misc/tst-tsearch.c (TIMEOUT): Remove.
	* nptl/tst-create-detached.c (TIMEOUT): Define to 100.
	* nptl/tst-robust-fork.c (TIMEOUT): Likewise.
	* nptl/tst-rwlock19.c (TIMEOUT): Likewise.
	* string/tst-cmp.c (TIMEOUT): Define to 600.
2017-07-06 17:01:03 +00:00
Matthew Krupcale 3adfef7eaa nptl: Fix typo on __have_pthread_attr_t (BZ#21715)
This patch fixes some build issues when including types/sigevent_t.h
along with bits/pthreadtypes.h.

Checked on x86_64-linux-gnu and on a build on supported major ABIs.

	[BZ #21715]
	* sysdeps/nptl/bits/pthreadtypes.h (__have_pthread_attr_t): Fix typo
	on definition.
2017-07-06 10:27:24 -03:00
H.J. Lu 031e519c95 x86-64: Align the stack in __tls_get_addr [BZ #21609]
This change forces realignment of the stack pointer in __tls_get_addr, so
that binaries compiled by GCCs older than GCC 4.9:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066

continue to work even if vector instructions are used in glibc which
require the ABI stack realignment.

__tls_get_addr_slow is added to handle the slow paths in the default
implementation of__tls_get_addr in elf/dl-tls.c.  The new __tls_get_addr
calls __tls_get_addr_slow after realigning the stack.  Internal calls
within ld.so go directly to the default implementation of __tls_get_addr
because they do not need stack realignment.

	[BZ #21609]
	* sysdeps/x86_64/Makefile (sysdep-dl-routines): Add tls_get_addr.
	(gen-as-const-headers): Add rtld-offsets.sym.
	* sysdeps/x86_64/dl-tls.c: New file.
	* sysdeps/x86_64/rtld-offsets.sym: Likwise.
	* sysdeps/x86_64/tls_get_addr.S: Likewise.
	* sysdeps/x86_64/dl-tls.h: Add multiple inclusion guards.
	* sysdeps/x86_64/tlsdesc.sym (TI_MODULE_OFFSET): New.
	(TI_OFFSET_OFFSET): Likwise.
2017-07-06 04:43:20 -07:00
Adhemerval Zanella db6b2f2522 posix: Fix default posix_spawn return value
This patch fix the return value for error conditions for default
posix_spawn (where the errno is expected).  It also avoid clobber
errno on fork call.

Checked on x86_64 (with Linux implementation removed).

	[BZ# 21697]
	* sysdeps/posix/spawni.c (__spawni_child): Fix return value.
	(__spawnix): Do not clober errno.
2017-07-05 15:58:31 -03:00
Florian Weimer cb3c27e87b support: Add resolver testing mode which does not patch _res 2017-07-05 19:04:40 +02:00
Florian Weimer d4165eedf5 support: Add support_chroot_create and support_chroot_free 2017-07-05 19:04:40 +02:00
Florian Weimer 76637a921f support: Check isolation of loopback addresses in tst-support-namespace 2017-07-05 19:04:39 +02:00
Szabolcs Nagy d2e0491883 Single threaded stdio optimization
Locking overhead can be significant in some stdio operations
that are common in single threaded applications.

This patch adds the _IO_FLAGS2_NEED_LOCK flag to indicate if
an _IO_FILE object needs to be locked and some of the stdio
functions just jump to their _unlocked variant when not.  The
flag is set on all _IO_FILE objects when the first thread is
created.  A new GLIBC_PRIVATE libc symbol, _IO_enable_locks,
was added to do this from libpthread.

The optimization can be applied to more stdio functions,
currently it is only applied to single flag check or single
non-wide-char standard operations.  The flag should probably
be never set for files with _IO_USER_LOCK, but that's just a
further optimization, not a correctness requirement.

The optimization is valid in a single thread because stdio
operations are non-as-safe (so lock state is not observable
from a signal handler) and stdio locks are recursive (so lock
state is not observable via deadlock).  The optimization is not
valid if a thread may be created while an stdio lock is taken
and thus it should be disabled if any user code may run during
an stdio operation (interposed malloc, printf hooks, etc).
This makes the optimization more complicated for some stdio
operations (e.g. printf), but those are bigger and thus less
important to optimize so this patch does not try to do that.

	* libio/libio.h (_IO_FLAGS2_NEED_LOCK, _IO_need_lock): Define.
	* libio/libioP.h (_IO_enable_locks): Declare.
	* libio/Versions (_IO_enable_locks): New symbol.
	* libio/genops.c (_IO_enable_locks): Define.
	(_IO_old_init): Initialize flags2.
	* libio/feof.c.c (_IO_feof): Avoid locking when not needed.
	* libio/ferror.c (_IO_ferror): Likewise.
	* libio/fputc.c (fputc): Likewise.
	* libio/putc.c (_IO_putc): Likewise.
	* libio/getc.c (_IO_getc): Likewise.
	* libio/getchar.c (getchar): Likewise.
	* libio/ioungetc.c (_IO_ungetc): Likewise.
	* nptl/pthread_create.c (__pthread_create_2_1): Enable stdio locks.
	* libio/iofopncook.c (_IO_fopencookie): Enable locking for the file.
	* sysdeps/pthread/flockfile.c (__flockfile): Likewise.
2017-07-04 16:05:12 +01:00
Florian Weimer 1ff6c67a25 sysconf: Use conservative default for _SC_NPROCESSORS_ONLN [BZ #21542] 2017-07-04 16:12:46 +02:00
Florian Weimer 4446a885f3 resolv: Fix resolv_conf _res matching
A dot-less host name without an /etc/resolv.conf file caused an
assertion failure in update_from_conf because the function would not
deal correctly with the empty search list case.

Thanks to Andreas Schwab for debugging assistence.
2017-07-04 15:26:05 +02:00
Joseph Myers f0107724c9 Update versions in build-many-glibcs.py.
This patch updates build-many-glibcs.py to use the current release
branch of binutils and current releases of GMP and the Linux kernel.

	* scripts/build-many-glibcs.py (Context.checkout): Default
	binutils version to 2.29 branch, GMP version to 6.1.2 and Linux
	kernel version to 4.12.
2017-07-04 10:32:54 +00:00
Florian Weimer 89f6307c5d resolv: Fix improper assert in __resolv_conf_attach 2017-07-04 11:18:34 +02:00
Florian Weimer e237357a5a resolv: Introduce free list for resolv_conf index slosts 2017-07-03 21:07:11 +02:00
Florian Weimer aef16cc8a4 resolv: Automatically reload a changed /etc/resolv.conf file [BZ #984]
This commit enhances the stub resolver to reload the configuration
in the per-thread _res object if the /etc/resolv.conf file has
changed.  The resolver checks whether the application has modified
_res and will not overwrite the _res object in that case.

The struct resolv_context mechanism is used to check the
configuration file only once per name lookup.
2017-07-03 21:06:23 +02:00
Florian Weimer a1c4eb8794 resolv: Mirror the entire resolver configuration in struct resolv_conf
This commit adds the remaining unchanging members (which are loaded
from /etc/resolv.conf) to struct resolv_conf.

The extended name server list is currently not used by the stub
resolver.  The switch depends on a cleanup: The _u._ext.nssocks
array stores just a single socket, and needs to be replaced with
a single socket value.

(The compatibility gethostname implementation does not use the
extended addres sort list, either.  Updating the compat code is
not worthwhile.)
2017-07-03 21:03:21 +02:00
Florian Weimer 3f853f22c8 resolv: Lift domain search list limits [BZ #19569] [BZ #21475]
This change uses the extended resolver state in struct resolv_conf to
store the search list.  If applications have not patched the _res
object directly, this extended search list will be used by the stub
resolver during name resolution.
2017-07-03 21:01:42 +02:00
Florian Weimer f30a54b21b resolv: Introduce struct resolv_conf with extended resolver state
This change provides additional resolver configuration state which
is not exposed through the _res ABI.  It reuses the existing
initstamp field in the supposedly-private part of _res.  Some effort
is undertaken to avoid memory safety issues introduced by applications
which directly patch the _res object.

With this commit, only the initstamp field is moved into struct
resolv_conf.  Additional members will be added later, eventually
migrating the entire resolver configuration.
2017-07-03 20:57:28 +02:00
Florian Weimer 352f4ff9a2 resolv: Introduce struct resolv_context [BZ #21668]
struct resolv_context objects provide a temporary resolver context
which does not change during a name lookup operation.  Only when the
outmost context is created, the stub resolver configuration is
verified to be current (at present, only against previous res_init
calls).  Subsequent attempts to obtain the context will reuse the
result of the initial verification operation.

struct resolv_context can also be extended in the future to store
data which needs to be deallocated during thread cancellation.
2017-07-03 20:52:59 +02:00
Florian Weimer 4e45d83c92 resolv: Add preinit tests to resolv/tst-resolv-res_init-skeleton.c 2017-07-03 17:54:48 +02:00
Rajalakshmi Srinivasaraghavan 2572f356b1 powerpc: Clean up strlen and strnlen for power8
To align a quadword aligned address to 64 bytes, maximum of three
16 bytes load is needed for worst case instead of loading four times.
2017-07-03 10:46:13 +05:30
H.J. Lu 8dc6133eff Use __builtin_popcount in __sched_cpucount [BZ #21696]
posix/sched_cpucount.c assumes that size of __cpu_mask == size of long,
which is incorrect for x32.  This patch uses __builtin_popcount, which
is availabe in GCC 4.9, in posix/sched_cpucount.c.

Tested on i686, x86-64 and x32 with multi-arch disabled.

	[BZ #21696]
	* posix/sched_cpucount.c: Don't include <limits.h>.
	(__sched_cpucount): Use __builtin_popcount.
2017-07-01 07:29:32 -07:00
Siddhesh Poyarekar 47ea614b9a Fix typo in glibc.tune.cpu name 2017-07-01 19:51:44 +05:30
Gabriel F. T. Gomes 8466ee1cb7 float128: Add signbit alternative for old compilers
In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*,
e.g.: __builtin_signbitf128, before GCC 6.  However, there has never
been a __builtin_signbitf128 in GCC and the type-generic builtin is
only available since GCC 6.  For older GCC, this patch defines
__builtin_signbitf128 to __signbitf128, so that the internal function
is used instead of the non-existent builtin.

This patch also changes the implementation of __signbitf128, because
it was reusing the implementation of __signbitl from ldbl-128, which
calls __builtin_signbitl.  Using the long double version of the
builtin is not correct on machines where _Float128 is ABI-distinct
from long double (i.e.: ia64, powerpc64le, x86, x86_84).  The new
implementation does not rely on builtins when being built with GCC
versions older than 6.0.

The new code does not currently affect powerpc64le builds, because
only GCC 6.2 fulfills the requirements from configure.  It might
affect powerpc64le builds if those requirements are backported to
older versions of the compiler.  The new code affects x86_64 builds,
since glibc is supposed to build correctly with older versions of GCC.

Tested for powerpc64le and x86_64.

	* include/math.h (__signbitf128): Define as hidden.
	* sysdeps/ieee754/float128/s_signbitf128.c (__signbitf128):
	Reimplement without builtins.
	* sysdeps/ia64/bits/floatn.h [!__GNUC_PREREQ (6, 0)]
	(__builtin_signbitf128): Define to __signbitf128.
	* sysdeps/powerpc/bits/floatn.h: Likewise.
	* sysdeps/x86/bits/floatn.h: Likewise.
2017-06-30 18:34:29 -03:00
Adhemerval Zanella 9b8f8593e5 Consolidate Linux fcntl implementation
This patch consolidates the fcntl Linux syscall generation on
sysdeps/unix/sysv/linux/fcntl.c.  It basically removes all the
architecture specific implementations.

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/fcntl.c: Remove file.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/hppa/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/fcntl.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Refactor to
	use default implementation.
2017-06-30 15:17:26 -03:00
Siddhesh Poyarekar 28cfa3a48e tunables, aarch64: New tunable to override cpu
Add a new tunable (glibc.tune.cpu) to override CPU identification on
aarch64.  This is useful in two cases: one where it is desirable to
pretend to be another CPU for purposes of testing or because routines
written for that CPU are beneficial for specific workloads and second
where the underlying kernel does not support emulation of MRS to get
the MIDR of the CPU.

	* elf/dl-tunables.h (tunable_is_name): Move from...
	* elf/dl-tunables.c (is_name): ... here.
	(parse_tunables, __tunables_init): Adjust.
	* manual/tunables.texi: Document glibc.tune.cpu.
	* sysdeps/aarch64/dl-tunables.list: New file.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (struct
	cpu_list): New type.
	(cpu_list): New list of CPU names and their MIDR.
	(get_midr_from_mcpu): New function.
	(init_cpu_features): Override MIDR if necessary.
2017-06-30 22:58:39 +05:30
Siddhesh Poyarekar ab85da1530 aarch64: Call all string function implementations in tests
The string function implementations implemented so far do not use any
instructions that may deviate from standard aarch64, so it is possible
for all routines to run on all armv8 hardware.  Select all
implementations in the benchmarks and tests.

	* sysdeps/aarch64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Unconditionally select thunderx
	routine for testing.
2017-06-30 22:57:12 +05:30
H.J. Lu 4e61a6be44 i386: Increase MALLOC_ALIGNMENT to 16 [BZ #21120]
GCC 7 changed the definition of max_align_t on i386:

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9b5c49ef97e63cc63f1ffa13baf771368105ebe2

As a result, glibc malloc no longer returns memory blocks which are as
aligned as max_align_t requires.

This causes malloc/tst-malloc-thread-fail to fail with an error like this
one:

error: allocation function 0, size 144 not aligned to 16

This patch moves the MALLOC_ALIGNMENT definition to <malloc-alignment.h>
and increases the malloc alignment to 16 for i386.

	[BZ #21120]
	* malloc/malloc-internal.h (MALLOC_ALIGNMENT): Moved to ...
	* sysdeps/generic/malloc-alignment.h: Here.  New file.
	* sysdeps/i386/malloc-alignment.h: Likewise.
	* sysdeps/generic/malloc-machine.h: Include <malloc-alignment.h>.
2017-06-30 09:11:24 -07:00
Florian Weimer a9270e673d resolv: Improve debugging output from tst-resolv-res_init 2017-06-30 18:02:11 +02:00
Florian Weimer b606c6ce66 resolv: Remove source argument fron res_options 2017-06-30 11:32:19 +02:00
Florian Weimer 3f8f1eb6b0 resolv: Remove DEBUG from resolv/res_query.c 2017-06-30 11:32:12 +02:00
Florian Weimer 6da48ca0b2 resolv: Reformat resolv/res_data.c to GNU style 2017-06-30 11:32:04 +02:00
Florian Weimer 0377511799 resolv: Move res_query, res_search res_querydomain, hostalias
From res_data.c to query.c
2017-06-30 11:31:55 +02:00
Florian Weimer ded603542a resolv: Move res_isourserver, res_send from res_data.c to res_send.c 2017-06-30 11:31:48 +02:00
Florian Weimer 6781d8e693 resolv: Turn _res_opcodes into a compatibility symbol 2017-06-30 11:31:41 +02:00
Florian Weimer d85f99679d resolv: Move fp_nquery, fp_query, p_query, _res_opcodes
From res_data.c to res_debug.c.

Also drop the unnecessary _res initialization from fp_nquery.
2017-06-30 11:31:35 +02:00
Florian Weimer 4d4ce84924 resolv: Remove unused resolv/res_debug.h header file 2017-06-30 11:31:29 +02:00
Florian Weimer 09fbb56ad6 resolv: Remove DEBUG from resolv/res_send.c 2017-06-30 11:31:24 +02:00
Florian Weimer 5ca4aaea18 resolv: Move the res_mkquery function to the resolv/mk_query.c file 2017-06-30 11:31:18 +02:00
Florian Weimer 74084febc4 resolv: Reformat resolv/res_mkquery.c to GNU style 2017-06-30 11:31:12 +02:00
Florian Weimer 7ab27b76d2 resolv: Remove DEBUG macro from resolv/res_mkquery.c 2017-06-30 11:31:02 +02:00
Florian Weimer 5f17245d3e support: Report actual exit status in support_capture_subprocess_check 2017-06-30 11:30:48 +02:00
Florian Weimer 5b757a51b5 resolv: Make RES_ROTATE start with a random name server [BZ #19570]
Do not copy the actual name server addresses to rotate them.  Use a
global rotation offset instead.
2017-06-30 10:43:33 +02:00
Joseph Myers e78dc67889 SPARC sys/ucontext.h namespace fixes (bug 21457).
This patch fixes various miscellaneous namespace issues in the SPARC
sys/ucontext.h header.  These are similar to changes made previous to
other sys/ucontext.h headers, where the SPARC header was excluded from
those previous patches because of its complexity.

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

	[BZ #21457]
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (__ctx): New macro.
	[__WORDSIZE == 64] (MC_TSTATE): Define only for [__USE_MISC].
	[__WORDSIZE == 64] (MC_PC): Likewise.
	[__WORDSIZE == 64] (MC_NPC): Likewise.
	[__WORDSIZE == 64] (MC_Y): Likewise.
	[__WORDSIZE == 64] (MC_G1): Likewise.
	[__WORDSIZE == 64] (MC_G2): Likewise.
	[__WORDSIZE == 64] (MC_G3): Likewise.
	[__WORDSIZE == 64] (MC_G4): Likewise.
	[__WORDSIZE == 64] (MC_G5): Likewise.
	[__WORDSIZE == 64] (MC_G6): Likewise.
	[__WORDSIZE == 64] (MC_G7): Likewise.
	[__WORDSIZE == 64] (MC_O0): Likewise.
	[__WORDSIZE == 64] (MC_O1): Likewise.
	[__WORDSIZE == 64] (MC_O2): Likewise.
	[__WORDSIZE == 64] (MC_O3): Likewise.
	[__WORDSIZE == 64] (MC_O4): Likewise.
	[__WORDSIZE == 64] (MC_O5): Likewise.
	[__WORDSIZE == 64] (MC_O6): Likewise.
	[__WORDSIZE == 64] (MC_O7): Likewise.
	[__WORDSIZE == 64] (MC_NGREG): Rename to __MC_NGREG and define to
	__MC_NGREG if [__USE_MISC].
	[__WORDSIZE == 64] (MC_MAXFPQ): Define only for [__USE_MISC].
	[__WORDSIZE == 64] (mc_gregset_t): Define using __MC_NGREG.
	[__WORDSIZE == 64] (struct mc_fq): Rename to struct __mc_fq.
	Define fields using __ctx.
	[__WORDSIZE == 64] (mc_fpu_t): Remove struct tag.  Define fields
	using __ctx.
	[__WORDSIZE == 64] (mcontext_t): Define fields using __ctx.
	(REG_PSR): Define only for [__USE_MISC].
	(REG_PC): Likewise.
	(REG_nPC): Likewise.
	(REG_Y): Likewise.
	(REG_G1): Likewise.
	(REG_G2): Likewise.
	(REG_G3): Likewise.
	(REG_G4): Likewise.
	(REG_G5): Likewise.
	(REG_G6): Likewise.
	(REG_G7): Likewise.
	(REG_O0): Likewise.
	(REG_O1): Likewise.
	(REG_O2): Likewise.
	(REG_O3): Likewise.
	(REG_O4): Likewise.
	(REG_O5): Likewise.
	(REG_O6): Likewise.
	(REG_O7): Likewise.
	[__WORDSIZE == 64] (REG_ASI): Define only for [__USE_MISC].
	[__WORDSIZE == 64] (REG_FPRS): Likewise.
	(NGREG): Rename to __NGREG and define to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(SPARC_MAXREGWINDOW): Rename to __SPARC_MAXREGWINDOW and define to
	__SPARC_MAXREGWINDOW if [__USE_MISC].
	(struct rwindow): Rename to struct __rwindow.  Define fields using
	__ctx.
	(rw_fp): Define only for [__USE_MISC].
	(rw_rtn): Likewise.
	(gwindows_t): Remove struct tag.  Define fields using __ctx and
	__SPARC_MAXREGWINDOW.
	(MAXFPQ): Define only for [__USE_MISC].
	(struct fpq): Rename to struct __fpq.  Define fields using __ctx.
	(struct fq): Rename to struct __fq.  Define fields using __ctx.
	(FPU_REGS_TYPE): Define only for [__USE_MISC].
	(FPU_DREGS_TYPE): Likewise.
	(V7_FPU_FSR_TYPE): Likewise.
	(V9_FPU_FSR_TYPE): Likewise.
	(V9_FPU_FPRS_TYPE): Likewise.
	[__WORDSIZE == 64] (fpregset_t): Remove struct tag.  Define fields
	using __ctx.
	[__WORDSIZE != 64] (fpregset_t): Likewise.
	[__WORDSIZE != 64] (xrs_t): Define fields using __ctx.
	[__WORDSIZE != 64] (XRS_ID): Define only for [__USE_MISC].
	[__WORDSIZE != 64] (mcontext_t): Define fields using __ctx.
	Rename field filler to __glibc_reserved1.
	* sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym
	(MC_FILLER): Remove.
2017-06-29 19:44:43 +00:00
Florian Weimer 84d8c5bc8b vfprintf: Fix tst-vfprintf-mbs-prec and tst-vfprintf-user-type 2017-06-29 16:46:03 +02:00
Adhemerval Zanella ccfb296472 posix: Improve default posix_spawn implementation
This patch improves the default posix implementation of posix_spawn{p}
and align with Linux one.  The main idea is to fix some issues already
fixed in Linux code, and deprecated vfork internal usage (source of
various bug reports).  In a short:

   - It moves POSIX_SPAWN_USEVFORK usage and sets it a no-op.  Since
     the process that actually spawn the new process do not share
     memory with parent (with vfork), it fixes BZ#14750 for this
     implementation.

   - It uses a pipe to correctly obtain the return upon failure
     of execution (BZ#18433).

   - It correctly enable/disable asynchronous cancellation (checked
     on ptl/tst-exec5.c).

   - It correctly disable/enable signal handling.

Using this version instead of Linux shows only one regression,
posix/tst-spawn3, because of pipe2 usage which increase total
number of file descriptor.

	* sysdeps/posix/spawni.c (__spawni_child): New function.
	(__spawni): Rename to __spawnix.
2017-06-29 10:59:07 -03:00
Florian Weimer edc1686af0 vfprintf: Reuse work_buffer in group_number 2017-06-29 09:37:13 +02:00
Florian Weimer 12d5853e22 vfprintf: Use struct scratch_buffer for positional arguments allocation 2017-06-29 09:37:04 +02:00
Florian Weimer cd00e12d31 _i18n_number_rewrite: Use struct scratch_buffer 2017-06-29 09:34:45 +02:00
Florian Weimer 08d01cae60 vfprintf: Reduce WORK_BUFFER_SIZE for wchar_t builds 2017-06-29 09:34:22 +02:00
Florian Weimer c11cfe8d7c vfprintf: Add test case for multi-byte/wide strings and precision 2017-06-29 09:33:44 +02:00
Florian Weimer e2390be8e4 vfprintf: Add test case for user-defined types and format specifiers 2017-06-29 09:33:09 +02:00
Adhemerval Zanella 1a920d9c26 posix: Adapt tst-spawn{2,3} to use libsupport.
Checked on x86_64-linux-gnu.

	* posix/tst-spawn2.c (do_test): Use libsupport.
	* posix/tst-spawn3.c (do_test): Likewise.
2017-06-28 16:48:55 -03:00
Joseph Myers fa562680ce Fix gen-tgmath-tests.py output for GCC 7 <float.h>.
* math/gen-tgmath-tests.py (Tests.__init__): Define
	__STDC_WANT_IEC_60559_TYPES_EXT__ at start of generated file.
2017-06-28 19:42:14 +00:00
Joseph Myers 614d15f932 Support _Float128 in tgmath.h.
This patch adds tgmath.h support for _Float128, so eliminating the
awkward caveat in NEWS about the type not being supported there.  This
does inevitably increase the size of macro expansions (which grows
particularly fast when you have nested calls to tgmath.h macros), but
only when _Float128 is supported and the declarations of _Float128
interfaces are visible; otherwise the expansions are unchanged.

Tested for x86_64 and arm.

	* math/tgmath.h: Include <bits/libc-header-start.h> and
	<bits/floatn.h>.
	(__TGMATH_F128): New macro.
	(__TGMATH_CF128): Likewise.
	(__TGMATH_UNARY_REAL_ONLY): Use __TGMATH_F128.
	(__TGMATH_UNARY_REAL_RET_ONLY): Likewise.
	(__TGMATH_BINARY_FIRST_REAL_ONLY): Likewise.
	(__TGMATH_BINARY_FIRST_REAL_STD_ONLY): New macro.
	(__TGMATH_BINARY_REAL_ONLY): Use __TGMATH_F128.
	(__TGMATH_BINARY_REAL_STD_ONLY): New macro.
	(__TGMATH_BINARY_REAL_RET_ONLY): Use __TGMATH_F128.
	(__TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY): Likewise.
	(__TGMATH_TERNARY_REAL_ONLY): Likewise.
	(__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): Likewise.
	(__TGMATH_UNARY_REAL_IMAG): Use __TGMATH_CF128.
	(__TGMATH_UNARY_IMAG): Use __TGMATH_F128.
	(__TGMATH_UNARY_REAL_IMAG_RET_REAL): Use __TGMATH_CF128.
	(__TGMATH_BINARY_REAL_IMAG): Likewise.
	(nexttoward): Use __TGMATH_BINARY_FIRST_REAL_STD_ONLY.
	[__USE_MISC] (scalb): Use __TGMATH_BINARY_REAL_STD_ONLY.
	* math/gen-tgmath-tests.py (Type.init_types): Enable _FloatN and
	_FloatNx types if the corresponding HUGE_VAL macros are defined.
2017-06-28 17:53:46 +00:00
Joseph Myers 0908a38adc Use clog10 not __clog10 in tgmath.h log10 macro.
As a GNU extension, for _GNU_SOURCE glibc's complex.h provides a
clog10 function and tgmath.h supports complex arguments to the log10
macro.  However, tgmath.h uses __clog10 not clog10 in defining the
macro.

There is no namespace reason (ignoring the block-scope namespace
issues that would apply equally to *every* function called by tgmath.h
macros) for using __clog10 here, since this is only for _GNU_SOURCE so
clog10 is always visible when this macro definition is used.
Furthermore, __clog10f128 is not exported, so supporting _Float128 in
tgmath.h implies using clog10 not __clog10 there.  (__clog10 and
clog10 aren't used in libstdc++ either, although that library would
have a good case for using the __clog10 reserved-namespace export: the
standard C++ library includes log10 of a complex number.)  This patch
duly changes the header to use clog10, and enables tests of the macro
for complex arguments.

Tested for x86_64.

	* math/tgmath.h [__USE_GNU] (log10): Use clog10 not __clog10.
	* math/gen-tgmath-tests.py (Tests.add_all_tests): Test log10 for
	complex arguments.
2017-06-28 16:43:50 +00:00
Joseph Myers d12a22c5d3 Fix tgmath.h totalorder, totalordermag return type (bug 21687).
The tgmath.h totalorder and totalordermag macros wrongly return a
floating-point type.  They should return int, like the underlying
functions.  This patch fixes them accordingly, updating tests
including enabling tests of those functions from gen-tgmath-tests.py.

Tested for x86_64.

	[BZ #21687]
	* math/tgmath.h (__TGMATH_BINARY_REAL_RET_ONLY): New macro.
	(totalorder): Use it.
	(totalordermag): Likewise.
	* math/gen-tgmath-tests.py (Tests.add_all_tests): Enable tests of
	totalorder and totalordermag.
	* math/test-tgmath.c (F(compile_test)): Do not call totalorder or
	totalordermag in arguments of calls to those functions.
	(NCALLS): Change to 134.
2017-06-28 16:31:10 +00:00
Joseph Myers cfa4434523 Simplify tgmath.h for integer return types.
The tgmath.h macros for function with integer return types generate
unnecessary casts to the return type.  Since in those cases the return
type does not depend on the argument type, all the cases in the
conditional expressions already have the right type, and no casts are
needed; this patch removes them.

Tested for x86_64.

	* math/tgmath.h (__TGMATH_UNARY_REAL_RET_ONLY): Do not take or
	cast to return type argument.
	(__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): Likewise.
	(lrint): Update call to __TGMATH_UNARY_REAL_RET_ONLY.
	(llrint): Likewise.
	(lround): Likewise.
	(llround): Likewise.
	(ilogb): Likewise.
	(llogb): Likewise.
	(fromfp): Update call to __TGMATH_TERNARY_FIRST_REAL_RET_ONLY.
	(ufromfp): Likewise.
	(fromfpx): Likewise.
	(ufromfpx): Likewise.
2017-06-28 16:19:47 +00:00
Joseph Myers 51737193a9 Remove NO_LONG_DOUBLE conditionals in libm tests (bug 21607).
As noted in bug 21607, NO_LONG_DOUBLE conditionals in libm tests are
no longer effective.  For most this is harmless - they were only
present because of long double functions not being declared with _LIBC
defined, and _LIBC is no longer defined for building most tests.  For
the few where this is actually relevant to the test, testing
LDBL_MANT_DIG > DBL_MANT_DIG is more appropriate as that limits the
test to public APIs.  This patch fixes the tests accordingly.

Tested for x86_64 and arm.

	[BZ #21607]
	* math/basic-test.c [!NO_LONG_DOUBLE]: Change conditionals to
	[LDBL_MANT_DIG > DBL_MANT_DIG].
	* math/bug-nextafter.c [!NO_LONG_DOUBLE]: Remove conditionals.
	* math/bug-nexttoward.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-math-isinff.cc [!NO_LONG_DOUBLE]: Likewise.
	* math/test-math-iszero.cc [!NO_LONG_DOUBLE]: Likewise.
	* math/test-nan-overflow.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-nan-payload.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-nearbyint-except-2.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-nearbyint-except.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-powl.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-signgam-finite-c99.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-signgam-finite.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-signgam-main.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-snan.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-tgmath-ret.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-tgmath.c: Include <float.h>.
	[!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG >
	DBL_MANT_DIG].
	* math/test-tgmath2.c: Include <float.h>.
	[!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG >
	DBL_MANT_DIG].
2017-06-28 16:01:20 +00:00
Joseph Myers 2dd0aec531 Add more thorough generated tgmath.h test.
This patch adds a more thorough test of tgmath.h macros, verifying
both the return type and the function called for all the cases of
valid argument types.  (Cases with current problems - I've just filed
four bugs - are disabled or omitted pending fixing those problems.)
The test uses a Python generator (works with both Python 2 and 3) to
generate a C file which is then built and run as a test in the usual
way (and that C file includes its own dummy definitions of libm
functions similar to existing tgmath.h tests).  The motivation is to
make it easier to add tests of tgmath.h for _Float128 when adding
tgmath.h support for that type; the _FloatN / _FloatNx support is
present in the script, but disabled until the tgmath.h support is
written.

Tested for x86_64, and for arm to check things in the long double =
double case.  (In that case, it's OK to call either double or long
double functions when the selected type is double or long double, as
long as the return type of the macro is exactly correct.)

	* math/gen-tgmath-tests.py: New file.
	* math/Makefile [PYTHON] (tests): Add test-tgmath3.
	[PYTHON] (generated): Add test-tgmath3.c.
	[PYTHON] (CFLAGS-test-tgmath3.c): New variable.
	[PYTHON] ($(objpfx)test-tgmath3.c): New rule.
2017-06-28 14:20:21 +00:00
Joseph Myers 073e8fa773 Require binutils 2.25 or later to build glibc.
This patch implements a requirement of binutils >= 2.25 (up from 2.22)
to build glibc.  Tests for 2.24 or later on x86_64 and s390 are
removed.  It was already the case, as indicated by buildbot results,
that 2.24 was too old for building tests for 32-bit x86 (produced
internal linker errors linking elf/tst-gnu2-tls1mod.so).  I don't know
if any configure tests for binutils features are obsolete given the
increased version requirement.

Tested for x86_64.

	* configure.ac (AS): Require binutils 2.25 or later.
	(LD): Likewise.
	* configure: Regenerated.
	* sysdeps/s390/configure.ac (AS): Remove version check.
	* sysdeps/s390/configure: Regenerated.
	* sysdeps/x86_64/configure.ac (AS): Remove version check.
	* sysdeps/x86_64/configure: Regenerated.
	* manual/install.texi (Tools for Compilation): Document
	requirement for binutils 2.25 or later.
	* INSTALL: Regenerated.
2017-06-28 11:31:50 +00:00
H.J. Lu f300dc7358 Support building glibc with gold 1.14 or above [BZ #14995]
This patch changes configure.ac to allow gold 1.14 or above to be used
to configire glibc so that gold glibc bugs can be fixed.  Tested with

CC="gcc -fuse-ld=gold" CXX="g++ -fuse-ld=gold"

on Fedora 25 with gold 1.14 (20170623).  Gold 1.14 was first released
in binutils 2.28.

On x86-64, for "make check", I got

Error in `/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1': double free or corruption (fasttop): 0x00000000008755f0 ***
======= Backtrace: =========
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x772fb)[0x7f85225b52fb]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x7d6c6)[0x7f85225bb6c6]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x7df0e)[0x7f85225bbf0e]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(+0x182d)[0x7f85226e682d]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(dlclose+0x1f)[0x7f85226e623f]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so(+0x933)[0x7f8522539933]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0xfd1a)[0x7f85226fbd1a]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x3c5e0)[0x7f852257a5e0]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x3c63a)[0x7f852257a63a]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so(+0x9aa)[0x7f85225399aa]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0xf74a)[0x7f85226fb74a]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0xf85b)[0x7f85226fb85b]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0x13e98)[0x7f85226ffe98]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(_dl_catch_error+0x71)[0x7f85226643c1]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0x13639)[0x7f85226ff639]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(+0x1156)[0x7f85226e6156]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(_dl_catch_error+0x71)[0x7f85226643c1]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(+0x1789)[0x7f85226e6789]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(dlopen+0x32)[0x7f85226e61e2]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1[0x4009ca]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(__libc_start_main+0xf1)[0x7f8522565231]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1[0x400a5a]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:11 26334965                           /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1
00401000-00402000 r--p 00000000 08:11 26334965                           /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1
00402000-00403000 rw-p 00001000 08:11 26334965                           /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1
00875000-00896000 rw-p 00000000 00:00 0                                  [heap]
7f851c000000-7f851c021000 rw-p 00000000 00:00 0
7f851c021000-7f8520000000 ---p 00000000 00:00 0
7f85222f3000-7f8522309000 r-xp 00000000 08:02 136658                     /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522309000-7f8522508000 ---p 00016000 08:02 136658                     /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522508000-7f8522509000 r--p 00015000 08:02 136658                     /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522509000-7f852250a000 rw-p 00016000 08:02 136658                     /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522539000-7f852253a000 r-xp 00000000 08:11 26334619                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so
7f852253a000-7f852253b000 r--p 00000000 08:11 26334619                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so
7f852253b000-7f852253c000 rw-p 00001000 08:11 26334619                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so
7f852253c000-7f852253e000 rw-p 00000000 00:00 0
7f852253e000-7f85226da000 r-xp 00000000 08:11 26309973                   /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226da000-7f85226db000 ---p 0019c000 08:11 26309973                   /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226db000-7f85226de000 r--p 0019c000 08:11 26309973                   /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226de000-7f85226e1000 rw-p 0019f000 08:11 26309973                   /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226e1000-7f85226e5000 rw-p 00000000 00:00 0
7f85226e5000-7f85226e8000 r-xp 00000000 08:11 26313777                   /export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so
7f85226e8000-7f85226e9000 r--p 00002000 08:11 26313777                   /export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so
7f85226e9000-7f85226ea000 rw-p 00003000 08:11 26313777                   /export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so
7f85226ea000-7f85226ec000 rw-p 00000000 00:00 0
7f85226ec000-7f8522711000 r-xp 00000000 08:11 26309972                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so
7f8522711000-7f8522712000 rw-p 00000000 00:00 0
7f8522712000-7f8522713000 r--p 00025000 08:11 26309972                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so
7f8522713000-7f8522714000 rw-p 00026000 08:11 26309972                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so
7f8522714000-7f8522715000 rw-p 00000000 00:00 0
7ffc5a2bd000-7ffc5a2df000 rw-p 00000000 00:00 0                          [stack]
7ffc5a32c000-7ffc5a32e000 r--p 00000000 00:00 0                          [vvar]
7ffc5a32e000-7ffc5a330000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

and

make[4]: *** [/export/build/gnu/glibc-gold/build-x86_64-linux/elf/vismain] Error 1

This is because gold doesn't support protected data symbols:

configure:5672: checking linker support for protected data symbol
configure:5682: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector -fPIC -shared conftest.c -o conftest.so
configure:5685: $? = 0
configure:5692: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector conftest.c -o conftest conftest.so
/usr/local/bin/ld.gold: error: /tmp/ccXWoofs.o: cannot make copy relocation for protected symbol 'bar', defined in conftest.so
collect2: error: ld returned 1 exit status

make[4]: *** [/export/build/gnu/glibc-gold/build-x86_64-linux/elf/tst-split-dynreloc] Error 1

This is because gold doesn't support INSERT in linker script:

https://sourceware.org/bugzilla/show_bug.cgi?id=21676

The total failures are

FAIL: dlfcn/bug-dl-leaf
FAIL: elf/constload1
FAIL: elf/global
FAIL: elf/ifuncmain1
FAIL: elf/ifuncmain1pic
FAIL: elf/ifuncmain1pie
FAIL: elf/ifuncmain1vis
FAIL: elf/ifuncmain1vispic
FAIL: elf/ifuncmain1vispie
FAIL: elf/ifuncmain3
FAIL: elf/initfirst
FAIL: elf/preloadtest
FAIL: elf/tst-audit11
FAIL: elf/tst-audit12
FAIL: elf/tst-audit4
FAIL: elf/tst-audit5
FAIL: elf/tst-audit6
FAIL: elf/tst-audit7
FAIL: elf/tst-dlmodcount
FAIL: elf/tst-dlmopen1
FAIL: elf/tst-dlmopen3
FAIL: elf/tst-dlopenrpath
FAIL: elf/tst-latepthread
FAIL: elf/tst-leaks1-mem
FAIL: elf/tst-nodelete-dlclose
FAIL: elf/unload6
FAIL: nss/test-netdb
FAIL: nss/tst-nss-test1
FAIL: posix/tst-getaddrinfo5

	[BZ #14995]
	* configure.ac: Allow gold 1.14 or above to configire glibc
	* configure: Regenerated.
2017-06-28 04:03:57 -07:00
Joseph Myers d57cb31910 Miscellaneous sys/ucontext.h namespace fixes (bug 21457).
This patch fixes various miscellaneous namespace issues in
sys/ucontext.h headers.

Some struct tags are removed where the structs also have *_t typedef
names, while other struct tags without such names are renamed to start
__; the changes are noted in NEWS as they can affect C++ name mangling
(although there seems to be little if any external use of these types,
at least based on checking codesearch.debian.net).  For powerpc,
pointers to struct pt_regs (not defined in this header) are changed to
point to struct __ctx(pt_regs), so in the __USE_MISC case those struct
fields continue to point to the existing struct pt_regs type for
maximum compatibility, while when that's a namespace issue they point
to a struct __pt_regs type which is always an incomplete struct.

Tested for affected architectures with build-many-glibcs.py.

	[BZ #21457]
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (fpregset_t): Remove
	struct tag.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (fpregset_t):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (mcontext_t):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (pt_regs):
	Declare struct type with __ctx.
	[__WORDSIZE != 32] (mcontext_t): Use __ctx with pt_regs struct
	tag.
	(ucontext_t) [__WORDSIZE == 32]: Use __ctx with pt_regs struct tag
	and regs field name.
2017-06-28 10:33:23 +00:00
Joseph Myers ac782f9e9a Fix elf/loadtest.c build with GCC 8.
Building the testsuite with current GCC mainline fails with:

loadtest.c: In function 'main':
loadtest.c:76:3: error: macro expands to multiple statements [-Werror=multistatement-macros]
   for (map = MAPS; map != NULL; map = map->l_next)        \
   ^
loadtest.c:165:2: note: in expansion of macro 'OUT'
  OUT;
  ^~~
loadtest.c:164:7: note: some parts of macro expansion are not guarded by this 'if' clause
       if (debug)
       ^~

This seems like a genuine bug, although fairly harmless; it means the
fflush call in the OUT macro is unconditional instead of being inside
the conditional as presumably intended.  This patch makes this macro
use do { } while (0) to avoid the problem.

Tested for x86_64 (testsuite), and with build-many-glibcs.py for
aarch64-linux-gnu with GCC mainline.

	* elf/loadtest.c (OUT): Define using do { } while (0).
2017-06-27 17:52:42 +00:00
Joseph Myers e4043b84c4 Fix strftime build with GCC 8.
Building with current GCC mainline fails with:

strftime_l.c: In function '__strftime_internal':
strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros]
    digits = d > width ? d : width;          \
    ^
strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER'
      DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
      ^~~~~~~~~
strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause
    else
    ^~~~

In fact this particular instance is harmless; the code looks like:

          if (modifier == L_('O'))
            goto bad_format;
          else
            DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);

and because of the goto, it doesn't matter that part of the expansion
isn't under the "else" conditional.  But it's also clearly bad style
to rely on that.  This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD
to use do { } while (0) to avoid such problems.

Tested (full testsuite) for x86_64 (GCC 6), and with
build-many-glibcs.py with GCC mainline, in conjunction with my libgcc
patch <https://gcc.gnu.org/ml/gcc-patches/2017-06/msg02032.html>.

	* time/strftime_l.c (DO_NUMBER): Define using do { } while (0).
	(DO_NUMBER_SPACEPAD): Likewise.
2017-06-27 17:12:13 +00:00
Prakhar Bahuguna f8f72bc0c3 [ARM] Optimise memchr for NEON-enabled processors
This patch provides an optimised implementation of memchr using NEON
instructions to improve its performance, especially with longer search regions.
This gave an improvement in performance against the Thumb2+DSP optimised code,
with more significant gains for larger inputs. The NEON code also wins in cases
where the input is small (less than 8 bytes) by defaulting to a simple
byte-by-byte search. This avoids the overhead imposed by filling two quadword
registers from memory.

	* sysdeps/arm/armv7/multiarch/Makefile: Add memchr_neon to
	sysdep_routines.
	* sysdeps/arm/armv7/multiarch/ifunc-impl-list.c: Add define for
	__memchr_neon.
	Add ifunc definitions for __memchr_neon and __memchr_noneon.
	* sysdeps/arm/armv7/multiarch/memchr.S: New file.
	* sysdeps/arm/armv7/multiarch/memchr_impl.S: Likewise.
	* sysdeps/arm/armv7/multiarch/memchr_neon.S: Likewise.

Testing done: Ran regression tests for arm-none-linux-gnueabihf as well as a
full toolchain bootstrap. Benchmark tests were ran on ARMv7-A and ARMv8-A
hardware targets.
2017-06-27 15:43:50 +00:00
Stefan Liebler a37b5daa6b S390: Use cu21 instruction for converting from utf16 to utf8.
This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu21 instruction.

ChangeLog:

	* sysdeps/s390/utf8-utf16-z9.c (__to_utf8_loop_vx_cu):
	Use vector and cu21 instruction.
	* sysdeps/s390/multiarch/utf8-utf16-z9.c:
	Add __to_utf8_loop_vx_cu in ifunc resolver.
2017-06-27 17:09:43 +02:00
Stefan Liebler f0137ff31d S390: Use cu24 instruction for converting from utf16 to utf32.
This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu24 instruction.

ChangeLog:

	* sysdeps/s390/utf16-utf32-z9.c (__from_utf16_loop_vx_cu):
	Use vector and cu24 instruction.
    	* sysdeps/s390/multiarch/utf16-utf32-z9.c:
    	Add __from_utf16_loop_vx_cu in ifunc resolver.
2017-06-27 17:09:43 +02:00
Stefan Liebler 593e4da186 S390: Use cu42 instruction for converting from utf32 to utf16.
This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu42 instruction.

ChangeLog:

	* sysdeps/s390/utf16-utf32-z9.c (__to_utf16_loop_vx_cu):
	Use vector and cu42 instruction.
	* sysdeps/s390/multiarch/utf16-utf32-z9.c:
	Add __to_utf16_loop_vx_cu in ifunc resolver.
2017-06-27 17:09:43 +02:00
Stefan Liebler 23ea69a9d6 S390: Use cu41 instruction for converting from utf32 to utf8.
This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu41 instruction.

ChangeLog:

	* sysdeps/s390/utf8-utf32-z9.c (__to_utf8_loop_vx_cu):
	Use vector and cu41 instruction.
	* sysdeps/s390/multiarch/utf8-utf32-z9.c: Add __to_utf8_loop_vx_cu
	in ifunc resolver.
2017-06-27 17:09:42 +02:00
Stefan Liebler f21f59124d S390: Add new hwcap values for new cpu architecture - arch12.
The new hwcap values indicate support for:
- Vector packed decimal facility
- Vector enhancements facility 1
- Guarded storage facility

Note: arch12 is NOT the official name of the new CPU.
It refers to the edition number of the Principle of Operations manual.

ChangeLog:

	* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags):
	Add vxd, vxe, gs flag.
	* sysdeps/s390/dl-procinfo.h: Add HWCAP_S390_VXD, HWCAP_S390_VXE,
	HWCAP_S390_GS capability.
	* sysdeps/unix/sysv/linux/s390/bits/hwcap.h
	(HWCAP_S390_VXD, HWCAP_S390_VXE, HWCAP_S390_GS): Define.
2017-06-27 17:09:42 +02:00
H.J. Lu e94c310357 x86-64: Optimize memcmp-avx2-movbe.S for short difference
Check the first 32 bytes before checking size when size >= 32 bytes
to avoid unnecessary branch if the difference is in the first 32 bytes.
Replace vpmovmskb/subl/jnz with vptest/jnc.

On Haswell, the new version is as fast as the previous one.  On Skylake,
the new version is a little bit faster.

	* sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S (MEMCMP): Check
	the first 32 bytes before checking size when size >= 32 bytes.
	Replace vpmovmskb/subl/jnz with vptest/jnc.
2017-06-27 07:55:00 -07:00
Stefan Liebler 83653f804d S390: Save and restore r12 in TLS_IE macro.
The testcases elf/tst-tls1-static and elf/tst-tls2-static
are failing on s390 if gcc is configured with --enable-default-pie.

According to binutils, there are only four valid cases for IE -> LE transition:
lg %rx,(0,%ry)    -> sllg %rx,%ry,0
lg %rx,(%ry,0)    -> sllg %rx,%ry,0
lg %rx,(%ry,%r12) -> sllg %rx,%ry,0
lg %rx,(%r12,%ry) -> sllg %rx,%ry,0

Thus I've adjusted the TLS_IE macro in s390 tls-macros.h files in PIC case
in order to use r12 for the address of global offset table.
The adjusted macro definition is not used if gcc is not configured with
--enable-default-pie.

ChangeLog:

	* sysdeps/s390/s390-32/tls-macros.h (TLS_IE): Use r12 for GOT address.
	* sysdeps/s390/s390-64/tls-macros.h (TLS_IE): Likewise.
2017-06-27 15:23:43 +02:00
Florian Weimer 39bd76df3d resolv: Avoid timeouts in test-resolv-res-init, test-resolv-res_init-thread
Some Linux kernels have very aggressive ICMP rate limiting on the
loopback interface.  This commit introduces a minimal echoing DNS server
inside the network namespace, so that there is no need for ICMP error
messages anymore.
2017-06-27 10:21:34 +02:00