Commit Graph

23590 Commits

Author SHA1 Message Date
Adhemerval Zanella
1dac8bd6f2 powerpc: Use generic fabs{f} implementations
Since be2e25bbd7 the generic ieee754 implementation uses
compiler builtin which generates fabs{f} for all supported targets.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

	* sysdeps/powerpc/fpu/s_fabs.S: Remove file.
	* sysdeps/powerpc/fpu/s_fabsf.S: Likewise.
2019-04-17 15:14:47 -03:00
Adhemerval Zanella
a3ae315a8f mips: Remove rt_sigreturn usage on context function
Similar to powerpc, mips also issues rt_sigreturn for setcontext
case the v0 value saved is not the one set by setcontext or
makecontext. As for powerpc, it is intention is no really supported
since setcontext is not async-signal-safe.

Checked the context tests on mips64-linux-gnu and mips-linux-gnu.

	* sysdeps/unix/sysv/linux/mips/getcontext.S (__getcontext): Remove
	the magic flag store.
	* sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/swapcontext.S (__swapcontext):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/setcontext.S (__setcontext):
	Remove rt_sigreturn call.
2019-04-17 15:14:45 -03:00
Adhemerval Zanella
ffe8a9a831 powerpc: Remove rt_sigreturn usage on context function
As described in a recent glibc thread [1], the rt_sigreturn syscall
on setcontext and swapcontext is not used on default use and its
intention is no really supported since neither setcontext nor
swapcontext are async-signal-safe.

Checked on powerpc64-linux-gnu and powerpc-linux-gnu.

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S:
	Remove rt_sigreturn call.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S: Likewie.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S: Likewise.

[1] https://sourceware.org/ml/libc-alpha/2019-02/msg00367.html
2019-04-17 15:14:41 -03:00
Adhemerval Zanella
0e16969129 support: Add support_capture_subprogram
Its API is similar to support_capture_subprocess, but rather creates a
new process based on the input path and arguments.  Under the hoods it
uses posix_spawn to create the new process.

It also allows the use of other support_capture_* functions to check
for expected results and free the resources.

Checked on x86_64-linux-gnu.

	* support/Makefile (libsupport-routines): Add support_subprocess,
	xposix_spawn, xposix_spawn_file_actions_addclose, and
	xposix_spawn_file_actions_adddup2.
	(tst-support_capture_subprocess-ARGS): New rule.
	* support/capture_subprocess.h (support_capture_subprogram): New
	prototype.
	* support/support_capture_subprocess.c (support_capture_subprocess):
	Refactor to use support_subprocess and support_capture_poll.
	(support_capture_subprogram): New function.
	* support/tst-support_capture_subprocess.c (write_mode_to_str,
	str_to_write_mode, test_common, parse_int, handle_restart,
	do_subprocess, do_subprogram, do_multiple_tests): New functions.
	(do_test): Add support_capture_subprogram tests.
	* support/subprocess.h: New file.
	* support/support_subprocess.c: Likewise.
	* support/xposix_spawn.c: Likewise.
	* support/xposix_spawn_file_actions_addclose.c: Likewise.
	* support/xposix_spawn_file_actions_adddup2.c: Likewise.
	* support/xspawn.h: Likewise.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-04-17 11:35:59 -03:00
Mike Gerow
bae8cf0e93 stdlib/tst-secure-getenv: handle >64 groups
This test would fail unnecessarily if the user running it had more than
64 groups since getgroups returns EINVAL if the size provided is less
than the number of supplementary group IDs. Instead dynamically
determine the number of supplementary groups the user has.
2019-04-17 11:45:34 +02:00
TAMUKI Shoichi
6b5c8607a4 ChangeLog: Correct excess and deficiency of spaces 2019-04-17 12:44:26 +09:00
TAMUKI Shoichi
b39d961c71 ChangeLog: Convert leading spaces to tabs 2019-04-16 10:17:24 +09:00
Florian Weimer
e3f454bac0 nss_dns: Do not replace root domain with empty string
The purpose of the bp[0] == '.' check is unclear.  Only the root domain
starts with '.'.  The empty string is accepted as a domain name in many
places, denoting the root, but using it implicitly is confusing.
2019-04-11 11:37:47 +02:00
Florian Weimer
32d85c116d alloc_buffer: Return unqualified pointer type in alloc_buffer_next
alloc_buffer_next is useful for peeking to the remaining part of the
buffer and update it, with subsequent allocation (once the length
is known) using alloc_buffer_alloc_bytes.  This is not as robust
as the other interfaces, but it allows using alloc_buffer with
string-writing interfaces such as snprintf and ns_name_ntop.
2019-04-11 09:43:17 +02:00
Florian Weimer
221710af7e Add missing ChangeLog entry for commit 10dd69e9a0 2019-04-11 09:41:08 +02:00
Carlos O'Donell
e621246ec6 malloc: Set and reset all hooks for tracing (Bug 16573)
If an error occurs during the tracing operation, particularly during a
call to lock_and_info() which calls _dl_addr, we may end up calling back
into the malloc-subsystem and relock the loader lock and deadlock. For
all intents and purposes the call to _dl_addr can call any of the malloc
family API functions and so we should disable all tracing before calling
such loader functions.  This is similar to the strategy that the new
malloc tracer takes when calling the real malloc, namely that all
tracing ceases at the boundary to the real function and any faults at
that point are the purvue of the library (though the new tracer does
this on a per-thread basis in an MT-safe fashion). Since the new tracer
and the hook deprecation are not yet complete we must fix these issues
where we can.

Tested on x86_64 with no regressions.

Co-authored-by: Kwok Cheung Yeung <kcy@codesourcery.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2019-04-09 10:56:51 -04:00
Wilco Dijkstra
648279f4af Improve string benchtests
Replace slow byte-oriented tests in several string benchmarks with the
generic implementations from the string/ directory so the comparisons
are more realistic and useful.

	* benchtests/bench-stpcpy.c (SIMPLE_STPCPY): Remove function.
	(generic_stpcpy): New function.
	* benchtests/bench-stpncpy.c (SIMPLE_STPNCPY): Remove function.
	(generic_stpncpy): New function.
	* benchtests/bench-strcat.c (SIMPLE_STRCAT): Remove function.
	(generic_strcat): New function.
	* benchtests/bench-strcpy.c (SIMPLE_STRCPY): Remove function.
	(generic_strcpy): New function.
	* benchtests/bench-strncat.c (SIMPLE_STRNCAT): Remove function.
	(STUPID_STRNCAT): Remove function.
	(generic_strncat): New function.
	* benchtests/bench-strncpy.c (SIMPLE_STRNCPY): Remove function.
	(STUPID_STRNCPY): Remove function.
	(generic_strncpy): New function.
	* benchtests/bench-strnlen.c (SIMPLE_STRNLEN): Remove function.
	(generic_strnlen): New function.
	(memchr_strnlen): New function.
	* benchtests/bench-strlen.c (generic_strlen): Define for WIDE.
	(memchr_strlen): Likewise.
2019-04-09 11:54:34 +01:00
Wilco Dijkstra
93eebae516 Improve bench-strstr
Improve bench-strstr by using an extract from the manual as the input
to make the test more realistic.  Use the same input for both found and
fail cases rather than using a memset of '0' for most of the string,
which measures performance of strchr rather than strstr.  Add result
checking to catch potential errors.  Remove the repeated tests at slightly
different alignments and add more large needle and haystack testcases.

Replace stupid_strstr with an efficient basic implementation.  Add the
Two-way implementation to simplify comparisons with much faster generic
implementations.

	* benchtests/bench-strstr.c (input): Add realistic input text.
	(stupid_strstr): Remove function.
	(basic_strstr): Add function.
	(twoway_strstr): Add function.
	(do_one_test): Add result checking.
	(do_test): Use new input text.  Remove accidental early matches.
	(test_main): Improve range of tests, reduce unaligned cases.
2019-04-09 11:49:18 +01:00
Wilco Dijkstra
a173d09f85 Improve bench-memmem
Improve bench-memmem by replacing simple_memmem with a more efficient
implementation.  Add the Two-way implementation to enable direct comparison
with the optimized memmem.

	* benchtests/bench-memmem.c (simple_memmem): Remove function.
	(basic_memmem): Add function.
	(twoway_memmem): Add function.
2019-04-09 11:46:28 +01:00
Wilco Dijkstra
6103c0a811 Remove TIMING_INIT
Remove TIMING_INIT since it's no longer used.

	* benchtests/bench-malloc-simple.c: Remove TIMING_INIT.
	* benchtests/bench-malloc-thread.c: Likewise.
	* benchtests/bench-skeleton.c: Likewise.
	* benchtests/bench-strtod.c: Likewise.
	* benchtests/bench-timing.h: Likewise.
2019-04-09 11:38:24 +01:00
Florian Weimer
333221862e resolv: Remove RES_INSECURE1, RES_INSECURE2
Always perform the associated security checks.
2019-04-08 11:19:38 +02:00
Florian Weimer
3f8b44be0a resolv: Remove support for RES_USE_INET6 and the inet6 option
This functionality was deprecated in glibc 2.25.

This commit only includes the core changes to remove the
functionality.  It does not remove the RES_USE_INET6 handling in the
individual NSS service modules and the res_use_inet6 function.
These changes will happen in future commits.
2019-04-08 10:56:22 +02:00
Anton Youdkevitch
94e358f6d4 aarch64: thunderx2 memcpy implementation cleanup and streamlining
Here is the updated patch for improving the long unaligned
code path (the one using "ext" instruction).

1. Always taken conditional branch at the beginning is
removed.

2. Epilogue code is placed after the end of the loop to
reduce the number of branches.

3. The redundant "mov" instructions inside the loop are
gone due to the changed order of the registers in the "ext"
instructions inside the loop,  the prologue has additional
"ext" instruction.

4.Updating count in the prologue was hoisted out as
it is the same update for each prologue.

5. Invariant code of the loop epilogue was hoisted out.

6. As the current size of the ext chunk is exactly 16
instructions long "nop" was added at the beginning
of the code sequence so that the loop entry for all the
chunks be aligned.

	* sysdeps/aarch64/multiarch/memcpy_thunderx2.S: Cleanup branching
	and remove redundant code.
2019-04-05 13:59:54 -07:00
Adhemerval Zanella
f82ed45d7f powerpc: Use generic wcsrchr optimization
This patch removes the power6 wcsrchr optimization and uses generic
implementation instead.  Currently, both power6 and power7 IFUNC variant
resulting binary are essentially the same and the generic implementation
with unrolling loop set to 8 also results in similar performance.

Checked on powerpc64-linux-gnu.

	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcsrchr.c):
	New rule.
	* sysdeps/powerpc/power6/wcsrchr.c: Remove file.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power6.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-power7.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr-ppc32.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcsrchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power6.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-power7.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcsrchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/power6/wcsrchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
	[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcsrchr-power6 and
	wcsrchr-power7.
	(CFLAGS-wcsrchr-power7.c, CFLAGS-wcsrchr-power6.c): Remove rule.
	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
	Remove wcsrchr optimizations.
	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.
2019-04-04 16:01:14 +07:00
Adhemerval Zanella
662c2cc4e9 wcsmbs: Use loop_unroll on wcsrchr
This allows an architecture to set explicit loop unrolling.

Checked on aarch64-linux-gnu.

	* wcsmbs/wcsrchr.c (WCSRCHR): Use loop_unroll.h to parametrize
	the loop unroll.
2019-04-04 16:01:14 +07:00
Adhemerval Zanella
421e3005ca powerpc: Use generic wcschr optimization
This patch removes the power6 wcschr optimization and uses generic
implementation instead.  Currently, both power6 and power7 IFUNC variant
resulting binary are essentially the same and the generic implementation
with unrolling loop set to 8 also results in similar performance.

Checked on powerpc64-linux-gnu.

	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcschr.c):
	New rule.
	* sysdeps/powerpc/power6/wcschr.c: Remove file.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power6.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-power7.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcschr-power6.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcschr-power7.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcschr-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcschr.c: Likewise.
	* sysdeps/powerpc/powerpc64/power6/wcschr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
	[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcschr-power6 and
	wcschr-power7.
	(CFLAGS-wcschr-power7.c, CFLAGS-wcschr-power6.c): Remove rule.
	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
	Remove wcschr optimizations.
	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.
2019-04-04 16:01:14 +07:00
Adhemerval Zanella
7ba0100c6a wcsmbs: Use loop_unroll on wcschr
This allows an architecture to set explicit loop unrolling.

Checked on aarch64-linux-gnu.

	* wcsmbs/wcschr.c (WCSCHR): Use loop_unroll.h to parametrize
	the loop unroll.
2019-04-04 16:01:14 +07:00
Adhemerval Zanella
447a1306c3 powerpc: Use generic wcscpy optimization
This patch removes the power6 wcscpy optimization and uses generic
implementation instead.  Currently, both power6 and power7 IFUNC variant
resulting binary are essentially the same and the generic implementation
with unrolling loop set to 8 also results in similar performance.

Checked on powerpc64-linux-gnu.

	* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcscpy.c):
	New rule.
	* sysdeps/powerpc/power6/wcscpy.c: Remove file.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power6.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-power7.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcscpy-power6.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcscpy-power7.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcscpy-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcscpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/power6/wcscpy.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/Makefile
	[$(subdir) == wcsmbs] (sysdeps_routines): Remove wcscpy-power6 and
	wcscpy-power7.
	(CFLAGS-wcscpy-power7.c, CFLAGS-wcscpy-power6.c): Remove rule.
	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c:
	Remove wcscpy optimizations.
	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.
2019-04-04 16:01:14 +07:00
Adhemerval Zanella
e3fd0b0e93 wcsmbs: Add wcscpy loop unroll option
This allows an architecture to use the old generic implementation
and also set explicit loop unrolling.

Checked on aarch64-linux-gnu.

	* include/loop_unroll.h: New file.
	* wcsmbs/wcscpy (__wcscpy): Add option to use loop unrolling
	besides generic implementation.
2019-04-04 16:01:10 +07:00
DJ Delorie
8260f23616 time/tst-strftime3.c: Disable snprintf warning.
snprintf will only truncate the output if the data its given
is corrupted, but a truncated buffer will not match the
"pristine" data's buffer, which is all we need.  So just
disable the warning via the DIAG macros.
2019-04-03 17:49:43 -04:00
DJ Delorie
0bd545ee23 Add Reiwa era tests to time/tst-strftime3.c
Also fix printf warning
2019-04-02 10:40:17 -04:00
TAMUKI Shoichi
466afec308 ja_JP locale: Add entry for the new Japanese era [BZ #22964]
The Japanese era name will be changed on May 1, 2019.  The Japanese
government made a preliminary announcement on April 1, 2019.

The glibc ja_JP locale must be updated to include the new era name for
strftime's alternative year format support.

Checked on x86_64-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

ChangeLog:

	[BZ #22964]
	* localedata/locales/ja_JP (LC_TIME): Add entry for the new Japanese
	era.
	* time/tst-strftime2.c (dates): Add 2019-04-30 and 2019-05-01.
	(mkreftable): Add rules for the new Japanese era and the new dates.
2019-04-02 16:46:55 +09:00
TAMUKI Shoichi
84aea16929 time: Add tests for Minguo calendar [BZ #24293]
Co-authored-by: Rafal Luzynski <digitalfreak@lingonborough.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>

ChangeLog:

	[BZ #24293]
	* time/Makefile (LOCALES): Add zh_TW.UTF-8, cmn_TW.UTF-8,
	hak_TW.UTF-8, nan_TW.UTF-8, and lzh_TW.UTF-8.
	* time/tst-strftime2.c (locales): Likewise.
	(dates): Add 1910-04-01, 1911-12-31, 1912-01-01, 1913-04-01,
	2010-04-01, and 2011-04-01.
	(mkreftable): Add rules for the new locales and the new dates.
2019-04-02 16:42:04 +09:00
TAMUKI Shoichi
2f1d61552d time/tst-strftime2.c: Make the file easier to maintain
Express the years as full Gregorian years (e.g., 1988 instead of 88)
and months with natural numbers (1-12 rather than 0-11).

Compare actual dates rather than indexes when selecting the era name.

Declare the local variable era as a string character pointer rather
than an array of chars where the actual string is copied which might
lead to potential buffer overflows in future.

Co-authored-by: Rafal Luzynski <digitalfreak@lingonborough.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>

ChangeLog:

	* time/tst-strftime2.c (date_t): Explicitly define the type.
	(dates): Use natural month and year numbers to express a date.
	(is_before): New function to compare dates.
	(mkreftable): Minor improvements to simplify maintenance.
	(do_test): Reflect the changes in dates array.
2019-04-02 16:37:03 +09:00
Carlos O'Donell
62449176e0 Add verbose comments to 'era' in ja_JP locale.
Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com>
Reviewed-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
2019-04-01 15:14:16 -04:00
DJ Delorie
e0e4c321c3 Fix strptime era handling, add more strftime tests [BZ #24394]
Test the transition points between all the currently listed Japanese
era name changes. This includes testing the transition between the
first year date and the second year date. This test will help test
the upcoming Japanese era name change.

Also fixes a fencepost error where the era name isn't properly parsed
by strptime in the last (partial) year of the era.

Example: if an era change happens in Feb 1990, and again in Aug 1995,
that's 5.5 years long, but the 0.5 year wasn't accounted for.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-04-01 14:19:16 -04:00
Uros Bizjak
993e3107af alpha: Improve sysdeps/alpha/divqu.S and sysdeps/alpha/remqu.S
* sysdeps/alpha/divqu.S (__divqu): Move save of $f0 and excb after
	conditional branch to DIVBYZERO.  Fix unwind info.
	* sysdeps/alpha/remqu.S (__remqu): Move saves of $f0, $f1, $f2 and
	excb after conditional branch to $powerof2.  Add missing unop
	instructions and .align directives and reorder instructions to
	match __divqu.

Signed-off-by: Uroš Bizjak <ubizjak@gmail.com>
2019-04-01 16:00:37 +07:00
Richard Henderson
d5ecee822e alpha: Do not redefine __NR_shmat or __NR_osf_shmat
Fixes build using v5.1-rc1 headers.

The kernel has cleaned up how these are defined.  Previous behavior
was to define __NR_osf_shmat as 209 and not define __NR_shmat.
Current behavior is to define __NR_shmat as 209 and then define
__NR_osf_shmat as __NR_shmat.

	* sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat):
	Do not redefine.
	* sysdeps/unix/sysv/linux/alpha/sysdep.h (__NR_osf_shmat):
	Do not redefine.
2019-04-01 15:54:00 +07:00
Maciej W. Rozycki
656dd306d4 RISC-V: Fix `test' operand error with soft-float ABI being configured
Fix a:

.../sysdeps/unix/sysv/linux/riscv/configure: line 181: test: =: unary operator expected

message produced by the RISC-V configure fragment with the soft-float
ABI selected, caused by $libc_cv_riscv_float_abi evaluating to nil in
the invocation of `test $libc_cv_riscv_float_abi = no'.

	* sysdeps/unix/sysv/linux/riscv/configure.ac: Quote
	$libc_cv_riscv_float_abi in `test' invocation.
	* sysdeps/unix/sysv/linux/riscv/configure: Regenerate.
2019-03-30 01:11:31 +00:00
Paul A. Clarke
10cce66930 [powerpc] Use __builtin_{mffs,mtfsf}
Replace inline asm uses of the "mffs" and "mtfsf" instructions with
the analogous GCC builtins.

__builtin_mffs and __builtin_mtfsf are both available in GCC 5 and above.
Given the minimum GCC level for GLibC is now GCC 6.2, it is safe to use
these builtins without restriction.

2019-03-29  Paul A. Clarke  <pc@us.ibm.com>

	* sysdeps/powerpc/fpu/fenv_libc.h (fegetenv_register): Replace inline
	asm with builtin.
	* sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h (FP_INIT_ROUNDMODE):
	Likewise.
	* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (_GET_DI_FPSCR): Likewise.
	(_GET_SI_FPSCR): Likewise.
	(_SET_SI_FPSCR): Likewise.
2019-03-29 19:16:34 -05:00
Rafal Luzynski
225d94459b ChangeLog: Correct more dates. 2019-03-28 00:58:53 +01:00
Rafal Luzynski
5e67e4bfa0 ChangeLog: Correct two dates.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-03-28 00:24:27 +01:00
Adhemerval Zanella
4997e8f31e math: Enable some math builtins for clang
This patch enable the builtin usage for clang for the C99 functions
fpclassify, isfinite, isnormal, isnan, isinf, and sigbit.  This allows
clang optimize the calls on frontend instead of call the appropriate
glibc symbols.

Checked on aarch64-linux-gnu and x86_64-linux-gnu. I checked the supported
version for each builtin based on released version from clang/llvm.

	* math/math.h (fpclassify, isfinite, isnormal, isnan): Use builtin for
	clang 2.8.
	(signbit): Use builtin for clang 3.3.
	(isinf): Use builtin for clang 3.7.
2019-03-26 08:49:47 -03:00
Adhemerval Zanella
019638910e powerpc: Remove ununsed s_float_bitwise.h
This file is not used anywhere since removal of {k,e}_rem_pio2f.c
(commit ca3aac57ef).

Checked with a build for powerpc-linux-gnu (with --with-cpu=power4
and --with-cpu=power7), powerpc64-linux-gnu (with --with-cpu=power4
and --with-cpu=power7), and powerpc64le-linux (with --with-cpu=power8).

	* sysdeps/powerpc/fpu/s_float_bitwise.h: Remove file.
2019-03-25 15:34:50 -03:00
Andreas K. Hüttel
67112f7ae8 nss/tst-nss-files-alias-leak: add missing opening quote in printf 2019-03-25 12:22:53 -03:00
Mike Crowe
82849fde3b nptl/tst-rwlock14: Test pthread_rwlock_timedwrlock correctly 2019-03-25 10:36:43 -03:00
Mike Crowe
7a773abf7c nptl: Convert tst-sem5 & tst-sem13 to use libsupport
Checked on x86_64-linux-gnu and i686-linux-gnu.

	* nptl/tst-sem5.c: Remove unused headers. Add <support/check.h>.
	(do_test) Use libsupport test macros rather than hand-coded
	conditionals and error messages. Ensure that sem_init returns zero
	rather than not -1. Use <support/test-driver.c> rather than
	test-skeleton.c.

	* nptl/tst-sem13.c: Add <support/check.h>. (do_test) Use libsupport
	test macros rather than hand-coded conditionals and error messages.
	Use <support/test-driver.c> rather than test-skeleton.c.
2019-03-25 10:36:43 -03:00
Joseph Myers
d7563e6277 Add UDP_GRO from Linux 5.0 to netinet/udp.h.
This patch adds the new constant UDP_GRO from Linux 5.0 to glibc.

Tested for x86_64.

	* sysdeps/gnu/netinet/udp.h (UDP_GRO): New macro.
2019-03-25 13:16:46 +00:00
Joseph Myers
9ac2de697e Add NT_ARM_PAC_MASK and NT_MIPS_MSA from Linux 5.0 to elf.h.
This patch adds two new NT_* macros from Linux 5.0 to elf.h.

Tested for x86_64.

	* elf/elf.h (NT_ARM_PAC_MASK): New macro.
	(NT_MIPS_MSA): Likewise.
2019-03-25 13:15:56 +00:00
Wilco Dijkstra
7621e38bf3 Add generic hp-timing support
Add missing generic hp_timing support.  It uses clock_gettime (CLOCK_MONOTONIC)
which has unspecified starting time, nano-second accuracy, and should faster on
architectures that implementes the symbol as vDSO.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked the builds for all afected ABIs.

	* benchtests/Makefile (USE_CLOCK_GETTIME) Remove.
	* benchtests/README: Update description.
	* benchtests/bench-timing.h: Default to hp-timing.
	* sysdeps/generic/hp-timing.h (HP_TIMING_DIFF, HP_TIMING_ACCUM_NT,
	HP_TIMING_PRINT): Remove.
	(HP_TIMING_NOW): Add generic implementation.
	(hp_timing_t): Change to uint64_t.
2019-03-22 17:30:44 -03:00
Adhemerval Zanella
1e372ded4f Refactor hp-timing rtld usage
This patch refactor how hp-timing is used on loader code for statistics
report.  The HP_TIMING_AVAIL and HP_SMALL_TIMING_AVAIL are removed and
HP_TIMING_INLINE is used instead to check for hp-timing avaliability.
For alpha, which only defines HP_SMALL_TIMING_AVAIL, the HP_TIMING_INLINE
is set iff for IS_IN(rtld).

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked the builds for all afected ABIs.

	* benchtests/bench-timing.h: Replace HP_TIMING_AVAIL with
	HP_TIMING_INLINE.
	* nptl/descr.h: Likewise.
	* elf/rtld.c (RLTD_TIMING_DECLARE, RTLD_TIMING_NOW, RTLD_TIMING_DIFF,
	RTLD_TIMING_ACCUM_NT, RTLD_TIMING_SET): Define.
	(dl_start_final_info, _dl_start_final, dl_main, print_statistics):
	Abstract hp-timing usage with RTLD_* macros.
	* sysdeps/alpha/hp-timing.h (HP_TIMING_INLINE): Define iff IS_IN(rtld).
	(HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL): Remove.
	* sysdeps/generic/hp-timing.h (HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL,
	HP_TIMING_NONAVAIL): Likewise.
	* sysdeps/ia64/hp-timing.h (HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL):
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/hp-timing.h (HP_TIMING_AVAIL,
	HP_SMALL_TIMING_AVAIL): Likewise.
	* sysdeps/powerpc/powerpc64/hp-timing.h (HP_TIMING_AVAIL,
	HP_SMALL_TIMING_AVAIL): Likewise.
	* sysdeps/sparc/sparc32/sparcv9/hp-timing.h (HP_TIMING_AVAIL,
	HP_SMALL_TIMING_AVAIL): Likewise.
	* sysdeps/sparc/sparc64/hp-timing.h (HP_TIMING_AVAIL,
	HP_SMALL_TIMING_AVAIL): Likewise.
	* sysdeps/x86/hp-timing.h (HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL):
	Likewise.
	* sysdeps/generic/hp-timing-common.h: Update comment with
	HP_TIMING_AVAIL removal.
2019-03-22 17:30:44 -03:00
Adhemerval Zanella
359653aaac Do not use HP_TIMING_NOW for random bits
This patch removes the HP_TIMING_BITS usage for fast random bits and replace
with clock_gettime (CLOCK_MONOTONIC).  It has unspecified starting time and
nano-second accuracy, so its randomness is significantly better than
gettimeofday.

Althoug it should incur in more overhead (specially for architecture that
support hp-timing), the symbol is also common implemented as a vDSO.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked on a i686-gnu build.

	* include/random-bits.h: New file.
	* resolv/res_mkquery.c [HP_TIMING_AVAIL] (RANDOM_BITS,
	(__res_context_mkquery): Remove usage hp-timing usage and replace with
	random_bits.
	* resolv/res_send.c [HP_TIMING_AVAIL] (nameserver_offset): Likewise.
	* sysdeps/posix/tempname.c [HP_TIMING_AVAIL] (__gen_tempname):
	Likewise.
2019-03-22 17:30:39 -03:00
Adhemerval Zanella
6e8ba7fd57 Remove __get_clockfreq
With clock_getres, clock_gettime, and clock_settime refactor to remove the
generic CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID support through
hp-timing, there is no usage of internal __get_clockfreq.  This patch removes
both generic and Linux implementation..

Checked with a build against aarch64-linux-gnu, i686-linux-gnu, ia64-linux-gnu,
sparc64-linux-gnu, powerpc-linux-gnu-power4.

	* include/libc-internal.h (__get_clockfreq): Remove prototype.
	* rt/Makefile (clock-routines): Remove get_clockfreq.
	* rt/get_clockfreq.c: Remove file.
	* sysdeps/unix/sysv/linux/i386/get_clockfreq.c: Likewise.
	* sysdeps/unix/sysv/linux/ia64/get_clockfreq.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Move code to ...
	* sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c: ... here.
2019-03-22 16:52:29 -03:00
Adhemerval Zanella
77b6f55347 linux: Assume clock_getres CLOCK_{PROCESS,THREAD}_CPUTIME_ID
The Linux 3.2 clock_getres kernel code (kernel/posix-cpu-timers.c)
issued for clock_getres CLOCK_PROCESS_CPUTIME_ID (process_cpu_clock_getres)
and CLOCK_THREAD_CPUTIME_ID (thread_cpu_clock_getres) call
posix_cpu_clock_getres. And it fails on check_clock only if an invalid
clock is used (not the case) or if we pass an invalid the pid/tid in
29 msb of clock_id (not the case either).

This patch assumes that clock_getres syscall always support
CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID, so there is no need
to fallback to hp-timing support for _SC_MONOTONIC_CLOCK neither to issue
the syscall to certify the clock_id is supported bt the kernel.  This
allows simplify the sysconf support to always use the syscall.

it also removes ia64 itc drift check and assume kernel handles it correctly.

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

	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c: Remove file.
	* sysdeps/unix/sysv/linux/ia64/sysconf.c: Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (has_cpuclock): Remove function.
	(__sysconf): Assume kernel support for _SC_MONOTONIC_CLOCK,
	_SC_CPUTIME, and _SC_THREAD_CPUTIME.
2019-03-22 16:52:29 -03:00
Adhemerval Zanella
38cc11daa4 nptl: Remove pthread_clock_gettime pthread_clock_settime
This patch removes CLOCK_THREAD_CPUTIME_ID and CLOCK_PROCESS_CPUTIME_ID support
from clock_gettime and clock_settime generic implementation.  For Linux, kernel
already provides supports through the syscall and Hurd HTL lacks
__pthread_clock_gettime and __pthread_clock_settime internal implementation.

As described in clock_gettime man-page [1] on 'Historical note for SMP
system', implementing CLOCK_{THREAD,PROCESS}_CPUTIME_ID with timer registers
is error-prone and susceptible to timing and accurary issues that the libc
can not deal without kernel support.

This allows removes unused code which, however, still incur in some runtime
overhead in thread creation (the struct pthread cpuclock_offset
initialization).

If hurd eventually wants to support them it should either either implement as
a kernel facility (or something related due its architecture) or in system
specific implementation.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked on a i686-gnu build.

	* nptl/Makefile (libpthread-routines): Remove pthread_clock_gettime and
	pthread_clock_settime.
	* nptl/pthreadP.h (__find_thread_by_id): Remove prototype.
	* elf/dl-support.c [!HP_TIMING_NOAVAIL] (_dl_cpuclock_offset): Remove.
	(_dl_non_dynamic_init): Remove _dl_cpuclock_offset setting.
	* elf/rtld.c (_dl_start_final): Likewise.
	* nptl/allocatestack.c (__find_thread_by_id): Remove function.
	* sysdeps/generic/ldsodefs.h [!HP_TIMING_NOAVAIL] (_dl_cpuclock_offset):
	Remove.
	* sysdeps/mach/hurd/dl-sysdep.c [!HP_TIMING_NOAVAIL]
	(_dl_cpuclock_offset): Remove.
	* nptl/descr.h (struct pthread): Rename cpuclock_offset to
	cpuclock_offset_ununsed.
	* nptl/nptl-init.c (__pthread_initialize_minimal_internal): Remove
	cpuclock_offset set.
	* nptl/pthread_create.c (START_THREAD_DEFN): Likewise.
	* sysdeps/nptl/fork.c (__libc_fork): Likewise.
	* nptl/pthread_clock_gettime.c: Remove file.
	* nptl/pthread_clock_settime.c: Likewise.
	* sysdeps/unix/clock_gettime.c (hp_timing_gettime): Remove function.
	[HP_TIMING_AVAIL] (realtime_gettime): Remove CLOCK_THREAD_CPUTIME_ID
	and CLOCK_PROCESS_CPUTIME_ID support.
	* sysdeps/unix/clock_settime.c (hp_timing_gettime): Likewise.
	[HP_TIMING_AVAIL] (realtime_gettime): Likewise.
	* sysdeps/posix/clock_getres.c (hp_timing_getres): Likewise.
	[HP_TIMING_AVAIL] (__clock_getres): Likewise.
	* sysdeps/unix/clock_nanosleep.c (CPUCLOCK_P, INVALID_CLOCK_P):
	Likewise.
	(__clock_nanosleep): Remove CPUCLOCK_P and INVALID_CLOCK_P usage.

[1] http://man7.org/linux/man-pages/man2/clock_gettime.2.html
2019-03-22 15:37:43 -03:00
Stefan Liebler
421749d693 S390: Add arch13 memmem ifunc variant.
This patch introduces the new arch13 ifunc variant for memmem.
For needles longer than 9 bytes it is relying on the common-code
implementation.  For shorter needles it is using the new vstrs instruction
which is able to search a substring within a vector register.

ChangeLog:

	* sysdeps/s390/Makefile (sysdep_routines): Add memmem-arch13.
	* sysdeps/s390/ifunc-memmem.h (HAVE_MEMMEM_ARCH13, MEMMEM_ARCH13,
	MEMMEM_Z13_ONLY_USED_AS_FALLBACK, HAVE_MEMMEM_IFUNC_AND_ARCH13_SUPPORT):
	New defines.
	* sysdeps/s390/memmem-arch13.S: New file.
	* sysdeps/s390/memmem-vx.c: Omit GI symbol for z13 memmem ifunc variant
	if it is only used as fallback.
	* sysdeps/s390/memmem.c (memmem): Add arch13 variant in ifunc selector.
	* sysdeps/s390/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add ifunc variant for arch13 memmem.
2019-03-22 11:14:09 +01:00
Stefan Liebler
6f47401bd5 S390: Add arch13 strstr ifunc variant.
This patch introduces the new arch13 ifunc variant for strstr.
For needles longer than 9 charachters it is relying on the common-code
implementation.  For shorter needles it is using the new vstrs instruction
which is able to search a substring within a vector register.

ChangeLog:

	* sysdeps/s390/Makefile (sysdep_routines): Add strstr-arch13.
	* sysdeps/s390/ifunc-strstr.h (HAVE_STRSTR_ARCH13, STRSTR_ARCH13,
	STRSTR_Z13_ONLY_USED_AS_FALLBACK, HAVE_STRSTR_IFUNC_AND_ARCH13_SUPPORT):
	New defines.
	* sysdeps/s390/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add ifunc variant for arch13 strstr.
	* sysdeps/s390/strstr-arch13.S: New file.
	* sysdeps/s390/strstr-vx.c: Omit GI symbol for z13 strstr ifunc variant
	if it is only used as fallback.
	* sysdeps/s390/strstr.c (strstr): Add arch13 variant in ifunc selector.
2019-03-22 11:14:08 +01:00
Stefan Liebler
96fbb9a328 S390: Add arch13 memmove ifunc variant.
This patch introduces the new arch13 ifunc variant for memmove.
For the forward or non-overlapping case it is just using memcpy.
For the backward case it relies on the new instruction mvcrl.
The instruction copies up to 256 bytes at once.
In case of an overlap, it copies the bytes like copying them
one by one starting from right to left.

ChangeLog:

	* sysdeps/s390/ifunc-memcpy.h (HAVE_MEMMOVE_ARCH13, MEMMOVE_ARCH13
	HAVE_MEMMOVE_IFUNC_AND_ARCH13_SUPPORT): New defines.
	* sysdeps/s390/memcpy-z900.S: Add arch13 memmove implementation.
	* sysdeps/s390/memmove.c (memmove): Add arch13 variant in
	ifunc selector.
	* sysdeps/s390/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add ifunc variant for arch13 memmove.
	* sysdeps/s390/multiarch/ifunc-resolve.h (S390_STFLE_BITS_ARCH13_MIE3,
	S390_IS_ARCH13_MIE3): New defines.
2019-03-22 11:14:08 +01:00
Stefan Liebler
a899a5512f S390: Add configure check to detect support for arch13.
Add two configure checks which detect if arch13 is supported
by the assembler at all - by explicitely setting the machine -
and if it is supported with default settings.

ChangeLog:

	* config.h.in (HAVE_S390_MIN_ARCH13_ZARCH_ASM_SUPPORT,
	HAVE_S390_ARCH13_ASM_SUPPORT): New undefine.
	* sysdeps/s390/configure.ac: Add checks for arch13 support.
	* sysdeps/s390/configure: Regenerated.
2019-03-22 11:14:08 +01:00
Stefan Liebler
1a7df49c92 S390: Add new hwcap values for new cpu architecture arch13.
The new hwcap values indicate support for:
-"Vector-Enhancements Facility 2" (tag "vxe2", hwcap 2^15)
-"Vector-Packed-Decimal-Enhancement Facility" (tag "vxp", hwcap 2^16)
-"Enhanced-Sort Facility" (tag "sort", hwcap 2^17)
-"Deflate-Conversion Facility" (tag "dflt", hwcap 2^18)

The vxe2 hwcap is also marked as important hwcap.

ChangeLog:

	* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags):
	Add vxe2, vxp, dflt, sort flags.
	* sysdeps/s390/dl-procinfo.h: Add HWCAP_S390_VXRS_EXT2,
	HWCAP_S390_VXRS_PDE, HWCAP_S390_SORT, HWCAP_S390_DFLT
	capabilities.
	(HWCAP_IMPORTANT): Add HWCAP_S390_VXRS_EXT2.
	* sysdeps/unix/sysv/linux/s390/bits/hwcap.h
	(HWCAP_S390_VXRS_EXT2, HWCAP_S390_VXRS_PDE, HWCAP_S390_SORT,
	HWCAP_S390_DFLT): Define.
2019-03-22 11:14:07 +01:00
Gabriel F. T. Gomes
5abcddd794 Fix parentheses error in iconvconfig.c and ld-collate.c [BZ #24372]
When -Werror=parentheses is in use, iconvconfig.c builds fail with:

  iconvconfig.c: In function ‘write_output’:
  iconvconfig.c:1084:34: error: suggest parentheses around ‘+’ inside ‘>>’ [-Werror=parentheses]
     hash_size = next_prime (nnames + nnames >> 1);
                             ~~~~~~~^~~~~~~~

This patch adds parentheses to the expression.  Not where suggested by
the compiler warning, but where it produces the expected result, i.e.:
where it has the effect of multiplying nnames by 1.5.

Likewise for elem_size in ld-collate.c.

Tested for powerpc64le.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-03-21 17:53:03 -03:00
DJ Delorie
ac64195ccd iconv, localedef: avoid floating point rounding differences [BZ #24372]
Two cases of "int * 1.4" may result in imprecise results, which
in at least one case resulted in i686 and x86-64 producing
different locale files.  This replaced that floating point multiply
with integer operations.  While the hash table margin is increased
from 40% to 50%, testing shows only 2% increase in overall size
of the locale archive.

https://bugzilla.redhat.com/show_bug.cgi?id=1311954

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-03-21 13:47:14 -04:00
Stefan Liebler
61f5e9470f S390: Mark vx and vxe as important hwcap.
This patch adds vx and vxe as important hwcaps
which allows one to provide shared libraries
tuned for platforms with non-vx/-vxe, vx or vxe.

ChangeLog:

	* sysdeps/s390/dl-procinfo.h (HWCAP_IMPORTANT):
	Add HWCAP_S390_VX and HWCAP_S390_VXE.
2019-03-21 09:14:26 +01:00
mansayk
57ada43c90 tt_RU: Fix orthographic mistakes in day and abday sections [BZ #24296]
This commit fixes some errors and converts all weekday names to lowercase.
The content is synchronized with CLDR-34 now, but trailing dots are removed
from abday values in order to maintain consistency with the previous values
and with many other locales which do the same.

	[BZ #24296]
	* localedata/locales/tt_RU (day): Update from CLDR-34, fix errors.
	(abday): Likewise, but remove the trailing dots.
2019-03-20 22:00:00 +01:00
Joseph Myers
a2e57f89a3 Add AArch64 HWCAPs from Linux 5.0.
This patch adds new AArch64 HWCAPs from Linux 5.0 to the AArch64
bits/hwcap.h and dl-procinfo.c.

Tested (compilation only) with build-many-glibcs.py for
aarch64-linux-gnu.

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_SB): New
	macro.
	(HWCAP_PACA): Likewise.
	(HWCAP_PACG): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c (_DL_HWCAP_COUNT):
	Increase to 32.
	(_dl_aarch64_cap_flags): Add new entries for new HWCAPs.
2019-03-19 14:02:17 +00:00
Aurelien Jarno
b626c5aa5d Record CVE-2019-9169 in NEWS and ChangeLog [BZ #24114] 2019-03-16 23:00:42 +01:00
Samuel Thibault
e87d8ada29 hurd: Document how EINTR should be handled in critical sections
* hurd/hurd/signal.h (_hurd_critical_section_lock): Document how EINTR
	should be handled.
2019-03-16 19:42:59 +01:00
Joseph Myers
477e739b32 Update syscall-names.list for Linux 5.0.
This patch updates sysdeps/unix/sysv/linux/syscall-names.list for
Linux 5.0.  Based on testing with build-many-glibcs.py, the only new
entry needed is for old_getpagesize (a newly added __NR_* name for an
old syscall on ia64).  (Because 5.0 changes how syscall tables are
handled in the kernel, checking diffs wasn't a useful way of looking
for new syscalls in 5.0 as most of the syscall tables were moved to
the new representation without actually adding any syscalls to them.)

Tested with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
	version to 5.0.
	(old_getpagesize): New syscall.
2019-03-15 18:18:40 +00:00
Felix Yan
238d60a1fb localedata: Add Minguo calendar support to Taiwanese locales [BZ #24293]
Minguo calendar is the official calendar system, and very widely used in
Taiwan. This commit adds its support into glibc.

Some background information: The government website (www.gov.tw) uses it,
popular public services like Taiwan HSR also use this calendar system.

Link to Wikipedia: https://en.wikipedia.org/wiki/Minguo_calendar

        [BZ #24293]
        * localedata/locales/zh_TW (era): Add, support Minguo calendar.
        * localedata/locales/cmn_TW (era): Likewise.
        * localedata/locales/hak_TW (era): Likewise.
        * localedata/locales/lzh_TW (era): Likewise.
        * localedata/locales/nan_TW (era): Likewise.
2019-03-15 10:08:37 +01:00
Florian Weimer
a0a0dc8317 Remove obsolete, never-implemented XSI STREAMS declarations
The stub implementations are turned into compat symbols.

Linux actually has two reserved system call numbers (for getpmsg
and putpmsg), but these system calls have never been implemented,
and there are no plans to implement them, so this patch replaces
the wrappers with the generic stubs.

According to <https://bugzilla.redhat.com/show_bug.cgi?id=436349>,
the presence of the XSI STREAMS declarations is a minor portability
hazard because they are not actually implemented.

This commit does not change the TIRPC support code in
sunrpc/rpc_svcout.c.  It uses additional XTI functionality and
therefore never worked with glibc.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-03-14 15:44:15 +01:00
Florian Weimer
081bdf9421 nss: Fix tst-nss-files-alias-truncated for default --as-needed linking
Linking to the NSS module directly does not work if the linker defaults
to --as-needed because it will remove the apparently unused DSO
reference and not generate a DT_NEEDED entry.  Use an explicit dlopen
call, like in the other chroot tests involving NSS modules.
2019-03-14 15:38:00 +01:00
Zack Weinberg
97f8225d22 scripts/check-obsolete-constructs.py: Process all headers as UTF-8.
A few of our installed headers contain UTF-8 in comments.
check-obsolete-constructs opened files without explicitly specifying
their encoding, so it would barf on these headers if “make check” was
run in a non-UTF-8 locale.

	* scripts/check-obsolete-constructs.py (HeaderChecker.check):
	Specify encoding="utf-8" when opening headers to check.
2019-03-14 09:44:22 -04:00
Joseph Myers
0c1041ee5b Use Linux 5.0 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.0 in place of 4.20
(now that the test change required to avoid false positives with ulong
in kernel headers has been committed).  This includes adjusting the
logic to compute a tarball URL to handle different major version
numbers (rather than changing the path to hardcode v5.x in place of
v4.x, as someone might still wish to check out a v4.x version).

Tested that build-many-glibcs.py successfully checks out Linux 5.0
sources after this patch.

	* scripts/build-many-glibcs.py (Context.checkout): Default Linux
	version to 5.0.
	(Context.checkout_tar): Handle variable major version for Linux
	kernel.
2019-03-13 22:03:37 +00:00
Florian Weimer
043440e761 hurd: Add no-op version of __res_enable_icmp [BZ #24047]
Mach does not support IP_RECVERR, so replace this function with a
stub in a sysdeps override for Hurd.

This fixes commit 08504de718
("resolv: Enable full ICMP errors for UDP DNS sockets [BZ #24047]").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-03-13 14:58:58 +01:00
Zack Weinberg
29218b265f
Move inttypes.h and stdint.h to stdlib.
inttypes.h and stdint.h are in sysdeps/generic, but there are no other
versions of these headers anywhere in the source tree, so they aren’t
actually system-dependent.  Move them to the subdirectory that
installs them (stdlib).

Reviewed-by: Joseph Myers <joseph@codesourcery.com>

	* sysdeps/generic/inttypes.h, sysdeps/generic/stdint.h:
	Move to stdlib.
	* include/inttypes.h: Adjust to match.
	* include/stdint.h: New wrapper.
2019-03-13 09:42:09 -04:00
Zack Weinberg
711a322a23
Use a proper C tokenizer to implement the obsolete typedefs test.
The test for obsolete typedefs in installed headers was implemented
using grep, and could therefore get false positives on e.g. “ulong”
in a comment.  It was also scanning all of the headers included by
our headers, and therefore testing headers we don’t control, e.g.
Linux kernel headers.

This patch splits the obsolete-typedef test from
scripts/check-installed-headers.sh to a separate program,
scripts/check-obsolete-constructs.py.  Being implemented in Python,
it is feasible to make it tokenize C accurately enough to avoid false
positives on the contents of comments and strings.  It also only
examines $(headers) in each subdirectory--all the headers we install,
but not any external dependencies of those headers.  Headers whose
installed name starts with finclude/ are ignored, on the assumption
that they contain Fortran.

It is also feasible to make the new test understand the difference
between _defining_ the obsolete typedefs and _using_ the obsolete
typedefs, which means posix/{bits,sys}/types.h no longer need to be
exempted.  This uncovered an actual bug in bits/types.h: __quad_t and
__u_quad_t were being used to define __S64_TYPE, __U64_TYPE,
__SQUAD_TYPE and __UQUAD_TYPE.  These are changed to __int64_t and
__uint64_t respectively.  This is a safe change, despite the comments
in bits/types.h claiming a difference between __quad_t and __int64_t,
because those comments are incorrect.  In all current ABIs, both
__quad_t and __int64_t are ‘long’ when ‘long’ is a 64-bit type, and
‘long long’ when ‘long’ is a 32-bit type, and similarly for __u_quad_t
and __uint64_t.  (Changing the types to be what the comments say they
are would be an ABI break, as it affects C++ name mangling.)  This
patch includes a minimal change to make the comments not completely
wrong.

sys/types.h was defining the legacy BSD u_intN_t typedefs using a
construct that was not necessarily consistent with how the C99 uintN_t
typedefs are defined, and is also too complicated for the new script to
understand (it lexes C relatively accurately, but it does not attempt
to expand preprocessor macros, nor does it do any actual parsing).
This patch cuts all of that out and uses bits/types.h's __uintN_t typedefs
to define u_intN_t instead.  This is verified to not change the ABI on
any supported architecture, via the c++-types test, which means u_intN_t
and uintN_t were, in fact, consistent on all supported architectures.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* scripts/check-obsolete-constructs.py: New test script.
	* scripts/check-installed-headers.sh: Remove tests for
	obsolete typedefs, superseded by check-obsolete-constructs.py.
	* Rules: Run scripts/check-obsolete-constructs.py over $(headers)
	as a special test.  Update commentary.
	* posix/bits/types.h (__SQUAD_TYPE, __S64_TYPE): Define as __int64_t.
	(__UQUAD_TYPE, __U64_TYPE): Define as __uint64_t.
	Update commentary.
	* posix/sys/types.h (__u_intN_t): Remove.
	(u_int8_t): Typedef using __uint8_t.
	(u_int16_t): Typedef using __uint16_t.
	(u_int32_t): Typedef using __uint32_t.
	(u_int64_t): Typedef using __uint64_t.
2019-03-13 09:39:43 -04:00
Stefan Liebler
7c6513082b Fix output of LD_SHOW_AUXV=1.
Starting with commit 1616d034b6
the output was corrupted on some platforms as _dl_procinfo
was called for every auxv entry and on some architectures like s390
all entries were represented as "AT_HWCAP".

This patch is removing the condition and let _dl_procinfo decide if
an entry is printed in a platform specific or generic way.
This patch also adjusts all _dl_procinfo implementations which assumed
that they are only called for AT_HWCAP or AT_HWCAP2. They are now just
returning a non-zero-value for entries which are not handled platform
specifc.

ChangeLog:

	* elf/dl-sysdep.c (_dl_show_auxv): Remove condition and always
	call _dl_procinfo.
	* sysdeps/unix/sysv/linux/s390/dl-procinfo.h (_dl_procinfo):
	Ignore types other than AT_HWCAP.
	* sysdeps/sparc/dl-procinfo.h (_dl_procinfo): Likewise.
	* sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_procinfo):
	Likewise.
	* sysdeps/powerpc/dl-procinfo.h (_dl_procinfo): Adjust comment
	in the case of falling back to generic output mechanism.
	* sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_dl_procinfo):
	Likewise.
2019-03-13 10:45:35 +01:00
Florian Weimer
38b52865d4 elf: Add DF_1_KMOD, DF_1_WEAKFILTER, DF_1_NOCOMMON to <elf.h>
These constants (originally from Solaris) were part of the binutils
2.31 release.
2019-03-12 12:06:01 +01:00
Florian Weimer
08504de718 resolv: Enable full ICMP errors for UDP DNS sockets [BZ #24047]
The Linux kernel suppresses some ICMP error messages by default for
UDP sockets.  This commit enables full ICMP error reporting,
hopefully resulting in faster failover to working name servers.
2019-03-12 11:40:47 +01:00
Mao Han
5fbcd76351 C-SKY: add elf header definition for elfutils
This patch adds some defines relate to machine flag and section information,
which is used by elfutils elflint check. A C-SKY typo is also fixed with
this patch.

	* elf/elf.h (EF_CSKY_ABIMASK, EF_CSKY_OTHER, EF_CSKY_PROCESSOR)
	(EF_CSKY_ABIV1, EF_CSKY_ABIV2, SHT_CSKY_ATTRIBUTES): New defines.
2019-03-11 09:54:34 +08:00
Mao Han
c4e5f34bf0 C-SKY: mark lr as undefined to stop unwinding
Mark the lr register as undefined at the start of execution, so unwind
will stop at this frame. run-backtrace-*.sh from elfutils testsuite will
fail without this patch.

	* sysdeps/csky/abiv2/start.S: Mark lr as undefined.
	* sysdeps/unix/sysv/linux/csky/abiv2/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S: Likewise.
2019-03-11 09:51:14 +08:00
Mao Han
827e30f3a3 C-SKY: remove user_regs definition
C-SKY GDB dose not use this file for ptrace and coredump.  ptrace can use
pt_regs definition from linux kernel directly.  The old definition only
got 34 regs instead of 38 regs from linux kernel, which will corrupted
the memory after ptrace PTRACE_GETREGSET call.

	* sysdeps/unix/sysv/linux/csky/sys/procfs.h: Use linux definition
	directly.
	* sysdeps/unix/sysv/linux/csky/sys/user.h: Remove user_regs
	definition.
2019-03-11 09:48:51 +08:00
Mao Han
6229c9bff7 C-SKY: fix sigcontext miss match
C-SKY defines SIGCONTEXT as siginfo_t *_si, struct ucontext_t * for
__profil_counter.  ucontext_t get an extra __mask field which is miss
match with the struct sigcontext from linux kernel.  The time value
from gprof report will be always zero without this patch.  This
patch also fix the registers sequence in register-dump.h.

	* sysdeps/unix/sysv/linux/csky/register-dump.h: Adjust offset change.
	* sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Remove __mask field
	in mcontext_t
2019-03-11 09:45:15 +08:00
Mike FABIAN
86bdd49d93 Bug 24307: Update to Unicode 12.0.0
Unicode 12.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 12.0.0, using
the generator scripts contributed by Mike FABIAN (Red Hat).

Some info about the number of characters added or changed:

Total added characters in newly generated CHARMAP: 554
Total added characters in newly generated WIDTH: 106
alpha: Missing 8 characters of old ctype in new ctype
       (These are combining marks, apparently they were removed from alpha
       on purpose)
alpha: Added 295 characters in new ctype which were not in old ctype
combining: Missing 2 characters of old ctype in new ctype
       (U+1CF2 VEDIC SIGN ARDHAVISARGA and U+1CF3 VEDIC SIGN ROTATED ARDHAVISARGA,
       these are now "Alphabetic" in Unicode 12.0.0)
combining: Added 37 characters in new ctype which were not in old ctype
combining_level3: Missing 2 characters of old ctype in new ctype
       (U+1CF2 VEDIC SIGN ARDHAVISARGA and U+1CF3 VEDIC SIGN ROTATED ARDHAVISARGA,
       these are now "Alphabetic" in Unicode 12.0.0)
combining_level3: Added 26 characters in new ctype which were not in old ctype
graph: Added 554 characters in new ctype which were not in old ctype
lower: Added 6 characters in new ctype which were not in old ctype
print: Added 554 characters in new ctype which were not in old ctype
punct: Missing 29 characters of old ctype in new ctype
       (These characters have all  become "Alphabetic" in Unicode 12.0.0.
       Therefore, they are not in "punct" anymore (see: is_punct() in unicode_utils.py))
punct: Added 296 characters in new ctype which were not in old ctype
tolower: Added 7 characters in new ctype which were not in old ctype
totitle: Added 7 characters in new ctype which were not in old ctype
toupper: Added 7 characters in new ctype which were not in old ctype
upper: Added 7 characters in new ctype which were not in old ctype

	[BZ #24307]
	* localedata/unicode-gen/Makefile (UNICODE_VERSION): Set to 12.0.0.
	* localedata/unicode-gen/DerivedCoreProperties.txt: Update to Unicode 12.0.0.
	* localedata/unicode-gen/EastAsianWidth.txt: Likewise.
	* localedata/unicode-gen/PropList.txt: Likewise.
	* localedata/unicode-gen/UnicodeData.txt: Likewise.
	* localedata/unicode-gen/ctype_compatibility_test_cases.py: U+108D became
        "Alphabetic" in Unicode 12.0.0. Adapt test case.
	* localedata/charmaps/UTF-8: Regenerate.
	* localedata/locales/i18n_ctype: Likewise.
	* localedata/locales/tr_TR: Likewise.
	* localedata/locales/translit_circle: Likewise.
	* localedata/locales/translit_cjk_compat: Likewise.
	* localedata/locales/translit_combining: Likewise.
	* localedata/locales/translit_compat: Likewise.
	* localedata/locales/translit_font: Likewise.
	* localedata/locales/translit_fraction: Likewise.
2019-03-08 12:20:35 +01:00
Joseph Myers
c5f65462a2 Break lines before not after operators, batch 4.
This patch fixes further coding style issues where code should have
broken lines before operators in accordance with the GNU Coding
Standards but instead was breaking lines after them.

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

	* stdio-common/vfscanf-internal.c (ARG): Break lines before rather
	than after operators.
	* sysdeps/mach/hurd/setitimer.c (timer_thread): Likewise.
	(setitimer_locked): Likewise.
	* sysdeps/mach/hurd/sigaction.c (__sigaction): Likewise.
	* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
	* sysdeps/mach/pagecopy.h (PAGE_COPY_FWD): Likewise.
	* sysdeps/mach/thread_state.h (machine_get_basic_state): Likewise.
	* sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c
	(PPC_CPU_SUPPORTED): Likewise.
	* sysdeps/unix/sysv/linux/alpha/a.out.h (N_TXTOFF): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
	(stat_overflow): Likewise.
	(statfs_overflow): Likewise.
	* sysdeps/unix/sysv/linux/tst-personality.c (do_test): Likewise.
	* sysdeps/unix/sysv/linux/tst-ttyname.c (eq_ttyname): Likewise.
	(eq_ttyname_r): Likewise.
	(run_chroot_tests): Likewise.
2019-03-07 20:20:25 +00:00
Florian Weimer
27a2f2f34c check-wrapper-headers test: Adjust Fortran include file directory
The check for "/finclude/" fails with the actual location of
Fortran headers because they are now stored in the "finclude"
subdirectory of the top-level include directory, so a relative path
does not contain a slash '/' before the "finclude" string.
2019-03-07 17:28:13 +01:00
marxin
ae51497134 Fix location where math-vector-fortran.h is installed.
2019-03-07  Martin Liska  <mliska@suse.cz>

	* math/Makefile: Change location where math-vector-fortran.h is
	installed.
	* math/finclude/math-vector-fortran.h: Move from bits/math-vector-fortran.h.
	* sysdeps/x86/fpu/finclude/math-vector-fortran.h: Move
	from sysdeps/x86/fpu/bits/math-vector-fortran.h.
	* scripts/check-installed-headers.sh: Skip Fortran header files.
	* scripts/check-wrapper-headers.py: Likewise.
2019-03-07 09:40:24 +01:00
Adhemerval Zanella
0ddb7ea842 nptl: Assume __ASSUME_FUTEX_CLOCK_REALTIME support
This patch assumes realtime clock support for nptl and thus removes
all the associated code.

For __pthread_mutex_timedlock the fallback usage for the case where
lll_futex_timed_wait_bitset it not set define is also removed. The
generic lowlevellock-futex.h always define it, so for NPTL code the
check always yield true.

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

	* nptl/nptl-init.c (__have_futex_clock_realtime,
	__have_futex_clock_realtime): Remove definition.
	(__pthread_initialize_minimal_internal): Remove FUTEX_CLOCK_REALTIME
	check test for !__ASSUME_FUTEX_CLOCK_REALTIME.
	* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Assume
	__ASSUME_FUTEX_CLOCK_REALTIME support.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_FUTEX_CLOCK_REALTIME): Remove.
	* sysdeps/nptl/lowlevellock-futex.h (lll_futex_timed_wait_bitset):
	Adjust comment.
2019-03-05 16:28:20 -03:00
Gabriel F. T. Gomes
590675c079 powerpc: Fix build of wcscpy with --disable-multi-arch
Since the commit

commit 81a1443941
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Feb 5 17:35:12 2019 -0200

    wcsmbs: optimize wcscat

powerpc64 and powerpc64le builds fail when configured with
--disable-multi-arch and --with-cpu=power6 (or newer), due to an
undefined reference to __GI___wcscpy.  This patch fixes this on
sysdeps/powerpc/powerpc64/power6/wcscpy.c, which is only used when
multi-arch is disabled.

This patch does nothing for the failures on 32-bits powerpc builds,
because the file is under the powerpc64 subdirectory, however, powerpc
builds were already failing with --disable-multi-arch, with multiple
error messages, even before the aforementioned commit.

Tested for powerpc, powerpc64, and powerpc64le with multi-arch enabled
(all pass) and disabled (powerpc still fails as explained above).
2019-03-05 11:33:19 -03:00
Florian Weimer
de71ee7b3c elf: Remove remnants of MAP_ANON emulation
Most of the code was removed in commit
20739e5454 ("* elf/dl-load.c:
Remove support for systems without MAP_ANON.").
2019-03-04 17:54:14 +01:00
Stefan Liebler
ce6ddae036 S390: Increase function alignment to 16 bytes.
Set the default function alignment to 16 bytes in order to
get rid of some unwanted performance effects.

Please see also GCC commit "S/390: Set default function
alignment to 16." (Subversion revision 262817)

ChangeLog:

	* sysdeps/s390/s390-64/sysdep.h(ENTRY): Use alignment of 16byte.
	* sysdeps/s390/s390-32/sysdep.h: Likewise.
2019-03-04 10:48:42 +01:00
TAMUKI Shoichi
31effacee2 ja_JP: Change the offset for Taisho gan-nen from 2 to 1 [BZ #24162]
The offset in era-string format for Taisho gan-nen (1912) is currently
defined as 2, but it should be 1.  So fix it.  "Gan-nen" means the 1st
(origin) year, Taisho started on July 30, 1912.

Reported-by: Morimitsu, Junji <junji.morimitsu@hpe.com>
Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com>

ChangeLog:

	[BZ #24162]
	* localedata/locales/ja_JP (LC_TIME): Change the offset for Taisho
	gan-nen from 2 to 1.  Problem reported by Morimitsu, Junji.
2019-03-02 21:00:28 +09:00
Gabriel F. T. Gomes
f0eaf86276 ldbl-opt: Reuse test cases from misc/ that check long double
This patch adds test cases for the compatibility versions of the
functions: err, errx, verr, verrx, warn, warnx, vwarn, vwarnx (from
err.h), error, and error_at_line (from error.h), when long double has
the same format as double (-mlong-double-64).

Tested for powerpc, powerpc64 and powerpc64le.
2019-03-01 15:32:49 -03:00
Gabriel F. T. Gomes
d11086a939 ldbl-opt: Add error and error_at_line (bug 23984)
On platforms where long double may have the same format as double
(-mlong-double-64), error and error_at_line do not take that into
account and might produce wrong output if a long double conversion is
requested by the format string ('%Lf').  This patch adds compatibility
functions for this situation and redirects calls via header magic.

Tested for powerpc, powerpc64 and powerpc64le.
2019-03-01 15:26:36 -03:00
Gabriel F. T. Gomes
90188e7d1a ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984)
When support for long double format with 128-bits (-mlong-double-128)
was added for platforms where long double had the same format as double,
such as powerpc, compatibility versions for the functions listed in the
commit title were missed.  Since the older format of long double can
still be used (with -mlong-double-64), using these functions with a
format string that requests the printing of long double variables will
produce wrong outputs.

This patch adds the missing compatibility functions and header magic to
redirect calls to them when -mlong-double-64 is in use.

Tested for powerpc, powerpc64 and powerpc64le.
2019-03-01 15:24:51 -03:00
Gabriel F. T. Gomes
ea2d89d01c ldbl-opt: Reuse argp tests that print long double
The test case tst-ldbl-argp checks that the conversion specifier '%Lf'
correctly prints long double values with the default long double format
for a platform.  This patch reuses the test case for long double with
the same format as double (-mlong-double-64).

Tested for powerpc, powerpc64 and powerpc64le.
2019-03-01 15:23:16 -03:00
Gabriel F. T. Gomes
6e1f6440b9 ldbl-opt: Add argp_error and argp_failure (bug 23983)
The functions argp_error and argp_failure are missing support for
printing long double values when long double has the same format as
double.  This patch adds the new functions __nldbl_argp_error and
__nldbl_argp_failure, as well as header magic to redirect calls to them
when -mlong-double-64 is in use.

Tested for powerpc, powerpc64 and powerpc64le.
2019-03-01 15:21:32 -03:00
Florian Weimer
c259196b50 elf/tst-big-note: Improve accuracy of test [BZ #20419]
It is possible that the link editor injects an allocated ABI tag note
before the artificial, allocated large note in the test.  Note parsing
in open_verify stops when the first ABI tag note is encountered, so if
the ABI tag note comes first, the problematic code is not actually
exercised.

Also tweak the artificial note so that it is a syntactically valid
4-byte aligned note, in case the link editor tries to parse notes and
process them.

Improves the testing part of commit 0065aaaaae.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-03-01 18:53:42 +01:00
Stefan Liebler
928b305d3f S390: Fix introduction of __wcscpy and weak wcscpy symbols.
The recent commit 81a1443941
has introduced __wcscpy, __GI___wcscpy and the weak alias wcscpy.
This patch also introduces those symbols if glibc is build
with CFLAGS="-march=z13" where the ifunc is omitted.

ChangeLog:

	* sysdeps/s390/wcscpy-vx.S: Add strong aliases to
	__wcscpy, __GI___wcscpy and weak alias to wcscpy.
2019-03-01 16:30:30 +01:00
Florian Weimer
36f30c104f __netlink_assert_response: Add more __libc_fatal newlines [BZ #20271]
Commit a6e8926f8d ("[BZ #20271] Add
newlines in __libc_fatal calls.") missed two places that need
changing.
2019-03-01 12:21:53 +01:00
Joseph Myers
462e83a4a0 Add more spaces before '('.
This patch fixes more places where a space should have been present
before '(' in accordance with the GNU Coding Standards (as with the
previous patch, mainly for calls to sizeof).

Tested with build-many-glibcs.py.

	* sysdeps/powerpc/powerpc32/dl-machine.c
	(__elf_machine_fixup_plt): Use space before '('.
	(__process_machine_rela): Likewise.
	* sysdeps/powerpc/powerpc32/register-dump.h (register_dump):
	Likewise.
	* sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h (TI_BITS):
	Likewise.
	* sysdeps/powerpc/powerpc64/register-dump.h (register_dump):
	Likewise.
	* sysdeps/powerpc/test-arith.c (union_t): Likewise.
	(pattern): Likewise.
	(delta): Likewise.
	(check_result): Likewise.
	(check_excepts): Likewise.
	(check_op): Likewise.
	(fail_xr): Likewise.
	* sysdeps/unix/alpha/sysdep.h (syscall_promote): Likewise.
	* sysdeps/unix/sysv/linux/alpha/a.out.h (AOUTHSZ): Likewise.
	(SCNHSZ): Likewise.
	* sysdeps/unix/sysv/linux/hppa/makecontext.c (FRAME_SIZE_BYTES):
	Likewise.
	(ARGS): Likewise.
	(__makecontext): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (ucontext_t):
	Likewise.
2019-02-28 15:02:09 +00:00
Florian Weimer
cc3e573ce3 elf: Add tests with a local IFUNC resolver [BZ #23937]
The existing tests all use global symbols (but with different
visibility).  Local symbols could be treated differently by the
compiler and linker (as was the case on POWER ELFv2, causing
bug 23937), and we did not have test coverage for this.

Tested on x86-64 and POWER ELFv2 little-endian, with and without
--disable-multi-arch.  On POWER, the test cases elf/ifuncmain9,
elf/ifuncmain9pic, elf/ifuncmain9pie reproduce bug 23937 with older
binutils.
2019-02-28 11:52:44 +01:00
H.J. Lu
92ad88fe72 elf/Makefile: Run IFUNC tests if binutils supports IFUNC
We should run IFUNC tests with --disable-multi-arch if the toolchain
supports IFUNCs.  For correctness, --disable-multi-arch must not
remove IFUNC support from the loader.

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

	* configure.ac (have-ifunc): New LIBC_CONFIG_VAR.
	* configure: Regenerated.
	* elf/Makefile: Run IFUNC tests if binutils supports IFUNC.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2019-02-27 13:21:55 -08:00
Adhemerval Zanella
6bd4d02ee9 powerpc: Fix linknamespace introduced by 4d8015639a
This patch fixes the linknamespace issues add on wcscpy refactor
for powerpc-linux-gnu-power4 as shown by the tests:

FAIL: conform/POSIX/fnmatch.h/linknamespace
FAIL: conform/POSIX/glob.h/linknamespace
FAIL: conform/POSIX/wordexp.h/linknamespace
FAIL: conform/XPG4/fnmatch.h/linknamespace
FAIL: conform/XPG4/glob.h/linknamespace
FAIL: conform/XPG4/wordexp.h/linknamespace
FAIL: conform/XPG42/fnmatch.h/linknamespace
FAIL: conform/XPG42/glob.h/linknamespace
FAIL: conform/XPG42/wordexp.h/linknamespace

[initial] wordexp -> [libc.a(wordexp.o)] fnmatch -> [libc.a(fnmatch.o)] __wcscat -> [libc.a(wcscat.o)] __wcscpy -> [libc.a(wcscpy.o)] wcscpy

Checked on powerpc-linux-gnu-power4.

	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c: Define ifunc
	symbol as __wcspcy instead of wcscpy.
2019-02-27 15:56:58 -03:00
Samuel Thibault
1b21841775 hurd: Add renameat2 support for RENAME_NOREPLACE
* include/stdio.h (__renameat2): New hidden prototype.
	* stdio-common/renameat2.c (__renameat2): Add hidden definition.
	* sysdeps/mach/hurd/renameat.c (__renameat): Move implementation to...
	* sysdeps/mach/hurd/renameat2.c (__renameat2): ... new function, and
	add support for RENAME_NOREPLACE.
	* sysdeps/unix/sysv/linux/renameat2.c (__renameat2): Add hidden definition.
2019-02-27 09:42:44 -08:00
Joseph Myers
f627dd4da8 Fix -Wempty-body warnings in Hurd-specific code.
This patch fixes -Wempty-body warnings in Hurd-specific code that show
up building glibc with -Wextra.

Note: there also such warnings on many platforms arising from the
default definition of HP_TIMING_NOW in sysdeps/generic/hp-timing.h,
but no change there is proposed in this patch because of other changes
under discussion in that area that would result in a nonempty
definition.

Tested with build-many-glibcs.py.

	* hurd/hurdinit.c (_hurd_init): Use braces around empty body of an
	if statement.
2019-02-27 13:58:56 +00:00
Joseph Myers
c4f50205e1 Add some spaces before '('.
This patch fixes various places where a space should have been present
before '(' in accordance with the GNU Coding Standards.  Most but not
all of the fixes in this patch are for calls to sizeof (but it's not
exhaustive regarding such calls that should be fixed).

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

	* benchtests/bench-strcpy.c (do_test): Use space before '('.
	* benchtests/bench-string.h (cmdline_process_function): Likewise.
	* benchtests/bench-strlen.c (do_test): Likewise.
	(test_main): Likewise.
	* catgets/gencat.c (read_old): Likewise.
	* elf/cache.c (load_aux_cache): Likewise.
	* iconvdata/bug-iconv8.c (do_test): Likewise.
	* math/test-tgmath-ret.c (do_test): Likewise.
	* nis/nis_call.c (rec_dirsearch): Likewise.
	* nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise.
	* nptl/tst-audit-threads.c (do_test): Likewise.
	* nptl/tst-cancel4-common.h (set_socket_buffer): Likewise.
	* nss/nss_test1.c (init): Likewise.
	* nss/test-netdb.c (test_hosts): Likewise.
	* posix/execvpe.c (maybe_script_execute): Likewise.
	* stdio-common/tst-fmemopen4.c (do_test): Likewise.
	* stdio-common/tst-printf.c (do_test): Likewise.
	* stdio-common/vfscanf-internal.c (__vfscanf_internal): Likewise.
	* stdlib/fmtmsg.c (NKEYWORDS): Likewise.
	* stdlib/qsort.c (STACK_SIZE): Likewise.
	* stdlib/test-canon.c (do_test): Likewise.
	* stdlib/tst-swapcontext1.c (do_test): Likewise.
	* string/memcmp.c (OPSIZ): Likewise.
	* string/test-strcpy.c (do_test): Likewise.
	(do_random_tests): Likewise.
	* string/test-strlen.c (do_test): Likewise.
	(test_main): Likewise.
	* string/test-strrchr.c (do_test): Likewise.
	(do_random_tests): Likewise.
	* string/tester.c (test_memrchr): Likewise.
	(test_memchr): Likewise.
	* sysdeps/generic/memcopy.h (OPSIZ): Likewise.
	* sysdeps/generic/unwind-dw2.c (execute_stack_op): Likewise.
	* sysdeps/generic/unwind-pe.h (read_sleb128): Likewise.
	(read_encoded_value_with_base): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_runtime_setup): Likewise.
	* sysdeps/hppa/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/ia64/fpu/sfp-machine.h (TI_BITS): Likewise.
	* sysdeps/mach/hurd/spawni.c (__spawni): Likewise.
	* sysdeps/posix/spawni.c (maybe_script_execute): Likewise.
	* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (query_auxv):
	Likewise.
	* sysdeps/unix/sysv/linux/aarch64/bits/procfs.h (ELF_NGREG):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/bits/procfs.h (ELF_NGREG): Likewise.
	* sysdeps/unix/sysv/linux/arm/ioperm.c (init_iosys): Likewise.
	* sysdeps/unix/sysv/linux/csky/bits/procfs.h (ELF_NGREG):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/procfs.h (ELF_NGREG):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/bits/procfs.h (ELF_NGREG):
	Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute):
	Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/procfs.h (ELF_NGREG): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
	(FP_XSTATE_MAGIC2_SIZE): Likewise.
	* sysdeps/x86/fpu/sfp-machine.h (TI_BITS): Likewise.
	* time/test_time.c (main): Likewise.
2019-02-27 13:55:45 +00:00
Adhemerval Zanella
457208b1e9 wcsmbs: optimize wcsnlen
This patch rewrites wcsnlen using wmemchr.  The generic wmemchr
already uses the strategy (loop unrolling and tail handling) and
by using it it allows architectures that have optimized wmemchr
(s390 and x86_64) to optimize wcsnlen as well.

Checked on x86_64-linux-gnu.

	* wcsmbs/wcsnlen.c (__wcsnlen): Rewrite using wmemchr.
2019-02-27 10:00:37 -03:00
Adhemerval Zanella
30a7e2081c wcsmbs: optimize wcsncpy
This patch rewrites wcsncpy using wcsnlen, wmemset, and wmemcpy.  This is
similar to the optimization done on strncpy by f6482cf29d and 6423d4754c.

Checked on x86_64-linux-gnu.

	* wcsmbs/wcsncpy.c (__wcsncpy): Rewrite using wcsnlen, wmemset, and
	wmemcpy.
2019-02-27 10:00:37 -03:00
Adhemerval Zanella
ddf21ec79f wcsmbs: optimize wcsncat
This patch rewrites wcsncat using wcslen, wcsnlen, and wmemcpy.  This is
similar to the optimization done on strncat by 3eb38795db and e80514b5a8.

Checked on x86_64-linux-gnu.

	* wcsmbs/wcsncat.c (wcsncat): Rewrite using wcslen, wcsnlen, and
	wmemcpy.
2019-02-27 10:00:37 -03:00
Adhemerval Zanella
4d8015639a wcsmbs: optimize wcscpy
This patch rewrites wcscpy using wcslen and wmemcpy.  This is similar
to the optimization done on strcpy by b863d2bc4d.

Checked on x86_64-linux-gnu.

	* wcsmbs/wcscpy.c (__wcpcpy): Rewrite using wcslen and wmemcpy.
2019-02-27 10:00:42 -03:00
Adhemerval Zanella
81a1443941 wcsmbs: optimize wcscat
This patch rewrites wcscat using wcslen and wcscpy.  This is similar to
the optimization done on strcat by 6e46de42fe.

The strcpy changes are mainly to add the internal alias to avoid PLT
calls.

Checked on x86_64-linux-gnu and a build against the affected
architectures.

	* include/wchar.h (__wcscpy): New prototype.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
	(__wcscpy): Route internal symbol to generic implementation.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c (wcscpy):
	Add internal __wcscpy alias.
	* sysdeps/powerpc/powerpc64/multiarch/wcscpy.c (wcscpy): Likewise.
	* sysdeps/s390/wcscpy.c (wcscpy): Likewise.
	* sysdeps/x86_64/multiarch/wcscpy.c (wcscpy): Likewise.
	* wcsmbs/wcscpy.c (wcscpy): Add
	* sysdeps/x86_64/multiarch/wcscpy-c.c (WCSCPY): Adjust macro to
	use generic implementation.
	* wcsmbs/wcscat.c (wcscat): Rewrite using wcslen and wcscpy.
2019-02-27 10:00:37 -03:00
Adhemerval Zanella
39ef074419 wcsmbs: optimize wcpncpy
This patch rewrites wcpncpy using wcslen, wmemcpy, and wmemset.  This is
similar to the optimization done on stpncpy by 48497aba8e.

Checked on x86_64-linux-gnu.

        * wcsmbs/wcpncpy.c (__wcpcpy): Rewrite using wcslen, wmemcpy, and
	wmemset.
2019-02-27 10:00:38 -03:00
Adhemerval Zanella
7b3fb62051 wcsmbs: optimize wcpcpy
This patch rewrites wcpcpy using wcslen and wmemcpy.  This is
similar to the optimizatio done on stpcpy by f559d8cf29.

Checked on x86_64-linux-gnu and string tests on a simulated
m68k-linux-gnu.

	* sysdeps/m68k/wcpcpy.c: Remove file.
	* wcsmbs/wcpcpy.c (__wcpcpy): Rewrite using wcslen and wmemcpy.
2019-02-27 10:00:34 -03:00
Joseph Myers
aa0e46636a Break further lines before not after operators.
This patch continues the process of fixing coding style to break lines
before not after operators in accordance with the GNU Coding
Standards, fixing such issues in a non-exhaustive selection of sysdeps
files that had them.

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

	* sysdeps/arm/sysdep.h (#if condition): Break lines before rather
	than after operators.
	* sysdeps/mach/hurd/fork.c (__fork): Likewise.
	* sysdeps/mach/hurd/getcwd.c
	(__hurd_canonicalize_directory_name_internal): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-consistent.c
	(pthread_mutex_consistent): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-init.c (_pthread_mutex_init):
	Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c
	(__pthread_mutex_transfer_np): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-unlock.c
	(__pthread_mutex_unlock): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex.h (ROBUST_LOCK): Likewise.
	(mtx_owned_p): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-getrobust.c
	(pthread_mutexattr_getrobust): Likewise.
	* sysdeps/mach/hurd/i386/init-first.c (init1): Likewise.
	* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
	Likewise.
	* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
	* sysdeps/mach/hurd/jmp-unwind.c (_longjmp_unwind): Likewise.
	* sysdeps/mach/hurd/kill.c (__kill): Likewise.
	* sysdeps/mach/hurd/mig-reply.c (__mig_get_reply_port): Likewise.
	* sysdeps/mach/hurd/ptrace.c (ptrace): Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sysdep.h (#if condition):
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/ioperm.c (process_cpuinfo):
	Likewise.
	* sysdeps/unix/sysv/linux/bits/timex.h (STA_RONLY): Likewise.
	* sysdeps/unix/sysv/linux/csky/sysdep.h (#if condition): Likewise.
	* sysdeps/unix/sysv/linux/generic/____longjmp_chk.c
	(____longjmp_chk): Likewise.
	* sysdeps/unix/sysv/linux/generic/futimesat.c (futimesat):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
	(INTERNAL_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
	(INTERNAL_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
	(__get_clockfreq_via_cpuinfo): Likewise.
2019-02-26 15:01:50 +00:00
Joseph Myers
e0cb7b6131 Add and move fall-through comments in system-specific code.
This patch fixes -Wimplicit-fallthrough warnings in system-specific
code that show up building glibc with -Wextra, by adding fall-through
comments, or moving existing such comments to the place required for
them to work (immediately before the case label being fallen through).

Tested with build-many-glibcs.py.

	* sysdeps/i386/dl-machine.h (elf_machine_rela): Add fall-through
	comments.
	* sysdeps/m68k/m680x0/fpu/s_cexp_template.c (s(__cexp)): Likewise.
	* sysdeps/m68k/memcopy.h (WORD_COPY_FWD): Likewise.
	(WORD_COPY_BWD): Likewise.
	* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
	* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/s390/iso-8859-1_cp037_z900.c (TR_LOOP): Likewise.
	* sysdeps/mips/dl-machine.h (elf_machine_reloc): Move fall-through
	comment.
	* sysdeps/mips/dl-trampoline.c (__dl_runtime_resolve): Likewise.
2019-02-26 02:09:18 +00:00
Joseph Myers
a04549c194 Break more lines before not after operators.
This patch makes further coding style fixes where code was breaking
lines after an operator, contrary to the GNU Coding Standards.  As
with the previous patch, it is limited to files following a reasonable
approximation to GNU style already, and is not exhaustive; more such
issues remain to be fixed.

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

	* dirent/dirent.h [!_DIRENT_HAVE_D_NAMLEN
	&& _DIRENT_HAVE_D_RECLEN] (_D_ALLOC_NAMLEN): Break lines before
	rather than after operators.
	* elf/cache.c (print_cache): Likewise.
	* gshadow/fgetsgent_r.c (__fgetsgent_r): Likewise.
	* htl/pt-getattr.c (__pthread_getattr_np): Likewise.
	* hurd/hurdinit.c (_hurd_setproc): Likewise.
	* hurd/hurdkill.c (_hurd_sig_post): Likewise.
	* hurd/hurdlookup.c (__file_name_lookup_under): Likewise.
	* hurd/hurdsig.c (_hurd_internal_post_signal): Likewise.
	(reauth_proc): Likewise.
	* hurd/lookup-at.c (__file_name_lookup_at): Likewise.
	(__file_name_split_at): Likewise.
	(__directory_name_split_at): Likewise.
	* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Likewise.
	* hurd/port2fd.c (_hurd_port2fd): Likewise.
	* iconv/gconv_dl.c (do_print): Likewise.
	* inet/netinet/in.h (struct sockaddr_in): Likewise.
	* libio/wstrops.c (_IO_wstr_seekoff): Likewise.
	* locale/setlocale.c (new_composite_name): Likewise.
	* malloc/memusagestat.c (main): Likewise.
	* misc/fstab.c (fstab_convert): Likewise.
	* nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
	Likewise.
	* nss/nss_compat/compat-grp.c (getgrent_next_nss): Likewise.
	(getgrent_next_file): Likewise.
	(internal_getgrnam_r): Likewise.
	(internal_getgrgid_r): Likewise.
	* nss/nss_compat/compat-initgroups.c (getgrent_next_nss):
	Likewise.
	(internal_getgrent_r): Likewise.
	* nss/nss_compat/compat-pwd.c (getpwent_next_nss_netgr): Likewise.
	(getpwent_next_nss): Likewise.
	(getpwent_next_file): Likewise.
	(internal_getpwnam_r): Likewise.
	(internal_getpwuid_r): Likewise.
	* nss/nss_compat/compat-spwd.c (getspent_next_nss_netgr):
	Likewise.
	(getspent_next_nss): Likewise.
	(internal_getspnam_r): Likewise.
	* pwd/fgetpwent_r.c (__fgetpwent_r): Likewise.
	* shadow/fgetspent_r.c (__fgetspent_r): Likewise.
	* string/strchr.c (STRCHR): Likewise.
	* string/strchrnul.c (STRCHRNUL): Likewise.
	* sysdeps/aarch64/fpu/fpu_control.h (_FPU_FPCR_IEEE): Likewise.
	* sysdeps/aarch64/sfp-machine.h (_FP_CHOOSENAN): Likewise.
	* sysdeps/csky/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/generic/memcopy.h (PAGE_COPY_FWD_MAYBE): Likewise.
	* sysdeps/generic/symbol-hacks.h (__stack_chk_fail_local):
	Likewise.
	* sysdeps/gnu/netinet/ip_icmp.h (ICMP_INFOTYPE): Likewise.
	* sysdeps/gnu/updwtmp.c (TRANSFORM_UTMP_FILE_NAME): Likewise.
	* sysdeps/gnu/utmp_file.c (TRANSFORM_UTMP_FILE_NAME): Likewise.
	* sysdeps/hppa/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/mach/hurd/bits/stat.h (S_ISPARE): Likewise.
	* sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start): Likewise.
	(open_file): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-setprotocol.c
	(pthread_mutexattr_setprotocol): Likewise.
	* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
	* sysdeps/mach/hurd/mmap.c (__mmap): Likewise.
	* sysdeps/mach/hurd/ptrace.c (ptrace): Likewise.
	* sysdeps/mach/hurd/spawni.c (__spawni): Likewise.
	* sysdeps/microblaze/dl-machine.h (elf_machine_type_class):
	Likewise.
	(elf_machine_rela): Likewise.
	* sysdeps/mips/mips32/sfp-machine.h (_FP_CHOOSENAN): Likewise.
	* sysdeps/mips/mips64/sfp-machine.h (_FP_CHOOSENAN): Likewise.
	* sysdeps/mips/sys/asm.h (multiple #if conditionals): Likewise.
	* sysdeps/posix/rename.c (rename): Likewise.
	* sysdeps/powerpc/novmx-sigjmp.c (__novmx__sigjmp_save): Likewise.
	* sysdeps/powerpc/sigjmp.c (__vmx__sigjmp_save): Likewise.
	* sysdeps/s390/fpu/fenv_libc.h (FPC_VALID_MASK): Likewise.
	* sysdeps/s390/utf8-utf16-z9.c (gconv_end): Likewise.
	* sysdeps/unix/grantpt.c (grantpt): Likewise.
	* sysdeps/unix/sysv/linux/a.out.h (N_TXTOFF): Likewise.
	* sysdeps/unix/sysv/linux/updwtmp.c (TRANSFORM_UTMP_FILE_NAME):
	Likewise.
	* sysdeps/unix/sysv/linux/utmp_file.c (TRANSFORM_UTMP_FILE_NAME):
	Likewise.
	* sysdeps/x86/cpu-features.c (get_common_indices): Likewise.
	* time/tzfile.c (__tzfile_compute): Likewise.
2019-02-25 13:19:19 +00:00
Joseph Myers
34a5a1460e Break some lines before not after operators.
The GNU Coding Standards specify that line breaks in expressions
should go before an operator, not after one.  This patch fixes various
code to do this.  It only changes code that appears to be mostly
following GNU style anyway, not files and directories with
substantially different formatting.  It is not exhaustive even for
files using GNU style (for example, changes to sysdeps files are
deferred for subsequent cleanups).  Some files changed are shared with
gnulib, but most are specific to glibc.  Changes were made manually,
with places to change found by grep (so some cases, e.g. where the
operator was followed by a comment at end of line, are particularly
liable to have been missed by grep, but I did include cases where the
operator was followed by backslash-newline).

This patch generally does not attempt to address other coding style
issues in the expressions changed (for example, missing spaces before
'(', or lack of parentheses to ensure indentation of continuation
lines properly reflects operator precedence).

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

	* benchtests/bench-memmem.c (simple_memmem): Break lines before
	rather than after operators.
	* benchtests/bench-skeleton.c (TIMESPEC_AFTER): Likewise.
	* crypt/md5.c (md5_finish_ctx): Likewise.
	* crypt/sha256.c (__sha256_finish_ctx): Likewise.
	* crypt/sha512.c (__sha512_finish_ctx): Likewise.
	* elf/cache.c (load_aux_cache): Likewise.
	* elf/dl-load.c (open_verify): Likewise.
	* elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise.
	* elf/readelflib.c (process_elf_file): Likewise.
	* elf/rtld.c (dl_main): Likewise.
	* elf/sprof.c (generate_call_graph): Likewise.
	* hurd/ctty-input.c (_hurd_ctty_input): Likewise.
	* hurd/ctty-output.c (_hurd_ctty_output): Likewise.
	* hurd/dtable.c (reauth_dtable): Likewise.
	* hurd/getdport.c (__getdport): Likewise.
	* hurd/hurd/signal.h (_hurd_interrupted_rpc_timeout): Likewise.
	* hurd/hurd/sigpreempt.h (HURD_PREEMPT_SIGNAL_P): Likewise.
	* hurd/hurdfault.c (_hurdsig_fault_catch_exception_raise):
	Likewise.
	* hurd/hurdioctl.c (fioctl): Likewise.
	* hurd/hurdselect.c (_hurd_select): Likewise.
	* hurd/hurdsig.c (_hurdsig_abort_rpcs): Likewise.
	(STOPSIGS): Likewise.
	* hurd/hurdstartup.c (_hurd_startup): Likewise.
	* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Likewise.
	* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Likewise.
	* hurd/msgportdemux.c (msgport_server): Likewise.
	* hurd/setauth.c (_hurd_setauth): Likewise.
	* include/features.h (__GLIBC_USE_DEPRECATED_SCANF): Likewise.
	* libio/libioP.h [IO_DEBUG] (CHECK_FILE): Likewise.
	* locale/programs/ld-ctype.c (set_class_defaults): Likewise.
	* localedata/tests-mbwc/tst_swscanf.c (tst_swscanf): Likewise.
	* login/tst-utmp.c (do_check): Likewise.
	(simulate_login): Likewise.
	* mach/lowlevellock.h (lll_lock): Likewise.
	(lll_trylock): Likewise.
	* math/test-fenv.c (ALL_EXC): Likewise.
	* math/test-fenvinline.c (ALL_EXC): Likewise.
	* misc/sys/cdefs.h (__attribute_deprecated_msg__): Likewise.
	* nis/nis_call.c (__do_niscall3): Likewise.
	* nis/nis_callback.c (cb_prog_1): Likewise.
	* nis/nis_defaults.c (searchaccess): Likewise.
	* nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise.
	* nis/nis_ismember.c (internal_ismember): Likewise.
	* nis/nis_local_names.c (nis_local_principal): Likewise.
	* nis/nss_nis/nis-rpc.c (_nss_nis_getrpcbyname_r): Likewise.
	* nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_getnetgrent_r):
	Likewise.
	* nis/ypclnt.c (yp_match): Likewise.
	(yp_first): Likewise.
	(yp_next): Likewise.
	(yp_master): Likewise.
	(yp_order): Likewise.
	* nscd/hstcache.c (cache_addhst): Likewise.
	* nscd/initgrcache.c (addinitgroupsX): Likewise.
	* nss/nss_compat/compat-pwd.c (copy_pwd_changes): Likewise.
	(internal_getpwuid_r): Likewise.
	* nss/nss_compat/compat-spwd.c (copy_spwd_changes): Likewise.
	* posix/glob.h (__GLOB_FLAGS): Likewise.
	* posix/regcomp.c (peek_token): Likewise.
	(peek_token_bracket): Likewise.
	(parse_expression): Likewise.
	* posix/regexec.c (sift_states_iter_mb): Likewise.
	(check_node_accept_bytes): Likewise.
	* posix/tst-spawn3.c (do_test): Likewise.
	* posix/wordexp-test.c (testit): Likewise.
	* posix/wordexp.c (parse_tilde): Likewise.
	(exec_comm): Likewise.
	* posix/wordexp.h (__WRDE_FLAGS): Likewise.
	* resource/vtimes.c (TIMEVAL_TO_VTIMES): Likewise.
	* setjmp/sigjmp.c (__sigjmp_save): Likewise.
	* stdio-common/printf_fp.c (__printf_fp_l): Likewise.
	* stdio-common/tst-fileno.c (do_test): Likewise.
	* stdio-common/vfprintf-internal.c (vfprintf): Likewise.
	* stdlib/strfmon_l.c (__vstrfmon_l_internal): Likewise.
	* stdlib/strtod_l.c (round_and_return): Likewise.
	(____STRTOF_INTERNAL): Likewise.
	* stdlib/tst-strfrom.h (TEST_STRFROM): Likewise.
	* string/strcspn.c (STRCSPN): Likewise.
	* string/test-memmem.c (simple_memmem): Likewise.
	* termios/tcsetattr.c (tcsetattr): Likewise.
	* time/alt_digit.c (_nl_parse_alt_digit): Likewise.
	* time/asctime.c (asctime_internal): Likewise.
	* time/strptime_l.c (__strptime_internal): Likewise.
	* time/sys/time.h (timercmp): Likewise.
	* time/tzfile.c (__tzfile_compute): Likewise.
2019-02-22 01:32:36 +00:00
Patsy Franklin
b0b50fe005 nss: tst-nss-files-hosts-long: Add host.conf [BZ #21915]
Add /etc/host.conf file with 'multi on' to tst-nss-files-hosts-long.root.
Ensures the entire file, and all long lines, need to be parsed for the
test.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-21 16:02:29 -05:00
Gabriel F. T. Gomes
f43b8dd555 Add internal implementations for argp.h, err.h, and error.h functions
Since the introduction of explicit flags in the internal implementation
of the printf family of functions, the 'mode' parameter can be used to
select which format long double parameters have (with the mode flag:
PRINTF_LDBL_IS_DBL).  This patch uses this feature in the implementation
of some functions in argp.h, err.h, and error.h (only those that take a
format string and positional parameters).  Future patches will add
support for 'nldbl' and 'ieee128' versions of these functions.

Tested for powerpc64le and x86_64.
2019-02-21 10:28:50 -03:00
marxin
dc0afac325 Add new Fortran vector math header file. 2019-02-20 15:27:56 +01:00
Gabriel F. T. Gomes
4a2dd41cb5 powerpc64le: Remove test for GCC 6.2
The configure fragment for powerpc64le contains a test for the presence
of several compiler builtins and of the __float128 type, which are
provided by GCC 6.2 for powerpc64le.  Since this configure test was
added, the compiler version required to build glibc for powerpc64le was
different than that required for the other architectures.

Now that glibc requires GCC 6.2 globally (since commit ID 4dcbbc3b28),
this patch removes the powerpc64le-specific test.

Even tough the configure test checks for compiler features rather than
compiler version, the intent of the test was to stop build attempts at
early stages, if they had been configured with a too old compiler.  It
was not the intention of the test to detect compiler breakage (such as
the removal of the required compiler features in future GCC versions),
and glibc is not the place to test for compiler regressions, anyway.

Tested for powerpc64le with GCC 6.2 (built with build-many-glibcs.py).

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2019-02-20 11:06:51 -03:00
Wolfram Sang
04de930226 nptl: Fix comment typo in pthread_mutex_trylock.c 2019-02-19 11:00:07 -05:00
Carlos O'Donell
b026ce1ee9 nptl: Fix pthread_tryjoin comment.
In pthread_tryjoin if pd->tid == 0 then we will not block on a
futex operation because we will immediately see the join is already
complete and return. The comment is fixed to reflect that.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
2019-02-19 09:22:34 -05:00
Joseph Myers
8c9289b642 Fix SPARC64 handling of R_SPARC_H34 (bug 24231).
Building glibc with -Wextra shows a -Wimplicit-fallthrough warning for
SPARC64 that appears to be a real bug in glibc.  The dynamic linker
handling of R_SPARC_H34 falls through to that of R_SPARC_H44, which in
the case of this code is nonsensical (it means the value computed for
R_SPARC_H34 gets overwritten by one computed with the different logic
for R_SPARC_H44).  Thus, this patch adds the missing break there.
Note: I do not have a testcase to demonstrate this bug.

Tested with build-many-glibcs.py.

	[BZ #24231]
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Add break
	after R_SPARC_H34 case.
2019-02-18 22:33:29 +00:00
Florian Weimer
308e022fc4 resolv: Remove debugging code from compat-gethnamaddr.c 2019-02-18 16:39:15 +01:00
Florian Weimer
a5406364ac libio: Eliminate _IO_stdin, _IO_stdout, _IO_stderr
These variables are only used to determine if a stdio stream is
a pre-allocated stream, but it is possible to do so by comparing
a FILE * to all pre-allocated stream objects.  As a result, it is
not necessary to keep those pointers in separate variables.

Behavior with symbol interposition is unchanged because _IO_stdin_,
_IO_stdout_, _IO_stderr_ are exported, and refer to objects outside of
libc if symbol interposition or copy relocations are involved.  (The
removed variables _IO_stdin, _IO_stdout, _IO_stderr were not exported,
of course.)
2019-02-18 16:37:00 +01:00
Stefan Liebler
6c29942cbf misc/tst-clone3: Fix waiting for exited thread.
From time to time the test misc/tst-clone3 fails with a timeout.
Then futex_wait is blocking.  Usually ctid should be set to zero
due to CLONE_CHILD_CLEARTID and the futex should be waken up.
But the fail occures if the thread has already exited before
ctid is set to the return value of clone().  Then futex_wait() will
block as there will be nobody who wakes the futex up again.

This patch initializes ctid to a known value before calling clone
and the kernel is the only one who updates the value to zero after clone.
If futex_wait is called then it is either waked up due to the exited thread
or the futex syscall fails as *ctid_ptr is already zero instead of the
specified value 1.

ChangeLog:

	* sysdeps/unix/sysv/linux/tst-clone3.c (do_test):
	Initialize ctid with a known value and remove update of ctid
	after clone.
	(wait_tid): Adjust arguments and call futex_wait with ctid_val
	as assumed current value of ctid_ptr.
2019-02-18 16:12:01 +01:00
Florian Weimer
ad18dadec9 Add check for missing wrapper headers
If building on a subset of architectures only, it is easy to miss
wrapper headers which are required by other architectures because
they lack the corresponding sysdeps header.  The check ensures
that every installed header which is not itself a sysdeps header
has a header under include/ (that presumably wraps the header,
and perhaps also adding declarations and definitions for !_ISOMAC).

Also check for the absence of the sysdeps/generic/bits directory
removed in commit c72565e5f1, to make
accidental re-introduction more difficult.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-16 08:25:16 +01:00
Florian Weimer
ebd32784ce Add missing header wrappers under include/
With a complete set of wrapper headers, it will be possible to check
for automatically for new installed headers which lack such wrappers.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-16 08:25:16 +01:00
Florian Weimer
a198d37ade Move remaining nptl_db headers to sysdeps/nptl
sys/procfs.h was already using this sysdeps directory.

This avoids the need for  nptl-specific wrapper headers under
include/, a generic location in the source tree.
2019-02-16 08:25:16 +01:00
Adhemerval Zanella
e442e40de5 io: Consolidate lockf implementation
With internal fcntl64 internal (commit 06ab719d), it is possible to
consolidate lockf implementation by using the LFS fcntl interface
instead of using arch and system-specific implementations.

For Linux, the i386 implementation is used as generic implementation
by replacing the direct syscall with fcntl64 call.  The LFS symbol
alias for default LFS ABI (__OFF_T_MATCHES_OFF64_T) is used to avoid
the duplicate symbol (instead of overriding the implementation with an
empty file).

For Hurd lockf64 semantic is changed: previous generic lockf64
implementation returned EOVERFLOW if LEN input is larger than 32-bit
off_t.  However, Hurd fcntl64 implementation for F_GETLK64, F_SETLK64,
and F_SETLKW64 do accept off64_t inputs (__f_setlk accepts only off64_t
inputs).

Checked on i686-linux-gnu and x86_64-linux-gnu along with a i686-gnu
build.

	* io/Makefile (tests): Add tst-lockf.
	* io/lockf.c (lockf): Use __fcntl and only define for
	!__OFF_T_MATCHES_OFF64_T.
	* io/lockf64.c (__lockf64): Call __fcntl64 and alias to lockf for
	__OFF_T_MATCHES_OFF64_T case.
	* io/tst-lockf.c: New file.
	* sysdeps/unix/sysv/linux/i386/lockf64.c: Remove file.
	* sysdeps/unix/sysv/linux/arm/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/lockf64.c: Likewise.
2019-02-15 18:45:39 -02:00
Florian Weimer
bc10e22c90 nptl: Fix invalid Systemtap probe in pthread_join [BZ #24211]
After commit f1ac745583 ("arm: Use "nr"
constraint for Systemtap probes [BZ #24164]"), we load pd->result into
a register in the probe below:

      /* Free the TCB.  */
      __free_tcb (pd);
    }
  else
    pd->joinid = NULL;

  LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd->result);

However, at this point, the thread descriptor has been freed.  If the
thread stack does not fit into the thread stack cache, the memory will
have been unmapped, and the program will crash in the probe.
2019-02-15 19:09:00 +01:00
Joseph Myers
8a11f97062 Remove qualifier from function return type in tst-svc_register.c.
Building the testsuite with -Wextra produces a warning in
sunrpc/tst-svc_register.c for a useless qualifier on a function return
type.  This patch removes that qualifier.

Tested for x86_64.

	* sunrpc/tst-svc_register.c (rpcbind_address): Remove qualifier
	from function return type.
2019-02-15 13:45:19 +00:00
Joseph Myers
365f05c7a5 Fix implicit-fallthrough warnings in tst-setjmp.c.
Building the testsuite with -Wextra (together with
-Wno-cast-function-type -Wno-clobbered -Wno-expansion-to-defined
-Wno-missing-field-initializers -Wno-old-style-declaration
-Wno-shift-negative-value -Wno-sign-compare -Wno-type-limits
-Wno-unused-parameter, which reflect the set of -Wextra warnings for
which glibc itself is not currently clean on x86_64) showed up
implicit-fallthrough warnings in tst-setjmp.c.  Those warnings appear
to be false positives, arising from a function "jump" that calls
longjmp not itself being marked as noreturn; thus, this patch adds the
noreturn marking to that function to fix the warnings.

Tested for x86_64.

	* setjmp/tst-setjmp.c (jump): Use __attribute__ ((__noreturn__)).
2019-02-15 13:44:17 +00:00
Jan Kratochvil
56a731d4ad Avoid readline conflicts in pexpect
In some cases, sensitive to readline version and the user's
environment, gdb might emit escape codes while run under python's
pexpect (i.e. testing pretty printers).  This patch, suggested
by Jan, helps isolate the test from the user's environment.

Tested on RHEL 7 x86_64 with DTS 7 and EPEL, which is one
magic combination of components that triggers this bug.
2019-02-14 16:28:03 -05:00
Joseph Myers
712182c8dc Fix fall-through warnings in sunrpc/xdr.c.
This patch fixes implicit-fallthrough warnings in sunrpc/xdr.c when
building with -Wextra.  A fall-through comment is added in three
places; in two other places, an existing comment is reworded so it
matches the default patterns used by -Wimplicit-fallthrough.

Tested for x86_64.

	* sunrpc/xdr.c (xdr_int): Add fall-through comment.
	(xdr_u_int): Likewise.
	(xdr_enum): Likewise.
	(xdr_bytes): Reword fall-through comment.
	(xdr_string): Likewise.
2019-02-14 20:35:16 +00:00
Adhemerval Zanella
eb76e5b465 nptl: Reinstate pthread_timedjoin_np as a cancellation point (BZ#24215)
Patch ce7eb0e903 ("nptl: Cleanup cancellation macros") changed the
join sequence for internal common __pthread_timedjoin_ex to use the
new macro lll_wait_tid.  The idea was this macro would issue the
cancellable futex operation depending whether the timeout is used or
not.  However if a timeout is used, __lll_timedwait_tid is called and
it is not a cancellable entrypoint.

This patch fixes it by simplifying the code in various ways:

  - Instead of adding the cancellation handling on __lll_timedwait_tid,
    it moves the generic implementation to pthread_join_common.c (called
    now timedwait_tid with some fixes to use the correct type for pid).

  - The llvm_wait_tid macro is removed, along with its replication on
    x86_64, i686, and sparc arch-specific lowlevellock.h.

  - sparc32 __lll_timedwait_tid is also removed, since the code is similar
    to generic one.

  - x86_64 and i386 provides arch-specific __lll_timedwait_tid which is
    also removed since they are similar in functionality to generic C code
    and there is no indication it is better than compiler generated code.

New tests, tst-join8 and tst-join9, are provided to check if
pthread_timedjoin_np acts as a cancellation point.

Checked on x86_64-linux-gnu, i686-linux-gnu, sparcv9-linux-gnu, and
aarch64-linux-gnu.

	[BZ #24215]
	* nptl/Makefile (lpthread-routines): Remove lll_timedwait_tid.
	(tests): Add tst-join8 tst-join9.
	* nptl/lll_timedwait_tid.c: Remove file.
	* sysdeps/sparc/sparc32/lll_timedwait_tid.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/lll_timedwait_tid.c: Likewise.
	* sysdeps/sysv/linux/x86_64/lll_timedwait_tid.c: Likewise.
	* nptl/pthread_join_common.c (timedwait_tid): New function.
	(__pthread_timedjoin_ex): Act as cancellation entrypoint is block
	is set.
	* nptl/tst-join5.c (thread_join): New function.
	(tf1, tf2, do_test): Use libsupport and add pthread_timedjoin_np
	check.
	* nptl/tst-join8.c: New file.
	* nptl/tst-join9.c: Likewise.
	* sysdeps/nptl/lowlevellock-futex.h (lll_futex_wait_cancel,
	lll_futex_timed_wait_cancel): Add generic macros.
	* sysdeps/nptl/lowlevellock.h (__lll_timedwait_tid, lll_wait_tid):
	Remove definitions.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
	* sysdeps/sparc/sparc32/lowlevellock.c (__lll_timedwait_tid):
	Remove function.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.S (__lll_timedwait_tid):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/lowlevellock-futex.h
	(lll_futex_timed_wait_cancel): New macro.
2019-02-14 18:11:15 -02:00
Wilco Dijkstra
3904fd85d3 Add malloc micro benchmark
Add a malloc micro benchmark to enable accurate testing of the
various paths in malloc and free.  The benchmark does a varying
number of allocations of a given block size, then frees them again.

It tests 3 different scenarios: single-threaded using main arena,
multi-threaded using thread-arena, main arena with SINGLE_THREAD_P
false.

	* benchtests/Makefile: Add malloc-simple benchmark.
	* benchtests/bench-malloc-simple.c: New benchmark.
2019-02-14 16:37:11 +00:00
Siddhesh Poyarekar
24ca04febe benchtests: Remove useless ORIG_SRC in memmove benchmarks
The ORIG_SRC argument is likely a useless relic from the original
correctness tests that are not needed in the benchmarks.  Remove the
argument and use S1 to point to the source to avoid confusion.

        * benchtests/bench-memmove.c (do_one_test): Remove unused
        ORIG_SRC.
        (do_test): Adjust.
        * benchtests/bench-memmove-large.c (do_one_test): Remove unused
        ORIG_SRC.
        (do_test): Adjust.
2019-02-14 08:22:34 +05:30
Jim Wilson
85bd1ddbdf
RISC-V: Fix elfutils testsuite unwind failures.
The clone.S patch fixes 2 elfutils testsuite unwind failures, where the
backtrace gets stuck repeating __thread_start until we hit the backtrace
limit.  This was confirmed by building and installing a patched glibc and
then building elfutils and running its testsuite.

Unfortunately, the testcase isn't working as expected and I don't know why.
The testcase passes even when my clone.S patch is not installed.  The testcase
looks logically similarly to the elfutils testcases that are failing.  Maybe
there is a subtle difference in how the glibc unwinding works versus the
elfutils unwinding?  I don't have good gdb pthread support yet, so I haven't
found a way to debug this.  Anyways, I don't know if the testcase is useful or
not.  If the testcase isn't useful then maybe the clone.S patch is OK without
a testcase?

Jim

	[BZ #24040]
	* elf/Makefile (CFLAGS-tst-unwind-main.c): Add -DUSE_PTHREADS=0.
	* elf/tst-unwind-main.c: If USE_PTHEADS, include pthread.h and error.h
	(func): New.
	(main): If USE_PTHREADS, call pthread_create to run func.  Otherwise
	call func directly.
	* nptl/Makefile (tests): Add tst-unwind-thread.
	(CFLAGS-tst-unwind-thread.c): Define.
	* nptl/tst-unwind-thread.c: New file.
	* sysdeps/unix/sysv/linux/riscv/clone.S (__thread_start): Mark ra
	as undefined.
2019-02-13 14:25:00 -08:00
Joseph Myers
107562682c Adjust wording of two fall-through comments.
In two places in glibc, -Wextra produces implicit-fallthrough warnings
where there are comments about the fall-through but their wording
doesn't match one of the forms expected by the default
implicit-fallthrough level.  This patch adjusts those two places to
have a comment in a form that is accepted, so avoiding the warning
(this seems preferable to only being able to use a looser level of the
warning that allows any comment at all as evidence of deliberate
fall-through).

Tested for x86_64.

	* iconvdata/cns11643.h (ucs4_to_cns11643): Adjust fall-through
	comment wording.
	* nis/nis_call.c (__do_niscall3): Likewise.
2019-02-13 18:37:54 +00:00
Joseph Myers
0538372096 Fix -Wempty-body warnings in glibc.
One group of warnings seen building glibc with -Wextra is -Wempty-body
warnings about an 'if' body (or in one case an 'else' body) that is
just a semicolon, "warning: suggest braces around empty body in an
'if' statement [-Wempty-body]" - I think the point of the warning
being to make it more visible whether an 'if' body is actually present
or not.

This patch fixes such warnings in glibc.  There's one place, with a
semicolon at the end of a comment, where this is clearly making the
presence of an 'else' body more visible.  The other cases involve
macro definitions expanding to nothing.  While there's no issue there
with visibility at the call sites, I think it's still cleaner to have
a macro that expands to something nonempty appropriate for the context
- so do {} while (0) if it's only intended to be usable as a
statement, or ((void) 0) where the macro definition is an alternative
to a call to a function returning void, so this patch makes those
changes.

Tested for x86_64.

	* catgets/gencat.c (normalize_line): Use braces around empty
	'else' body.
	* include/stap-probe.h [!USE_STAP_PROBE && !__ASSEMBLER__]
	(STAP_PROBE0): Use do {} while (0) for do-nothing definition.
	[!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE1): Likewise.
	[!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE2): Likewise.
	[!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE3): Likewise.
	[!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE4): Likewise.
	* libio/libio.h (_IO_funlockfile): Use ((void) 0) for do-nothing
	definition.
2019-02-13 13:50:13 +00:00
Joseph Myers
86140c6223 Avoid fall-through in test-container if execlp fails.
One of the implicit-fallthrough warnings from compiling glibc with
-Wextra appears to indicate an actual bug: the test-container code
could fall through inappropriately if execlp returns (which only
occurs on error).  This patch adds appropriate error handling in this
case to avoid that fall-through.

Tested for x86_64.

	* support/test-container.c (recursive_remove): Use FAIL_EXIT1 if
	execlp returns.
2019-02-13 13:34:24 +00:00
Wilco Dijkstra
16f87cfd63 String benchtest cleanup
Continue cleanup of the string benchtests.  Remove simplistic
byte-oriented versions with faster generic implementations.
Remove bcopy/bzero benchmarks (bcopy/bzero are obsolete and never
emitted by compilers).  Remove builtin versions of memcpy, memset
and strlen.  Remove all remaining "stupid" implementations given
they are always slower than the "simple" variants and thus don't
add anything useful.

	* benchtests/bench-strcasecmp.c (stupid_strcasecmp): Remove.
	* benchtests/bench-strcasestr.c (stupid_strcasestr): Remove.
	* benchtests/bench-strchr.c (stupid_strchr): Remove.
	* benchtests/bench-strcmp.c (stupid_strcmp): Remove.
	* benchtests/bench-strcspn.c (stupid_strcspn): Remove.
	* benchtests/bench-strlen.c (builtin_strlen): Remove.
	* benchtests/bench-strncasecmp.c (stupid_strncasecmp): Remove.
	* benchtests/bench-strncmp.c (stupid_strncmp): Remove.
	* benchtests/bench-strpbrk.c (stupid_strpbrk): Remove.
	* benchtests/bench-strspn.c (stupid_strspn): Remove.
	* benchtests/Makefile: Remove bench-bcopy.c and bench-bzero.c.
	* benchtests/bench-bcopy.c: Delete file.
	* benchtests/bench-bzero.c: Likewise.
	* benchtests/bench-memccpy.c (stupid_memccpy): Remove.
	(simple_memccpy): Remove.
	(generic_memccpy): Add function.
	* benchtests/bench-memcpy.c: (builtin_memcpy): Remove.
	* benchtests/bench-memmove.c (simple_bcopy): Remove.
	* benchtests/bench-mempcpy.c (simple_mempcpy): Remove.
	(generic_mempcpy): Add new function.
	* benchtests/bench-memset.c (simple_bzero): Remove.
	(builtin_bzero): Remove.
	(builtin_memset): Remove.
	* benchtests/bench-rawmemchr.c (simple_rawmemchr): Remove.
	(generic_rawmemchr): Add new function.
2019-02-12 17:19:51 +00:00
Florian Weimer
0c6d82e979 nss: getent: Print IPv6 scope ID for ahosts/ahostsv6 if available
This information is sometimes useful and actually required for
link-local addresses.
2019-02-12 14:26:20 +01:00
Adhemerval Zanella
b3fbfe8196 elf: Test for LD_AUDIT module returning zero from la_version [BZ #24122]
This includes the original test case from commit
8e889c5da3 ("elf: Fix LD_AUDIT for
modules with invalid version (BZ#24122)).
2019-02-12 13:51:43 +01:00
Florian Weimer
3b856d093f elf: Ignore LD_AUDIT interfaces if la_version returns 0 [BZ #24122]
This change moves the audit module loading and early notification into
separate functions out of dl_main.

It restores the bug fix from commit
8e889c5da3  ("elf: Fix LD_AUDIT for
modules with invalid version (BZ#24122)") which was reverted in commit
83e6b59625  ("[elf] Revert 8e889c5da3
(BZ#24122)").

The actual bug fix is the separate error message for the case when
la_version returns zero.  The dynamic linker error message (which is
NULL in this case) is no longer used.  Based on the intended use of
version zero (ignore this module due to explicit request), the message
is only printed if debugging is enabled.
2019-02-12 13:36:56 +01:00
Joseph Myers
32db86d558 Add fall-through comments.
This patch adds fall-through comments in some cases where -Wextra
produces implicit-fallthrough warnings.

The patch is non-exhaustive.  Apart from architecture-specific code
for non-x86_64 architectures, it does not change sunrpc/xdr.c (legacy
code, probably should have such changes, but left to be dealt with
separately), or places that already had comments about the
fall-through but not matching the form expected by
-Wimplicit-fallthrough=3 (the default level with -Wextra; my
inclination is to adjust those comments to match rather than
downgrading to -Wimplicit-fallthrough=1 to allow any comment), or one
place where I thought the implicit fallthrough was not correct and so
should be handled separately as a bug fix.  I think the key thing to
consider in review of this patch is whether the fall-through is indeed
intended and correct in each place where such a comment is added.

Tested for x86_64.

	* elf/dl-exception.c (_dl_exception_create_format): Add
	fall-through comments.
	* elf/ldconfig.c (parse_conf_include): Likewise.
	* elf/rtld.c (print_statistics): Likewise.
	* locale/programs/charmap.c (parse_charmap): Likewise.
	* misc/mntent_r.c (__getmntent_r): Likewise.
	* posix/wordexp.c (parse_arith): Likewise.
	(parse_backtick): Likewise.
	* resolv/ns_ttl.c (ns_parse_ttl): Likewise.
	* sysdeps/x86/cpu-features.c (init_cpu_features): Likewise.
	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.
2019-02-12 10:30:34 +00:00
Paul Clarke
a51bc4fe9d Use float in e_sqrt.c
The type used within e_sqrt.c(__slow_ieee754_sqrtf) was, unnecessarily and
likely inadvertently, double.  float is not only appropriate, but also
more efficient, avoiding the need for the compiler to emit a
round-to-single-precision instruction.

This is the difference in compiled code:
 0000000000000000 <__ieee754_sqrtf>:
    0:  2c 08 20 ec     fsqrts  f1,f1
-   4:  18 08 20 fc     frsp    f1,f1
-   8:  20 00 80 4e     blr
+   4:  20 00 80 4e     blr

(Found by Anton Blanchard.)
2019-02-11 12:03:23 -02:00
TAMUKI Shoichi
fb25b1356a Fix a few whitespace arrangement inconsistencies in time/strftime_l.c
Having checked the arrangement of whitespace in time/strftime_l.c
using "unexpand" and "unexpand -a" command, three inconsistencies are
detected.  So fix them for consistency.

ChangeLog:

	* time/strftime_l.c: Fix a few whitespace arrangement inconsistencies.
2019-02-11 12:13:55 +09:00
Joseph Myers
32ea729996 Remove powerpc bits/mathinline.h.
Continuing the process of moving away from having bits/mathinline.h
headers in glibc, leaving the compiler to inline functions as
appropriate depending on the options passed to it, this patch removes
the header for powerpc.
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88558> is the
corresponding GCC bug for adding replacements for these powerpc
(32-bit-only) lrint / lrintf inlines.

Tested with build-many-glibcs.py for its powerpc configurations.

	* sysdeps/powerpc/bits/mathinline.h: Remove.
2019-02-08 23:26:21 +00:00
Florian Weimer
eef4d4f80c math: Enable <bits/math-finite.h> sysdeps override
sysdeps/ia64/fpu/bits/math-finite.h exists and will be installed on
ia64, but during the build, the default math/bits/math-finite.h file
is used, which is wrong.

Fixes commit 0ac5ae2335 ("Optimize
libm").
2019-02-08 21:06:51 +01:00
Florian Weimer
fdfbd47d92 Move generic <bits/unistd_ext.h> to a more regular location
No functional change; the previous path worked as well, but it
re-added the obsolete sysdeps/generic/bits directory, which was
removed (for the first time) in commit
c72565e5f1.

Fixes commit e47d82c99a ("Provide
<bits/unistd_ext.h> as a sysdeps header exclusively").
2019-02-08 21:06:11 +01:00
Patsy Franklin
11eb21c465 nss: Add tst-nss-files-hosts-long test [BZ #21915]
When the /etc/hosts file has a line longer than 1028
characters getent ahostsv4 and ahostsv6 will fail.

This test performs a getent call on a /etc/hosts file that contains
a very long line (greater than 1028) using the test-in-container
framework.
2019-02-08 14:38:27 -05:00
Florian Weimer
e47d82c99a Provide <bits/unistd_ext.h> as a sysdeps header exclusively
Non-sysdeps headers cannot be overriden by sysdeps headers across the
entire build, so it is necessary to turn such extension headers into
sysdeps headers themselves.  The approach here follows the existing
<bits/shm.h> header (although it uses sysdeps/gnu instead of
sysdeps/generic).

Fixes commit 1d0fc21382 ("Linux: Add
gettid system call wrapper [BZ #6399]") and commit
8f89ab216f ("posix: Fix missing wrapper
header for <bits/unistd_ext.h>").
2019-02-08 16:51:17 +01:00
Florian Weimer
8f89ab216f posix: Fix missing wrapper header for <bits/unistd_ext.h>
Fixes commit 1d0fc21382
("Linux: Add gettid system call wrapper [BZ #6399]").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-08 16:33:37 +01:00
TAMUKI Shoichi
144a794e0a tst-strftime2: Use array_length macros instead of magic numbers
ChangeLog:

	* time/tst-strftime2.c: Use array_length macros instead of magic
	numbers.
2019-02-08 22:03:14 +09:00
Florian Weimer
669ff911e2 nptl: Avoid fork handler lock for async-signal-safe fork [BZ #24161]
Commit 27761a1042 ("Refactor atfork
handlers") introduced a lock, atfork_lock, around fork handler list
accesses.  It turns out that this lock occasionally results in
self-deadlocks in malloc/tst-mallocfork2:

(gdb) bt
#0  __lll_lock_wait_private ()
    at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:63
#1  0x00007f160c6f927a in __run_fork_handlers (who=(unknown: 209394016),
    who@entry=atfork_run_prepare) at register-atfork.c:116
#2  0x00007f160c6b7897 in __libc_fork () at ../sysdeps/nptl/fork.c:58
#3  0x00000000004027d6 in sigusr1_handler (signo=<optimized out>)
    at tst-mallocfork2.c:80
#4  sigusr1_handler (signo=<optimized out>) at tst-mallocfork2.c:64
#5  <signal handler called>
#6  0x00007f160c6f92e4 in __run_fork_handlers (who=who@entry=atfork_run_parent)
    at register-atfork.c:136
#7  0x00007f160c6b79a2 in __libc_fork () at ../sysdeps/nptl/fork.c:152
#8  0x0000000000402567 in do_test () at tst-mallocfork2.c:156
#9  0x0000000000402dd2 in support_test_main (argc=1, argv=0x7ffc81ef1ab0,
    config=config@entry=0x7ffc81ef1970) at support_test_main.c:350
#10 0x0000000000402362 in main (argc=<optimized out>, argv=<optimized out>)
    at ../support/test-driver.c:168

If no locking happens in the single-threaded case (where fork is
expected to be async-signal-safe), this deadlock is avoided.
(pthread_atfork is not required to be async-signal-safe, so a fork
call from a signal handler interrupting pthread_atfork is not
a problem.)
2019-02-08 12:46:19 +01:00
Florian Weimer
d0bd87d4c0 ChangeLog: Correct date of last commit 2019-02-08 12:44:48 +01:00
Florian Weimer
1d0fc21382 Linux: Add gettid system call wrapper [BZ #6399]
This commit adds gettid to <unistd.h> on Linux, and not to the
kernel-independent GNU API.

gettid is now supportable on Linux because too many things assume a
1:1 mapping between libpthread threads and kernel threads.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-08 11:27:55 +01:00
Florian Weimer
f289e656ec rt: Turn forwards from librt to libc into compat symbols [BZ #24194]
As the  result of commit 6e6249d0b4
("BZ#14743: Move clock_* symbols from librt to libc."), in glibc 2.17,
clock_gettime, clock_getres, clock_settime, clock_getcpuclockid,
clock_nanosleep were added to libc, and the file rt/clock-compat.c
was added with forwarders to the actual implementations in libc.
These forwarders were wrapped in

#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)

so that they are not present for newer architectures (such as
powerpc64le) with a 2.17 or later ABI baseline.  But the forwarders
were not marked as compatibility symbols.  As a result, on older
architectures, historic configure checks such as

AC_CHECK_LIB(rt, clock_gettime)

still cause linking against librt, even though this is completely
unnecessary.  It also creates a needless porting hazard because
architectures behave differently when it comes to symbol availability.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-08 10:43:17 +01:00
Stefan Liebler
823624bdc4 Add compiler barriers around modifications of the robust mutex list for pthread_mutex_trylock. [BZ #24180]
While debugging a kernel warning, Thomas Gleixner, Sebastian Sewior and
Heiko Carstens found a bug in pthread_mutex_trylock due to misordered
instructions:
140:   a5 1b 00 01             oill    %r1,1
144:   e5 48 a0 f0 00 00       mvghi   240(%r10),0   <--- THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
14a:   e3 10 a0 e0 00 24       stg     %r1,224(%r10) <--- last THREAD_SETMEM of ENQUEUE_MUTEX_PI

vs (with compiler barriers):
140:   a5 1b 00 01             oill    %r1,1
144:   e3 10 a0 e0 00 24       stg     %r1,224(%r10)
14a:   e5 48 a0 f0 00 00       mvghi   240(%r10),0

Please have a look at the discussion:
"Re: WARN_ON_ONCE(!new_owner) within wake_futex_pi() triggerede"
(https://lore.kernel.org/lkml/20190202112006.GB3381@osiris/)

This patch is introducing the same compiler barriers and comments
for pthread_mutex_trylock as introduced for pthread_mutex_lock and
pthread_mutex_timedlock by commit 8f9450a0b7
"Add compiler barriers around modifications of the robust mutex list."

ChangeLog:

	[BZ #24180]
	* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
2019-02-07 15:18:36 +01:00
Florian Weimer
8311c83f91 array_length: Make usable as a constant expression
Do not use a statement expression in array_length, so that
array_length can be used at file scope and as a constant expression.
Instead, put the _Static_assert into a struct (as a declaration),
and nest this in the expression using a sizeof expression.
2019-02-07 09:03:02 +01:00
Florian Weimer
94b63e6620 support: Implement xdlmopen
Put xdlmopen into its own file, to avoid disturbing static linking
tests (where dlmopen pulls in additional code).
2019-02-07 09:02:01 +01:00
Joseph Myers
c2d8f0b704 Avoid "inline" after return type in function definitions.
One group of warnings seen with -Wextra is warnings for static or
inline not at the start of a declaration (-Wold-style-declaration).

This patch fixes various such cases for inline, ensuring it comes at
the start of the declaration (after any static).  A common case of the
fix is "static inline <type> __always_inline"; the definition of
__always_inline starts with __inline, so the natural change is to
"static __always_inline <type>".  Other cases of the warning may be
harder to fix (one pattern is a function definition that gets
rewritten to be static by an including file, "#define funcname static
wrapped_funcname" or similar), but it seems worth fixing these cases
with inline anyway.

Tested for x86_64.

	* elf/dl-load.h (_dl_postprocess_loadcmd): Use __always_inline
	before return type, without separate inline.
	* elf/dl-tunables.c (maybe_enable_malloc_check): Likewise.
	* elf/dl-tunables.h (tunable_is_name): Likewise.
	* malloc/malloc.c (do_set_trim_threshold): Likewise.
	(do_set_top_pad): Likewise.
	(do_set_mmap_threshold): Likewise.
	(do_set_mmaps_max): Likewise.
	(do_set_mallopt_check): Likewise.
	(do_set_perturb_byte): Likewise.
	(do_set_arena_test): Likewise.
	(do_set_arena_max): Likewise.
	(do_set_tcache_max): Likewise.
	(do_set_tcache_count): Likewise.
	(do_set_tcache_unsorted_limit): Likewise.
	* nis/nis_subr.c (count_dots): Likewise.
	* nptl/allocatestack.c (advise_stack_range): Likewise.
	* sysdeps/ieee754/dbl-64/s_sin.c (do_cos): Likewise.
	(do_sin): Likewise.
	(reduce_sincos): Likewise.
	(do_sincos): Likewise.
	* sysdeps/unix/sysv/linux/x86/elision-conf.c
	(do_set_elision_enable): Likewise.
	(TUNABLE_CALLBACK_FNDECL): Likewise.
2019-02-06 17:16:43 +00:00
Florian Weimer
3b93559585 support: Use dlerror to detect NULL symbols in xdlsym 2019-02-06 16:45:25 +01:00
Florian Weimer
b433334065 x86: Remove unnecessary <stap-probe.h> include from lowlevellock.h
In the i386 case, it appears that the sole remaining LIBC_PROBE was
removed in commit a9fe4c5aa8 ("Support
six-argument syscalls from C for 32-bit x86, use generic
lowlevellock-futex.h (bug 18138)."), when
sysdeps/unix/sysv/linux/i386/lowlevellock-futex.h was replaced with
the generic version.

For x86_64, the relevant change is commit
76f71081cd ("Use generic
lowlevellock-futex.h in x86_64 lowlevellock.h."), again by using the
generic version of <lowlevellock-futex.h>.

Tested on i386 and x86_64, with and without --enable-systemtap.
2019-02-06 15:23:13 +01:00
Stefan Liebler
b6d8a999cd Fix wide char format specifier in libio/tst-bz24153.c.
On big endian systems the test fails with:
tst-bz24153.c:88: numeric comparison failure
   left: 1660944385 (0x63000001); from: ch
  right: 99 (0x63); from: L'c'
tst-bz24153.c:90: numeric comparison failure
   left: 1677721601 (0x64000001); from: ch
  right: 100 (0x64); from: L'd'
error: 2 test failures

One 'char' ("%c") is stored to the 'wchar_t *':
ch = 0x00000001 | 0x63000000

This patch is using "%lc" as format specifier to read a wchar_t.

ChangeLog:

	* libio/tst-bz24153.c (wide): Use wide char format specifier.
2019-02-06 12:29:02 +01:00
Stefan Liebler
94eeeec04b S390: Fix introduction of __wmemcmp and weak wmemcmp symbols.
The recent commit 65f7767a91
has introduced __wmemcmp and the weak alias wmemcmp.
This patch also introduces those symbols if glibc is build
with CFLAGS="-march=z13" where the ifunc is omitted.

ChangeLog:

	* sysdeps/s390/wmemcmp-vx.S: Add strong alias to
	__wmemcmp and weak alias to wmemcmp.
2019-02-06 09:10:31 +01:00
Stefan Liebler
bc79db3fd4 Fix alignment of TLS variables for tls variant TLS_TCB_AT_TP [BZ #23403]
The alignment of TLS variables is wrong if accessed from within a thread
for architectures with tls variant TLS_TCB_AT_TP.
For the main thread the static tls data is properly aligned.
For other threads the alignment depends on the alignment of the thread
pointer as the static tls data is located relative to this pointer.

This patch adds this alignment for TLS_TCB_AT_TP variants in the same way
as it is already done for TLS_DTV_AT_TP. The thread pointer is also already
properly aligned if the user provides its own stack for the new thread.

This patch extends the testcase nptl/tst-tls1.c in order to check the
alignment of the tls variables and it adds a pthread_create invocation
with a user provided stack.
The test itself is migrated from test-skeleton.c to test-driver.c
and the missing support functions xpthread_attr_setstack and xposix_memalign
are added.

ChangeLog:

	[BZ #23403]
	* nptl/allocatestack.c (allocate_stack): Align pointer pd for
	TLS_TCB_AT_TP tls variant.
	* nptl/tst-tls1.c: Migrate to support/test-driver.c.
	Add alignment checks.
	* support/Makefile (libsupport-routines): Add xposix_memalign and
	xpthread_setstack.
	* support/support.h: Add xposix_memalign.
	* support/xthread.h: Add xpthread_attr_setstack.
	* support/xposix_memalign.c: New File.
	* support/xpthread_attr_setstack.c: Likewise.
2019-02-06 09:06:34 +01:00
Florian Weimer
f1ac745583 arm: Use "nr" constraint for Systemtap probes [BZ #24164]
With the default "nor" constraint, current GCC will use the "o"
constraint for constants, after emitting the constant to memory.  That
results in unparseable Systemtap probe notes such as "-4@.L1052".
Removing the "o" alternative and using "nr" instead avoids this.
2019-02-05 13:01:08 +01:00
Joseph Myers
77dc0d8643 Fix assertion in malloc.c:tcache_get.
One of the warnings that appears with -Wextra is "ordered comparison
of pointer with integer zero" in malloc.c:tcache_get, for the
assertion:

  assert (tcache->entries[tc_idx] > 0);

Indeed, a "> 0" comparison does not make sense for
tcache->entries[tc_idx], which is a pointer.  My guess is that
tcache->counts[tc_idx] is what's intended here, and this patch changes
the assertion accordingly.

Tested for x86_64.

	* malloc/malloc.c (tcache_get): Compare tcache->counts[tc_idx]
	with 0, not tcache->entries[tc_idx].
2019-02-04 23:46:58 +00:00
Joseph Myers
7a0dcfc643 Remove duplicate initialization of field in nscd.
I'm looking at the warnings from building glibc with -Wextra, to see
if we could use -Wextra by default, possibly with a few of its
warnings disabled, and so benefit from warnings in -Wextra but not in
-Wall.  (The vast bulk of the extra warnings so produced are from
-Wunused-parameter -Wsign-compare -Wmissing-field-initializers
-Wtype-limits, so I expect those would be disabled at least at first.)

Various miscellaneous warnings show up with -Wextra that it clearly
seems to make sense to fix independent of whether we add -Wextra to
the normal options for building glibc.  This patch fixes one:
"initialized field overwritten [-Woverride-init]" in nscd.

Tested for x86_64.

	* nscd/connections.c (reqinfo): Initialize SHUTDOWN element only
	once.
2019-02-04 14:49:37 +00:00
Andreas Schwab
65f7767a91 Fix handling of collating elements in fnmatch (bug 17396, bug 16976)
This fixes the same bug in fnmatch that was fixed by commit 7e2f0d2d77 for
regexp matching.  As a side effect it also removes the use of an unbound
VLA.
2019-02-04 15:45:02 +01:00
H.J. Lu
3f635fb433 x86-64 memcmp: Use unsigned Jcc instructions on size [BZ #24155]
Since the size argument is unsigned. we should use unsigned Jcc
instructions, instead of signed, to check size.

Tested on x86-64 and x32, with and without --disable-multi-arch.

	[BZ #24155]
	CVE-2019-7309
	* NEWS: Updated for CVE-2019-7309.
	* sysdeps/x86_64/memcmp.S: Use RDX_LP for size.  Clear the
	upper 32 bits of RDX register for x32.  Use unsigned Jcc
	instructions, instead of signed.
	* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memcmp-2.
	* sysdeps/x86_64/x32/tst-size_t-memcmp-2.c: New test.
2019-02-04 06:31:13 -08:00
Florian Weimer
2ab5741b8a <spawn.h>: Add missing nonnull attributes and __restrict qualifiers
For consistency with execve, the __argv arguments are not marked
nonnull.
2019-02-04 14:37:05 +01:00
David Newall
8692ebdb12 elf: Implement --preload option for the dynamic linker 2019-02-04 13:35:12 +01:00
Matthew Malcomson
5e10136b3c testrun.sh: Exit in case of incorrect argument 2019-02-04 13:06:15 +01:00
Florian Weimer
221baae001 time: Avoid alignment gaps in __tzfile_read
By ordering the suballocations by decreasing alignment, alignment
gaps can be avoided.

Also use __glibc_unlikely for reading the transitions and type
indexes.  In the 8-byte case, two reads are now needed because the
transitions and type indexes are no longer adjacent.  The separate
call to __fread_unlocked does not matter from a performance point of
view because __tzfile_read is only invoked rarely.
2019-02-04 10:01:29 +01:00
Florian Weimer
b8c7238167 time: Use struct alloc_buffer in __tzfile_read
The computation of tzspec_len is moved in front of the total_size
computation, so that the allocation size computation and the
suballocations are next to each other.  Also add an assert that
tzspec_len is positive when it is actually used later.
2019-02-03 22:14:33 +01:00
Aurelien Jarno
11f382ee78 testsuite: stdlib/isomac.c: add missing include
When running the testsuite, building stdlib/isomac.c outputs the
following warning:

  gcc -O   -D_GNU_SOURCE -DIS_IN_build -include /home/aurel32/glibc-build/config.h isomac.c -o /home/aurel32/glibc-build/stdlib/isomac
  isomac.c: In function ‘get_null_defines’:
  isomac.c:260:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
     close (fd);
     ^~~~~
     pclose

Fix that by adding the <unistd.h> include.

Changelog:
	* stdlib/isomac.c: Include <unistd.h>.
2019-02-03 15:17:18 +01:00
Florian Weimer
77c7d55ece time: Use int, not long int, for internal GMT offsets
The GMT offset can be outside the range of a 16-bit int type, which
is presumably the reason why long int was used in struct tm.  We
cannot change struct tm, but we can change the internal type for
the offset.
2019-02-03 09:55:41 +01:00
Florian Weimer
ee9941f94e libio: Use stdin consistently for input functions [BZ #24153]
The internal _IO_stdin_ variable is not updated when the application
assigns to stdin, which is a GNU extension.
2019-02-03 09:38:24 +01:00
Florian Weimer
c70824b9a4 manual: Document lack of conformance of sched_* functions [BZ #14829]
On Linux, we define _POSIX_PRIORITY_SCHEDULING, but functions such
as sched_setparam and sched_setscheduler apply to individual threads,
not processes.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-02-02 14:15:27 +01:00
Joseph Myers
4dcbbc3b28 Require GCC 6.2 or later to build glibc.
As discussed during development for glibc 2.29, when we increased the
required minimum GCC version for building glibc to GCC 5, working
purely based on the times at which such requirements have been
increased in the past it would be appropriate for glibc 2.30 to
require GCC 6 (matching GCC 4.9 having been required for glibc 2.26).
Naming 6.2 specifically as the minimum version then means a separate
version requirement no longer needs to be specified for powerpc64le.

Thus, this patch increases the minimum to 6.2, removing the
documentation of the separate requirement for powerpc64le.  It does
not remove the powerpc64le configure test, or any __GNUC_PREREQ that
could be removed as not being in installed headers or files shared
with gnulib; I think such cleanups are best done separately.

Tested for x86_64.

	* configure.ac (libc_cv_compiler_ok): Require GCC 6.2 or later.
	* configure: Regenerated.
	* manual/install.texi (Tools for Compilation): Update minimum GCC
	version.
	* INSTALL: Regenerated.
2019-02-01 16:27:44 +00:00
Florian Weimer
6175507c06 support: Correct error message for TEST_COMPARE_STRING
It should say "string", not "blob".
2019-02-01 14:15:50 +01:00
Florian Weimer
baef194387 support: Handle AF_LOCAL, AF_UNSPEC in support_format_address_family 2019-02-01 14:15:50 +01:00
Florian Weimer
395599f0cf manual: Update struct sockaddr_in, struct sockaddr_sin6 description
Clarify the byte order of the the struct fields and document
sin6_flowinfo and sin6_scope_id.
2019-02-01 14:15:50 +01:00
Wilco Dijkstra
b06f4c0094 Cleanup clock_*time includes
Clock_gettime, settime and getres implementations are unncessarily
complex due to using defines and C file inclusion.  Simplify the
code by replacing the redundant defines and removing the inclusion,
making it much easier to understand.  No functional changes.

	* sysdeps/posix/clock_getres.c (__clock_getres): Cleanup.
	* sysdeps/unix/clock_gettime.c (__clock_gettime): Cleanup.
	* sysdeps/unix/clock_settime.c (__clock_settime): Cleanup.
	* sysdeps/unix/sysv/linux/clock_getres.c (__clock_getres): Cleanup.
	* sysdeps/unix/sysv/linux/clock_gettime.c (__clock_gettime): Cleanup.
	* sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime): Cleanup.
2019-02-01 12:24:52 +00:00
Feng Xue
83d1cc42d8 aarch64: Optimized memchr specific to AmpereComputing emag
This version uses general register based memory instruction to load
data, because vector register based is slightly slower in emag.

Character-matching is performed on 16-byte (both size and alignment)
memory block in parallel each iteration.

    * sysdeps/aarch64/memchr.S (__memchr): Rename to MEMCHR.
    [!MEMCHR](MEMCHR): Set to __memchr.
    * sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
    Add memchr_generic and memchr_nosimd.
    * sysdeps/aarch64/multiarch/ifunc-impl-list.c
    (__libc_ifunc_impl_list): Add memchr ifuncs.
    * sysdeps/aarch64/multiarch/memchr.c: New file.
    * sysdeps/aarch64/multiarch/memchr_generic.S: Likewise.
    * sysdeps/aarch64/multiarch/memchr_nosimd.S: Likewise.
2019-02-01 08:14:21 -05:00
Feng Xue
c7d3890ff5 aarch64: Optimized memset specific to AmpereComputing emag
This version uses general register based memory store instead of
vector register based, for the former is faster than the latter
in emag.

The fact that DC ZVA size in emag is 64-byte, is used by IFUNC
dispatch to select this memset, so that cost of runtime-check on
DC ZVA size can be saved.

    * sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
    Add memset_emag.
    * sysdeps/aarch64/multiarch/ifunc-impl-list.c
    (__libc_ifunc_impl_list): Add __memset_emag to memset ifunc.
    * sysdeps/aarch64/multiarch/memset.c (libc_ifunc):
    Add IS_EMAG check for ifunc dispatch.
    * sysdeps/aarch64/multiarch/memset_base64.S: New file.
    * sysdeps/aarch64/multiarch/memset_emag.S: New file.
2019-02-01 07:59:18 -05:00
Feng Xue
07c3d1ec03 aarch64: Add AmpereComputing emag to tunable cpu list
Emag is a 64-bit CPU core released by AmpereComputing.

Add its name to cpu list, and corresponding macro as utilities for
later IFUNC dispatch.

    * manual/tunables.texi (Tunable glibc.cpu.name): Add emag.
    * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list):
    Add emag.
    * sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_EMAG):
    New macro.
2019-02-01 07:59:18 -05:00
Stefan Liebler
114f792eae posix/tst-spawn: Fix racy tests in spawned processes.
From time to time I get fails in tst-spawn like:
tst-spawn.c:111: numeric comparison failure
   left: 0 (0x0); from: xlseek (fd2, 0, SEEK_CUR)
  right: 28 (0x1c); from: strlen (fd2string)
error: 1 test failures
tst-spawn.c:252: numeric comparison failure
   left: 1 (0x1); from: WEXITSTATUS (status)
  right: 0 (0x0); from: 0
error: 1 test failures

It turned out, that a child process is testing it's open file descriptors
with e.g. a sequence of testing the current position, setting the position
to zero and reading a specific amount of bytes.

Unfortunately starting with commit 2a69f853c0
the test is spawning a second child process which is sharing some of the
file descriptors.  If the test sequence as mentioned above is running in parallel
it leads to test failures.

As the second call of posix_spawn shall test a NULL pid argument,
this patch is just moving the waitpid of the first child
before the posix_spawn of the second child.

ChangeLog:

	* posix/tst-spawn do_test(): Move waitpid before posix_spawn.
2019-02-01 11:03:35 +01:00
Vineet Gupta
d5627550ae make-syscalls.sh: fix comment referencing syscall-template 2019-01-31 22:45:10 -05:00
Carlos O'Donell
5fc9ed4c40 nptl: Fix pthread_rwlock_try*lock stalls (Bug 23844)
For a full analysis of both the pthread_rwlock_tryrdlock() stall
and the pthread_rwlock_trywrlock() stall see:
https://sourceware.org/bugzilla/show_bug.cgi?id=23844#c14

In the pthread_rwlock_trydlock() function we fail to inspect for
PTHREAD_RWLOCK_FUTEX_USED in __wrphase_futex and wake the waiting
readers.

In the pthread_rwlock_trywrlock() function we write 1 to
__wrphase_futex and loose the setting of the PTHREAD_RWLOCK_FUTEX_USED
bit, again failing to wake waiting readers during unlock.

The fix in the case of pthread_rwlock_trydlock() is to check for
PTHREAD_RWLOCK_FUTEX_USED and wake the readers.

The fix in the case of pthread_rwlock_trywrlock() is to only write
1 to __wrphase_futex if we installed the write phase, since all other
readers would be spinning waiting for this step.

We add two new tests, one exercises the stall for
pthread_rwlock_trywrlock() which is easy to exercise, and one exercises
the stall for pthread_rwlock_trydlock() which is harder to exercise.

The pthread_rwlock_trywrlock() test fails consistently without the fix,
and passes after. The pthread_rwlock_tryrdlock() test fails roughly
5-10% of the time without the fix, and passes all the time after.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Torvald Riegel <triegel@redhat.com>
Signed-off-by: Rik Prohaska <prohaska7@gmail.com>
Co-authored-by: Torvald Riegel <triegel@redhat.com>
Co-authored-by: Rik Prohaska <prohaska7@gmail.com>
2019-01-31 20:47:55 -05:00
Joseph Myers
932329a513 Use MPFR 4.0.2 in build-many-glibcs.py.
* scripts/build-many-glibcs.py (Context.checkout): Default MPFR
	version to 4.0.2.
2019-02-01 00:11:37 +00:00
Paul Pluzhnikov
5f10701fdc libio: use stdout in puts and putchar, etc [BZ #24051].
GLIBC explicitly allows one to assign a new FILE pointer to stdout and
other standard streams.  printf and wprintf were honouring assignment to
stdout and using the new value, but puts, putchar, and wide char variants
did not.

The stdout part is fixed here.  The stdin part will be fixed in a followup.
2019-01-31 14:07:45 -08:00
Paul Eggert
583dd860d5 regex: fix read overrun [BZ #24114]
Problem found by AddressSanitizer, reported by Hongxu Chen in:
https://debbugs.gnu.org/34140
* posix/regexec.c (proceed_next_node):
Do not read past end of input buffer.
2019-01-31 13:18:56 -08:00
Florian Weimer
2bac7daa58 nss_files: Fix /etc/aliases null pointer dereference [BZ #24059]
If /etc/aliases ends with a continuation line (a line that starts
with whitespace) which does not have a trailing newline character,
the file parser would crash due to a null pointer dereference.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-01-31 18:49:58 +01:00
Siddhesh Poyarekar
de44ab67aa Open master for 2.30 development 2019-01-31 22:39:14 +05:30
Siddhesh Poyarekar
56c86f5dd5 Tag 2.29 release
* version.h (RELEASE): Set to "stable".
	(VERSION): Set to "2.29".
	* include/features.h (__GLIBC_MINOR__): Set to 2.29.
2019-01-31 22:15:36 +05:30
Siddhesh Poyarekar
330c9d0db1 Prepare for 2.29 release
* NEWS: Add the list of bugs fixed in 2.29.
	* manual/contrib.texi: Update contributors list with some more
	names.
 	* manual/install.texi: Update latest versions of packages
 	tested.
 	* INSTALL: Regenerated.
2019-01-31 22:01:21 +05:30
Siddhesh Poyarekar
e1e47c912a Update translations
Update translations from translationproject.org for 2.28.9000.
2019-01-25 22:05:42 +05:30
Samuel Thibault
b96e22d080 hurd: Fix initial sigaltstack state
Previous commit fixed
[BZ #24110]
2019-01-24 20:16:23 +01:00