]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
6 years agoAdd NT_ARM_SVE to elf.h
Alan Hayward [Fri, 12 Jan 2018 16:56:19 +0000 (16:56 +0000)] 
Add NT_ARM_SVE to elf.h

This definition is for AArch64 SVE registers in elf core dumps.

* elf/elf.h (NT_ARM_SVE): Define.

6 years agonptl: Add PTHREAD_MIN_STACK C++ throw test [BZ #22636]
Florian Weimer [Mon, 15 Jan 2018 14:30:00 +0000 (15:30 +0100)] 
nptl: Add PTHREAD_MIN_STACK C++ throw test [BZ #22636]

6 years agoUpdate build-many-glibcs.py binutils, mpfr, mpc versions.
Joseph Myers [Mon, 15 Jan 2018 14:02:54 +0000 (14:02 +0000)] 
Update build-many-glibcs.py binutils, mpfr, mpc versions.

* scripts/build-many-glibcs.py (Context.checkout): Default
binutils version to 2.30 branch, MPFR version to 4.0.0 and MPC
version to 1.1.0.

6 years agoSynchronize DF_1_* flags with binutils (Bug 22707)
Carlos O'Donell [Sun, 14 Jan 2018 04:21:57 +0000 (20:21 -0800)] 
Synchronize DF_1_* flags with binutils (Bug 22707)

This patch synchronizes DF_1_* flags with binutils
and ensures that all DF_1_* flags defined in binutil's
include/elf/common.h are also defined glibc's elf/elf.h.
This is a user visible change since elf/elf.h is installed
by default as /usr/include/elf.h.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
6 years agopowerpc: Fix llround spurious inexact on 32-bit POWER4 [BZ #22697]
Tulio Magno Quites Machado Filho [Fri, 12 Jan 2018 22:39:42 +0000 (20:39 -0200)] 
powerpc: Fix llround spurious inexact on 32-bit POWER4 [BZ #22697]

This issue is similar to BZ #19235, where spurious exceptions are
created from adding 0.5 then converting to an integer.
The solution is based on Joseph's fix for BZ #19235.

[BZ #22697]
* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S (__llround):
Do not add 0.5 to integer or out-of-range arguments.

6 years agoUpdate translations from the Translation Project
Dmitry V. Levin [Thu, 11 Jan 2018 15:00:00 +0000 (15:00 +0000)] 
Update translations from the Translation Project

* po/bg.po: Update translations.
* po/cs.po: Likewise.
* po/de.po: Likewise.
* po/ko.po: Likewise.
* po/pl.po: Likewise.
* po/sv.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.

6 years agoaarch64: fix static pie enabled libc when main is in a shared library
Szabolcs Nagy [Tue, 19 Dec 2017 18:43:04 +0000 (18:43 +0000)] 
aarch64: fix static pie enabled libc when main is in a shared library

In the static pie enabled libc, crt1.o uses the same position independent
code as rcrt1.o and crt1.o is used instead of Scrt1.o when -no-pie
executables are linked.  When main is not defined in the executable, but
in a shared library crt1.o is currently broken, it assumes main is local.
(glibc has a test for this but i missed it in my previous testing.)

To make both rcrt1.o and crt1.o happy with the same code, a wrapper is
introduced around main: with this crt1.o works with extern main symbol
while rcrt1.o does not depend on GOT relocations. (The change only
affects static pie enabled libc. Further simplification of start.S is
possible in the future by using the same approach for Scrt1.o too.)

* aarch64/start.S (_start): Use __wrap_main.
(__wrap_main): New local symbol.

6 years agolinux: make getcwd(3) fail if it cannot obtain an absolute path [BZ #22679]
Dmitry V. Levin [Sun, 7 Jan 2018 02:03:41 +0000 (02:03 +0000)] 
linux: make getcwd(3) fail if it cannot obtain an absolute path [BZ #22679]

Currently getcwd(3) can succeed without returning an absolute path
because the underlying getcwd syscall, starting with linux commit
v2.6.36-rc1~96^2~2, may succeed without returning an absolute path.

This is a conformance issue because "The getcwd() function shall
place an absolute pathname of the current working directory
in the array pointed to by buf, and return buf".

This is also a security issue because a non-absolute path returned
by getcwd(3) causes a buffer underflow in realpath(3).

Fix this by checking the path returned by getcwd syscall and falling
back to generic_getcwd if the path is not absolute, effectively making
getcwd(3) fail with ENOENT.  The error code is chosen for consistency
with the case when the current directory is unlinked.

[BZ #22679]
CVE-2018-1000001
* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Fall back to
generic_getcwd if the path returned by getcwd syscall is not absolute.
* io/tst-getcwd-abspath.c: New test.
* io/Makefile (tests): Add tst-getcwd-abspath.

6 years agomalloc: Ensure that the consolidated fast chunk has a sane size.
Istvan Kurucsai [Fri, 12 Jan 2018 14:26:20 +0000 (15:26 +0100)] 
malloc: Ensure that the consolidated fast chunk has a sane size.

6 years agosupport: Preserve errno in write_message, TEST_VERIFY and other checks
Florian Weimer [Fri, 12 Jan 2018 07:18:30 +0000 (08:18 +0100)] 
support: Preserve errno in write_message, TEST_VERIFY and other checks

These facilities could clobber errno, which makes it difficult to write
certain checks because a specific order has to be used.

6 years agoAdd missing reference to bug 20532
Florian Weimer [Fri, 12 Jan 2018 11:15:38 +0000 (12:15 +0100)] 
Add missing reference to bug 20532

6 years agolibnsl: Do not install libnsl.so, libnsl.a if NIS is disabled [BZ #22701]
Florian Weimer [Fri, 12 Jan 2018 07:42:56 +0000 (08:42 +0100)] 
libnsl: Do not install libnsl.so, libnsl.a if NIS is disabled [BZ #22701]

This also skips building the .o files for libnsl.a.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agohu_HU locale: Avoid double space (bug 22657).
Egmont Koblinger [Mon, 1 Jan 2018 20:40:11 +0000 (20:40 +0000)] 
hu_HU locale: Avoid double space (bug 22657).

The current date format prefixes one-digit days with a space, resulting
in ugly two spaces:

$ LC_ALL=hu_HU.UTF-8 date
2018. jan.  1., hétfő, 21:25:35 CET
          ^^

The official orthography rules doesn't contain an explicit rule about
this (which already gives no sane reason for double space), and an
implicit example of "1848. március 9." under bullet point 296 at
http://helyesiras.mta.hu/helyesiras/default/akh12 contains a single
space only. It's sure not convincing on an HTML page, but I confirm
that the official book edition (e.g.
https://www.libri.hu/en/konyv/a-magyar-helyesiras-szabalyai-32.html)
also contains a single space there.

[BZ #22657]
* localedata/locales/hu_HU (d_t_fmt): Avoid a leading space
before the day number which may produce a double space.
(date_fmt): Likewise.

6 years agoFix s390 linknamespace fallout of bug 22702 patch.
Joseph Myers [Fri, 12 Jan 2018 00:12:57 +0000 (00:12 +0000)] 
Fix s390 linknamespace fallout of bug 22702 patch.

My fix for bug 22702 introduced linknamespace test failures on
s390x-linux-gnu and s390-linux-gnu because it made remainder call
__feholdexcept, and the s390 __feholdexcept calls fegetenv, and
remainder is in Unix98 and XPG4.2 but fegetenv isn't.  This patch
makes __feholdexcept call __fegetenv instead to avoid that namespace
issue.

Tested (compilation) with build-many-glibcs.py for s390x-linux-gnu,
where it resolves the test failures.

* sysdeps/s390/fpu/feholdexcpt.c (__feholdexcept): Call __fegetenv
instead of fegetenv.

6 years agoMake default libc_feholdsetround_noex_ctx use __feholdexcept (bug 22702).
Joseph Myers [Thu, 11 Jan 2018 18:18:46 +0000 (18:18 +0000)] 
Make default libc_feholdsetround_noex_ctx use __feholdexcept (bug 22702).

For soft-float powerpc, the math/test-nearbyint-except-2 test fails
because nearbyintl traps when traps on "inexact" are enabled on entry
(and an "inexact" exception is generated internally, though cleared
for the final return).

The problem is the default implementation of
libc_feholdsetround_noex_ctx, which does not disable exception traps.
There is some ambiguity about whether the *noex* interfaces are
required to do so or only permitted to do so.  But given that we
support fe* interfaces to enable and disable traps (on architectures
with that functionality), functions that must not raise an exception
(must not leave the flag set on exit if not set on entry) should also
not trap on it when traps on that exception are enabled.  So it is
appropriate to define these interfaces to have the feholdexcept effect
of disabling exception traps; this patch updates the default
implementation and comments accordingly.

At least some architecture versions already disable traps; there are
few uses of the *noex* interfaces at all, and while it's possible
there are bugs on any architecture versions failing to disable traps
that appear in the exp2 and remainder implementations, there are
currently no tests, other than this one for nearbyintl (where only the
ldbl-128ibm implementation uses SET_RESTORE_ROUND_NOEX), that would
fail as a result of such a bug.  (Hard-float powerpc does disable
traps here, hence the nearbyintl failure not appearing there.)

Tested for powerpc (soft-float).  This brings that configuration to
clean math/ test results, provided you build with GCC 8 to get the fix
for GCC bug 64811.

[BZ #22702]
* sysdeps/generic/math_private.h (libc_feresetround_noex): Update
comment to say exceptions are discarded.
(libc_feholdsetround_noex_ctx): Use __feholdexcept instead of
__fegetenv.
(SET_RESTORE_ROUND_NOEX): Update comment to say non-stop mode must
be enabled.

6 years agocsu: Update __libgcc_s_init comment
Florian Weimer [Thu, 11 Jan 2018 12:13:28 +0000 (13:13 +0100)] 
csu: Update __libgcc_s_init comment

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agonptl: Add tst-minstack-cancel, tst-minstack-exit [BZ #22636]
Florian Weimer [Thu, 11 Jan 2018 12:13:14 +0000 (13:13 +0100)] 
nptl: Add tst-minstack-cancel, tst-minstack-exit [BZ #22636]

I verified that without the guard accounting change in commit
630f4cc3aa019ede55976ea561f1a7af2f068639 (Fix stack guard size
accounting) and RTLD_NOW for libgcc_s introduced by commit
f993b8754080ac7572b692870e926d8b493db16c (nptl: Open libgcc.so with
RTLD_NOW during pthread_cancel), the tst-minstack-cancel test fails on
an AVX-512F machine.  tst-minstack-exit still passes, and either of
the mentioned commit by itself frees sufficient stack space to make
tst-minstack-cancel pass, too.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agoFix ldbl-128ibm log1pl (-qNaN) spurious "invalid" exception (bug 22693).
Joseph Myers [Wed, 10 Jan 2018 17:59:01 +0000 (17:59 +0000)] 
Fix ldbl-128ibm log1pl (-qNaN) spurious "invalid" exception (bug 22693).

The ldbl-128ibm implementation of log1pl does ordered comparisons on a
negative qNaN argument, so resulting in spurious "invalid" exceptions
(for soft-float powerpc; hard-float only avoids this because of GCC
bug 58684 meaning ordered comparison instructions never get
generated).  This patch fixes this by arranging for the test for NaN
or infinity arguments to handle negative arguments as well.

Tested for powerpc (soft float).

[BZ #22693]
* sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Handle
negative arguments in test for NaN or infinity argument.

6 years agoRegenerate libc.pot
Dmitry V. Levin [Wed, 10 Jan 2018 15:00:00 +0000 (15:00 +0000)] 
Regenerate libc.pot

6 years agonptl: Open libgcc.so with RTLD_NOW during pthread_cancel [BZ #22636]
Florian Weimer [Wed, 10 Jan 2018 12:18:04 +0000 (13:18 +0100)] 
nptl: Open libgcc.so with RTLD_NOW during pthread_cancel [BZ #22636]

Disabling lazy binding reduces stack usage during unwinding.

Note that RTLD_NOW only makes a difference if libgcc.so has not
already been loaded, so this is only a partial fix.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agohurd: Implement faccessat without AT_EACCESS flag
Samuel Thibault [Wed, 10 Jan 2018 00:58:23 +0000 (01:58 +0100)] 
hurd: Implement faccessat without AT_EACCESS flag

* hurd/hurd/fd.h: Include <fcntl.h>
(__hurd_at_flags): New function.
* hurd/lookup-at.c (__file_name_lookup_at): Replace flag computation
with call to __hurd_at_flags.
* include/unistd.h (__faccessat, __faccessat_noerrno): Add declaration.
* sysdeps/mach/hurd/access.c (access_common): Move implementation to
__faccessat
(hurd_fail_seterrno, hurd_fail_noerrno): Move to sysdeps/mach/hurd/faccessat.c.
(__access_noerrno): Use __faccessat_common instead of access_common.
(__access): Likewise.
* sysdeps/mach/hurd/euidaccess.c (__euidaccess): Replace implementation
with a call to __faccessat.
* sysdeps/mach/hurd/faccessat.c (faccessat): Rename into...
(__faccessat_common): ... this. Move implementation of __access into it when
AT_FLAGS does not contain AT_EACCESS. Make it call __hurd_at_flags, add
reauthenticate_cwdir_at helper to implement AT mechanism.
(__faccessat_noerrno): New function, just calls __faccessat_common.
(__faccessat): New function, just calls __faccessat_common.
(faccessat): Define weak alias.

6 years agoFix powerpc-nofpu fmaxmagl, fminmagl spurious "invalid" exception (bug 22691).
Joseph Myers [Wed, 10 Jan 2018 00:38:12 +0000 (00:38 +0000)] 
Fix powerpc-nofpu fmaxmagl, fminmagl spurious "invalid" exception (bug 22691).

For soft-float powerpc, fmaxmagl and fminmagl generate spurious
"invalid" exceptions for quiet NaN arguments.  This is another case of
the problems with fabsl inline expansion via comparisons, and so is
fixed by building those functions with -fno-builtin-fabsl.

Tested for powerpc (soft-float).

[BZ #22691]
* sysdeps/powerpc/nofpu/Makefile [$(subdir) = math]
(CFLAGS-s_fmaxmagl.c): New variable.
[$(subdir) = math] (CFLAGS-s_fminmagl.c: Likewise.

6 years agoFix ldbl-128ibm lrintl, lroundl missing "invalid" exceptions (bug 22690).
Joseph Myers [Wed, 10 Jan 2018 00:02:35 +0000 (00:02 +0000)] 
Fix ldbl-128ibm lrintl, lroundl missing "invalid" exceptions (bug 22690).

The ldbl-128ibm implementations of lrintl and lroundl are missing
"invalid" exceptions for certain overflow cases when compiled with GCC
8.  The cause of this is after-the-fact integer overflow checks that
fail when the compiler optimizes on the basis of integer overflow
being undefined; GCC 8 must be able to detect new cases of
undefinedness here.

Failure: lrint (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_downward (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_towardzero (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_upward (-0x80000001p0): Exception "Invalid operation" not set

Failure: lround (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_downward (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_towardzero (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_upward (-0x80000001p0): Exception "Invalid operation" not set

(Tested that these failures occur before the patch for powerpc
soft-float, but the issue applies in principle for hard-float as well,
whether or not the particular optimizations in fact occur there at
present.)

This patch fixes the bug by ensuring the additions / subtractions in
question cast arguments to unsigned long int, or use 1UL as a constant
argument, so that the arithmetic occurs in an unsigned type with the
result then converted back to a signed type.

Tested for powerpc (soft-float).

[BZ #22690]
* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c (__lrintl): Use unsigned
long int for arguments of possibly overflowing addition or
subtraction.
* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c (__lroundl): Likewise.

6 years agoFix powerpc-nofpu remainderl wrong sign of zero result (bug 22688).
Joseph Myers [Tue, 9 Jan 2018 23:14:45 +0000 (23:14 +0000)] 
Fix powerpc-nofpu remainderl wrong sign of zero result (bug 22688).

For soft-float powerpc, the remainderl function produces zero results
with the wrong sign for various inputs.  This is another instance of
the problem with incorrect built-in fabsl expansion, so is fixed by
this patch using -fno-builtin-fabsl for this function.

Tested for powerpc (soft-float).

[BZ #22688]
* sysdeps/powerpc/nofpu/Makefile [$(subdir) = math]
(CFLAGS-e_remainderl.c): New variable.

6 years agoFix powerpc-nofpu complex long double functions spurious "invalid" exception (bug...
Joseph Myers [Tue, 9 Jan 2018 22:34:35 +0000 (22:34 +0000)] 
Fix powerpc-nofpu complex long double functions spurious "invalid" exception (bug 22687).

For soft-float powerpc, various _Complex long double functions
generate spurious "invalid" exceptions, even with a compiler with GCC
bug 64811 fixed.

The problem is GCC's built-in fabsl expansion.  Various files are
already built with -fno-builtin-fabsl because in this case (IBM long
double, for soft-float or e500v1) a fallback fabsl expansion based on
comparisons is used, which can produce the wrong sign of a zero
result.  Those comparisons can also produce spurious exceptions for
NaN arguments.  Furthermore, __builtin_fpclassify implemently uses
__builtin_fabsl, and is unaffected by -fno-builtin-fabsl, and the
fpclassify macro uses __builtin_fpclassify in the absence of
-fsignaling-nans.  Thus, this patch arranges for the problem files
using fpclassify to be built with -fsignaling-nans in this case, to
avoid spurious exceptions from fpclassify.

Tested for powerpc (soft-float).

[BZ #22687]
* sysdeps/powerpc/nofpu/Makefile (CFLAGS-s_cacosl.c): New
variable.
(CFLAGS-s_cacoshl.c): Likewise.
(CFLAGS-s_casinhl.c): Likewise.
(CFLAGS-s_catanl.c): Likewise.
(CFLAGS-s_catanhl.c): Likewise.
(CFLAGS-s_cexpl.c): Likewise.
(CFLAGS-s_ccoshl.c): Add -fsignaling-nans.
(CFLAGS-s_csinhl.c): Likewise.
(CFLAGS-s_clogl.c): Likewise.
(CFLAGS-s_clog10l.c): Likewise.
(CFLAGS-s_csinl.c): Likewise.
(CFLAGS-s_csqrtl.c): Likewise.

6 years agohurd: Use the new file_exec_paths RPC
Samuel Thibault [Tue, 9 Jan 2018 00:36:58 +0000 (01:36 +0100)] 
hurd: Use the new file_exec_paths RPC

From: Emilio Pozuelo Monfort <pochu27@gmail.com>
From: Svante Signell <svante.signell@gmail.com>

Pass the file paths of executable to the exec server, both relative and
absolute, which exec needs to properly execute and avertise #!-scripts.
Previously, the exec server tried to guess the name from argv[0] but argv[0]
only contains the executable name by convention.

* hurd/hurdexec.c (_hurd_exec): Deprecate function.
(_hurd_exec_paths): New function.
* hurd/hurd.h (_hurd_exec): Deprecate function.
(_hurd_exec_paths): Declare function.
* hurd/Versions: Export _hurd_exec_paths.
* sysdeps/mach/hurd/execve.c: Include <stdlib.h> and <stdio.h>
(__execve): Use __getcwd to build absolute path, and use
_hurd_exec_paths instead of _hurd_exec.
* sysdeps/mach/hurd/spawni.c: Likewise.
* sysdeps/mach/hurd/fexecve.c: Use _hurd_exec_paths instead of
_hurd_exec.

6 years agotst-ttyname: skip the test when /dev/ptmx is not available
Dmitry V. Levin [Mon, 25 Dec 2017 02:30:32 +0000 (02:30 +0000)] 
tst-ttyname: skip the test when /dev/ptmx is not available

* sysdeps/unix/sysv/linux/tst-ttyname.c (do_in_chroot_1): Skip the
test instead of failing in case of ENOENT returned by posix_openpt.

6 years agoresolv: Support binary labels in test framework
Florian Weimer [Mon, 8 Jan 2018 13:33:17 +0000 (14:33 +0100)] 
resolv: Support binary labels in test framework

The old implementation based on hsearch_r used an ad-hoc C string
encoding and produced an incorrect format on the wire for domain
names which contained bytes which needed escaping when printed.

This commit switches to ns_name_pton for the wire format conversion
(now that we have separate tests for it) and uses a tsearch tree
with a suitable comparison function to locate compression targets.

6 years agosupport: Increase usability of TEST_COMPARE
Florian Weimer [Mon, 8 Jan 2018 12:01:36 +0000 (13:01 +0100)] 
support: Increase usability of TEST_COMPARE

The previous implementation of the TEST_COMPARE macro would fail
to compile code like this:

  int ret = res_send (query, sizeof (query), buf, sizeof (buf));
  TEST_COMPARE (ret,
                sizeof (query)
                + 2             /* Compression reference.  */
                + 2 + 2 + 4 + 2 /* Type, class, TTL, RDATA length.  */
                + 1             /* Pascal-style string length.  */
                + strlen (expected_name));

This resulted in a failed static assertion, "integer conversions
may alter sign of operands".  A user of the TEST_COMPARE would have
to add a cast to fix this.

This patch reverts to the original proposed solution of a run-time
check, making TEST_COMPARE usable for comparisons of numbers with
types with different signedness in more contexts.

6 years ago[BZ #22637] Fix stack guard size accounting
Szabolcs Nagy [Wed, 6 Dec 2017 13:05:50 +0000 (13:05 +0000)] 
[BZ #22637] Fix stack guard size accounting

Previously if user requested S stack and G guard when creating a
thread, the total mapping was S and the actual available stack was
S - G - static_tls, which is not what the user requested.

This patch fixes the guard size accounting by pretending the user
requested S+G stack.  This way all later logic works out except
when reporting the user requested stack size (pthread_getattr_np)
or when computing the minimal stack size (__pthread_get_minstack).

Normally this will increase thread stack allocations by one page.
TLS accounting is not affected, that will require a separate fix.

[BZ #22637]
* nptl/descr.h (stackblock, stackblock_size): Update comments.
* nptl/allocatestack.c (allocate_stack): Add guardsize to stacksize.
* nptl/nptl-init.c (__pthread_get_minstack): Remove guardsize from
stacksize.
* nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.

6 years agox86-64: Add sincosf with vector FMA
H.J. Lu [Mon, 8 Jan 2018 16:04:26 +0000 (08:04 -0800)] 
x86-64: Add sincosf with vector FMA

Since the x86-64 assembly version of sincosf is higly optimized with
vector instructions, there isn't much room for improvement.  However
s_sincosf.c written in C with vector math and intrinsics can be
optimized by GCC with FMA.

On Skylake, bench-sincosf reports performance improvement:

           Assembly       FMA         improvement
max        104.042       101.008         3%
min        9.426         8.586           10%
mean       20.6209       18.2238         13%

* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
Add s_sincosf-sse2 and s_sincosf-fma.
(CFLAGS-s_sincosf-fma.c): New.
* sysdeps/x86_64/fpu/multiarch/s_sincosf-fma.c: New file.
* sysdeps/x86_64/fpu/multiarch/s_sincosf-sse2.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_sincosf.c: Likewise.
* sysdeps/x86_64/fpu/s_sincosf.S: Don't add alias if
__sincosf is defined.

6 years agonptl: Add test for callee-saved register restore in pthread_exit
Florian Weimer [Mon, 8 Jan 2018 13:57:25 +0000 (14:57 +0100)] 
nptl: Add test for callee-saved register restore in pthread_exit

GCC PR 83641 results in a miscompilation of libpthread, which
causes pthread_exit not to restore callee-saved registers before
running destructors for objects on the stack.  This test detects
this situation:

info: unsigned int, direct pthread_exit call
tst-thread-exit-clobber.cc:80: numeric comparison failure
   left: 4148288912 (0xf741dd90); from: value
  right: 1600833940 (0x5f6ac994); from: magic_values.v2
info: double, direct pthread_exit call
info: unsigned int, indirect pthread_exit call
info: double, indirect pthread_exit call
error: 1 test failures

6 years agosupport: Define support_static_assert for use with C and C++
Florian Weimer [Mon, 8 Jan 2018 13:39:51 +0000 (14:39 +0100)] 
support: Define support_static_assert for use with C and C++

And update TEST_COMPARE to use it, to make it usable from C++.

6 years agogetrlimit64: fix for 32-bit configurations with default version >= 2.2
Aurelien Jarno [Sun, 7 Jan 2018 19:33:26 +0000 (20:33 +0100)] 
getrlimit64: fix for 32-bit configurations with default version >= 2.2

Commit 24731685 ("prlimit: Translate old_rlimit from RLIM64_INFINITY to
RLIM_INFINITY") broken the getrlimit64 for 32-bit configurations which
do no need the 2GiB limited compat getrlimit (default version >= 2.2).

This patch fixes that by restoring the weak alias in that case.

Changelog:
* sysdeps/unix/sysv/linux/getrlimit64 (getrlimit64)
[!__RLIM_T_MATCHES_RLIM64_T]
[!SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_2)]: Define as weak alias of
__getrlimit64. Add libc_hidden_weak.

6 years agohurd: Fix pwritev*
Samuel Thibault [Sun, 7 Jan 2018 12:31:36 +0000 (13:31 +0100)] 
hurd: Fix pwritev*

This follows c45d78aac ('posix: Fix generic p{read,write}v buffer allocation
(BZ#22457)'), which made pwritev to use __mmap instead of __posix_memalign,
but didn't pass PROT_READ to it, while the pwrite() call does need to
read the data we have just copied over.

* sysdeps/posix/pwritev_common.c: Add PROT_READ to __mmap prot.

6 years agoAvoid race conditions when rebuilding librt.so
Palmer Dabbelt [Wed, 27 Dec 2017 04:56:44 +0000 (20:56 -0800)] 
Avoid race conditions when rebuilding librt.so

`make check' sometimes triggers a rebuild of librt.so using
nptl/Makefile, which ignores librt's dependence on libpthread.  This
causes the build to blow up when we attempt to run the test suite on
RISC-V.

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

        * nptl/Makefile (/librt.so): Always depend on
        "$(shared-thread-library)".

6 years agoStrip shared objects in subdirectories of lib
Palmer Dabbelt [Sat, 6 Jan 2018 07:18:40 +0000 (23:18 -0800)] 
Strip shared objects in subdirectories of lib

The RISC-V port will have libraries in subdirectories of lib, like
"lib64/lp64d".  This adds support for stripping these installed
libraries.

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

       * scripts/build-many-glibcs.py (class Glibc): Strip shared objects
       in subdirectories of lib.

6 years agoAdd linux-4.15 VDSO hash for RISC-V
Palmer Dabbelt [Wed, 27 Dec 2017 04:52:42 +0000 (20:52 -0800)] 
Add linux-4.15 VDSO hash for RISC-V

The RISC-V Linux port defines VDSO symbols

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

       * sysdeps/unix/sysv/linux/dl-vdso.h (VDSO_NAME_LINUX_4_15): New
       define.
       (VDSO_HASH_LINUX_4_15): Likewise.

6 years agoAllow make-link-multidir to make subdirectories
Palmer Dabbelt [Wed, 27 Dec 2017 04:55:34 +0000 (20:55 -0800)] 
Allow make-link-multidir to make subdirectories

The RISC-V Linux ABI doesn't define any libraries that go directly in
lib, instead they go into lib32/ilp32 or lib64/lp64.  This casuse
make-link-multidir to fail when attempting to make library directories
when building a static libc on multilib RISC-V systems.

This patch uses scripts/mkinstalldirs to make the base directory of the
target symlink of make-link-multidir.

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

       * Makerules (make-link-multidir): Make directories before linking into
       them.

6 years agoAdd RISC-V dynamic relocations to elf.h
Palmer Dabbelt [Wed, 27 Dec 2017 04:52:36 +0000 (20:52 -0800)] 
Add RISC-V dynamic relocations to elf.h

These relocations can appear in shared objects on RISC-V ELF systems.

2018-01-06  Palmer Dabbelt  <palmer@sifive.com>

       * elf/elf.h (R_RISCV_NONE): New define.
       (R_RISCV_32): Likewise.
       (R_RISCV_64): Likewise.
       (R_RISCV_RELATIVE): Likewise.
       (R_RISCV_COPY): Likewise.
       (R_RISCV_JUMP_SLOT): Likewise.
       (R_RISCV_TLS_DTPMOD32): Likewise.
       (R_RISCV_TLS_DTPMOD64): Likewise.
       (R_RISCV_TLS_DTPREL32): Likewise.
       (R_RISCV_TLS_DTPREL64): Likewise.
       (R_RISCV_TLS_TPREL32): Likewise.
       (R_RISCV_TLS_TPREL64): Likewise.

6 years agohurd: Fix glob64 compatibility symbols
Samuel Thibault [Sat, 6 Jan 2018 21:28:36 +0000 (22:28 +0100)] 
hurd: Fix glob64 compatibility symbols

This follows ccf970c7a ('posix: Add compat glob symbol to not follow
dangling symbols') by adding to gnu/ the same compatibility as for Linux.

* sysdeps/gnu/glob64.c (__glob): Define macro instead of glob macro.
(__glob64): Define GLIBC_2_27 versioned symbol instead of glob64.
* sysdeps/gnu/glob-lstat-compat.c: New file.
* sysdeps/gnu/glob64-lstat-compat.c: New file.

6 years agohurd: Fix posix glob test
Samuel Thibault [Sat, 6 Jan 2018 21:19:13 +0000 (22:19 +0100)] 
hurd: Fix posix glob test

* posix/tst-glob_symlinks.c [!PATH_MAX]: Define PATH_MAX macro.

6 years agoi386: Regenerate libm-test-ulps for for gcc 7 on i686
Samuel Thibault [Sat, 6 Jan 2018 21:09:42 +0000 (22:09 +0100)] 
i386: Regenerate libm-test-ulps for for gcc 7 on i686

* sysdeps/i386/fpu/libm-test-ulps: Regenerated for GCC 7 with
"-O2 -march=i686".

6 years agohurd: Fix build without NO_HIDDEN
Samuel Thibault [Sat, 6 Jan 2018 17:18:49 +0000 (18:18 +0100)] 
hurd: Fix build without NO_HIDDEN

* sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_dynamic) [NO_RTLD_HIDDEN]: Call
JUMPTARGET (___tls_get_addr) instead of HIDDEN_JUMPTARGET (___tls_get_addr).
* sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Likewise.

6 years agohurd: Add jmp_buf-macros.h
Samuel Thibault [Sat, 6 Jan 2018 01:27:44 +0000 (02:27 +0100)] 
hurd: Add jmp_buf-macros.h

* sysdeps/mach/hurd/i386/jmp_buf-macros.h: New file.

6 years agopowerpc: Fix error message during relocation overflow
Tulio Magno Quites Machado Filho [Fri, 5 Jan 2018 20:34:09 +0000 (18:34 -0200)] 
powerpc: Fix error message during relocation overflow

The function _itoa_word() writes characters from the higher address to
the lower address, requiring the destination string to reserve that size
before calling it.

* sysdeps/powerpc/powerpc64/dl-machine.c (_dl_reloc_overflow):
Reserve 16 chars to reloc_addr before calling _itoa_word.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoresource/tst-getrlimit.c: Add copyright header
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)] 
resource/tst-getrlimit.c: Add copyright header

The initial year is based on the date in the original ChangeLog entry
(2005-06-21).

6 years agoAdd test for getrlimit/setrlimit/prlimit with infinity value
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)] 
Add test for getrlimit/setrlimit/prlimit with infinity value

Add a test to check that the getrlimit, setrlimit and prlimit functions
and their 64-bit equivalent behave correctly with RLIM_INFINITY and
RLIM64_INFINITY. For that it assumes that the prlimit64 function calls
the syscall directly without translating the value and that the kernel
uses the -1 value to represent infinity.

It first finds a resource with the hard limit set to infinity so the
soft limit can be manipulated easily and check for the consistency
between the value set or get by the prlimit64 and the other functions.

It is Linux specific add it uses the prlimit and prlimit64 functions.

Changelog:
* sysdeps/unix/sysv/linux/tst-rlimit-infinity.c: New file.
* sysdeps/unix/sysv/linux/Makefile (tests): Add tst-rlimit-infinity.

6 years agoprlimit: Translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY [BZ #22678]
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)] 
prlimit: Translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY [BZ #22678]

prlimit called without a new value fails on 32-bit machines if any of
the soft or hard limits are infinity. This is because prlimit does not
translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY, but checks
that the value returned by the prlimit64 syscall fits into a 32-bit
value, like it is done for example in getrlimit. Note that on the
other hand new_rlimit is correctly translated from RLIM_INFINITY to
RLIM64_INFINITY before calling the syscall.

This patch fixes that.

Changelog:
[BZ #22678]
* sysdeps/unix/sysv/linux/prlimit.c (prlimit): Translate
old_rlimit from RLIM64_INFINITY to RLIM_INFINITY.

6 years agoAlpha: Fix the RLIM_INFINITY and RLIM64_INFINITY constants
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)] 
Alpha: Fix the RLIM_INFINITY and RLIM64_INFINITY constants

Fix the RLIM_INFINITY and RLIM64_INFINITY constants on alpha to match
the kernel one and all other architectures. Change the getrlimit,
getrlimit64, setrlimit, setrlimit64 into old compat symbols, and provide
the Linux generic functions as GLIBC_2_27 version.

Changelog:
* sysdeps/unix/sysv/linux/getrlimit64.c [USE_VERSIONED_RLIMIT]: Do not
define getrlimit and getrlimit64 as weak aliases of __getrlimit64.
Define __GI_getrlimit64 as weak alias of __getrlimit64.
[__RLIM_T_MATCHES_RLIM64_T]: Do not redefine SHLIB_COMPAT, use #elif
instead.
* sysdeps/unix/sysv/linux/setrlimit64.c [USE_VERSIONED_RLIMIT]: Do not
define setrlimit and setrlimit64 as weak aliases of __setrlimit64.
* sysdeps/unix/sysv/linux/alpha/bits/resource.h (RLIM_INFINITY,
RLIM64_INFINITY): Fix values to match the kernel ones.
* sysdeps/unix/sysv/linux/alpha/getrlimit64.c: Define
USE_VERSIONED_RLIMIT.  Rename __getrlimit64 into __old_getrlimit64 and
provide it as getrlimit@@GLIBC_2_0 and getrlimit64@@GLIBC_2_1.  Add a
__getrlimit64 function and provide it as getrlimit@@GLIBC_2_27 and
getrlimit64@@GLIBC_2_27.
* sysdeps/unix/sysv/linux/alpha/setrlimit64.c: Ditto with setrlimit
and setrlimit64.
* sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.27): Add
getrlimit, setrlimit, getrlimit64 and setrlimit64.
* sysdeps/unix/sysv/linux/alpha/Versions (libc): Add getrlimit,
setrlimit, getrlimit64 and setrlimit64.

6 years agoAlpha: Add wrappers to get/setrlimit64 to fix RLIM64_INFINITY constant [BZ #22648]
Aurelien Jarno [Fri, 5 Jan 2018 19:34:10 +0000 (20:34 +0100)] 
Alpha: Add wrappers to get/setrlimit64 to fix RLIM64_INFINITY constant [BZ #22648]

RLIM64_INFINITY was supposed to be a glibc convention rather than
anything seen by the kernel, but it ended being passed to the kernel
through the prlimit64 syscall.

* On the kernel side, the value is defined for the prlimit64 syscall for
  all architectures in include/uapi/linux/resource.h:

  #define RLIM64_INFINITY           (~0ULL)

* On the kernel side, the value is defined for getrlimit and setrlimit
  in arch/alpha/include/uapi/asm/resource.h

  #define RLIM_INFINITY            0x7ffffffffffffffful

* On the GNU libc side, the value is defined in
  sysdeps/unix/sysv/linux/alpha/bits/resource.h:

  # define RLIM64_INFINITY 0x7fffffffffffffffLL

This was not an issue until the getrlimit and setrlimit glibc functions
have been changed in commit 045c13d185 ("Consolidate Linux setrlimit and
getrlimit implementation") to use the prlimit64 syscall instead of the
getrlimit and setrlimit ones.

This patch fixes that by adding a wrapper to fix the value passed to or
received from the kernel, before or after calling the prlimit64 syscall.

Changelog:
[BZ #22648]
* sysdeps/unix/sysv/linux/alpha/getrlimit64.c: New file.
* sysdeps/unix/sysv/linux/alpha/setrlimit64.c: Ditto.

6 years agoNEWS: Deprecate static dlopen
Florian Weimer [Fri, 5 Jan 2018 12:57:54 +0000 (13:57 +0100)] 
NEWS: Deprecate static dlopen

6 years agoNEWS: Deprecate direct access libio internals
Florian Weimer [Fri, 5 Jan 2018 12:57:48 +0000 (13:57 +0100)] 
NEWS: Deprecate direct access libio internals

6 years agoIncrease some test timeouts.
Joseph Myers [Thu, 4 Jan 2018 21:58:40 +0000 (21:58 +0000)] 
Increase some test timeouts.

This patch increases timeouts on three tests I observed timing out on
slow systems.

* malloc/tst-malloc-tcache-leak.c (TIMEOUT): Define to 50.
* posix/tst-glob-tilde.c (TIMEOUT): Define to 200.
* resolv/tst-resolv-res_ninit.c (TIMEOUT): Define to 50.

6 years agoalpha: Remove s_trunc{f} implementation (BZ#22666)
Adhemerval Zanella [Wed, 3 Jan 2018 19:03:48 +0000 (17:03 -0200)] 
alpha: Remove s_trunc{f} implementation (BZ#22666)

As discussed in libc-alpha [1], alpha trunc{f} implementation uses
addt/suc and subt/suc and although the Alpha Architecture
Handbook version 3 states that that ADDx SUBx OUTPUT Exceptions
(B.3 Mapping to IEEE Standard) should not generate Inexact if INE
bit is set, the Alpha 21264 [2] chip manual (A.8 IEEE Floating-Point
Conformance) states that ADDx SUBx OUTPUT does generate inexact
exception for inexact result regardless.

As Joseph noted [3] to correctly fix it on alpha we need to either
avoid the instruction or avoid any inexact bit from it being set
on return from the function (while preserving the inexact bit that
might be set on the entry to the function).  The later will result
mf_fpcr followed by a mt_fpcr to get and set the fpcr which will
defeat the optimization itself.

So the patch just remove the alpha optimized and rely on generic
implementation.  It fixes the math/test-*-{trunc} on alpha.

        [BZ #15479]
        [BZ #22666]
        * sysdeps/alpha/fpu/s_trunc.c: Remove file.
        * sysdeps/alpha/fpu/s_truncf.c: Likewise.

[1] https://sourceware.org/ml/libc-alpha/2018-01/msg00114.html
[2] https://www.star.bnl.gov/public/daq/HARDWARE/21264_data_sheet.pdf
[3] https://sourceware.org/ml/libc-alpha/2018-01/msg00086.html

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoalpha: Remove s_ceil{f} and s_floor{f} implementation (BZ#22665)
Adhemerval Zanella [Wed, 3 Jan 2018 17:36:53 +0000 (15:36 -0200)] 
alpha: Remove s_ceil{f} and s_floor{f} implementation (BZ#22665)

As discussed in libc-alpha [1], alpha ceil{f} and floor{f}
implementation uses cvttq/svm and although the Alpha Architecture
Handbook version 3 states that that CVTfi OUTPUT Exceptions
(B.3 Mapping to IEEE Standard) should not generate Inexact if INE
bit is set on fpcr, the Alpha 21264 [1] chip manual (A.8 IEEE
Floating-Point Conformance) states that CVTfi and CVTif OUTPUT
does generate inexact exception for inexact result regardless.

As Joseph noted [2] to correctly fix it on alpha we need to either
avoid the instruction or avoid any inexact bit from it being set
on return from the function (while preserving the inexact bit that
might be set on the entry to the function).  The later will result
mf_fpcr followed by a mt_fpcr to get and set the fpcr which will
defeat the optimization itself.

So the patch just remove the alpha optimized and rely on generic
implementation.  It fixes the math/test-*-{ceil,floor} on alpha.

[BZ #15479]
[BZ #22665]
* sysdeps/alpha/fpu/s_ceil.c: Remove file.
* sysdeps/alpha/fpu/s_ceilf.c: Likewise.
* sysdeps/alpha/fpu/s_floor.c: Likewise.
* sysdeps/alpha/fpu/s_floorf.c: Likewise.

[1] https://www.star.bnl.gov/public/daq/HARDWARE/21264_data_sheet.pdf
[2] https://sourceware.org/ml/libc-alpha/2018-01/msg00086.html

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agoi386: In makecontext, align the stack before calling exit [BZ #22667]
Florian Weimer [Thu, 4 Jan 2018 17:00:05 +0000 (18:00 +0100)] 
i386: In makecontext, align the stack before calling exit [BZ #22667]

Before this change, if glibc was compiled with SSE instructions and a
sufficiently recent GCC, an unaligned stack access in
__run_exit_handlers would cause stdlib/tst-makecontext to crash.

6 years agoelf: Support dlvsym within libc.so
Florian Weimer [Thu, 4 Jan 2018 17:46:17 +0000 (18:46 +0100)] 
elf: Support dlvsym within libc.so

This commit adds a new _dl_open_hook entry for dlvsym and implements the
function using the existing dl_lookup_symbol_x function supplied by the
dynamic loader.

A new hook variable, _dl_open_hook2, is introduced, which should make
this change suitable for backporting: For old statically linked
binaries, __libc_dlvsym will always return NULL.

6 years agosupport_enter_mount_namespace: Fix indentation
Samuel Thibault [Thu, 4 Jan 2018 14:11:41 +0000 (15:11 +0100)] 
support_enter_mount_namespace: Fix indentation

* support/support_enter_mount_namespace.c: Fix indentation.

6 years agoMention CVE-2017-16997 in ChangeLog
Florian Weimer [Thu, 4 Jan 2018 12:39:21 +0000 (13:39 +0100)] 
Mention CVE-2017-16997 in ChangeLog

6 years agohurd: Fix support/support_enter_mount_namespace.c build
Samuel Thibault [Wed, 3 Jan 2018 23:54:13 +0000 (00:54 +0100)] 
hurd: Fix support/support_enter_mount_namespace.c build

* support/support_enter_mount_namespace.c [!CLONE_NEWNS]: Do not
include <sys/mount.h>.

6 years agoImprove math_errhandling
Wilco Dijkstra [Wed, 3 Jan 2018 13:14:10 +0000 (13:14 +0000)] 
Improve math_errhandling

Currently math_errhandling is always set to MATH_ERRNO | MATH_ERREXCEPT
even if -fno-math-errno is used.  It is not defined at all when fast-math
is used.  Set it to 0 with fast-math - this is noncomforming but more
useful than not define math_errhandling at all. Also take __NO_MATH_ERRNO__
into account and update comment.

* math/math.h (math_errhandling): Set to 0 with __FAST_MATH__.
Add __NO_MATH_ERRNO__ check.

6 years agoUpdate MIPS libm-test-ulps.
Joseph Myers [Tue, 2 Jan 2018 21:55:15 +0000 (21:55 +0000)] 
Update MIPS libm-test-ulps.

* sysdeps/mips/mips32/libm-test-ulps: Update.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.

6 years agomisc/tst-pselect.c: Add copyright header
Florian Weimer [Tue, 2 Jan 2018 21:07:43 +0000 (22:07 +0100)] 
misc/tst-pselect.c: Add copyright header

The initial year is based on the date in the original ChangeLog entry
(2006-01-21).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agoSimplify getrlimit64.c
Aurelien Jarno [Tue, 2 Jan 2018 20:05:29 +0000 (21:05 +0100)] 
Simplify getrlimit64.c

Changelog:
* sysdeps/unix/sysv/linux/alpha/getrlimit64.c (__old_getrlimit64):
Drop __RLIM_T_MATCHES_RLIM64_T conditional as __old_getrlimit64 is
never defined in that case.

6 years agoFix typos in getrlimit64.c and setrlimit64.c
Aurelien Jarno [Tue, 2 Jan 2018 20:05:29 +0000 (21:05 +0100)] 
Fix typos in getrlimit64.c and setrlimit64.c

Changelog:
* sysdeps/unix/sysv/linux/alpha/getrlimit64.c: Fix a typo in the
comment.
* sysdeps/unix/sysv/linux/alpha/setrlimit64.c: Fix a typo in the
comment.
(settrlimit): Rename into setrlimit.
(__sttrlimit): Rename into __setrlimit.

6 years agoUpdate powerpc-nofpu libm-test-ulps.
Joseph Myers [Tue, 2 Jan 2018 18:38:45 +0000 (18:38 +0000)] 
Update powerpc-nofpu libm-test-ulps.

* sysdeps/powerpc/nofpu/libm-test-ulps: Update.

6 years agoUpdate ARM libm-test-ulps.
Joseph Myers [Tue, 2 Jan 2018 18:37:06 +0000 (18:37 +0000)] 
Update ARM libm-test-ulps.

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

6 years agoReduce command length in regen-ulps.
Joseph Myers [Tue, 2 Jan 2018 18:33:18 +0000 (18:33 +0000)] 
Reduce command length in regen-ulps.

I found that "make regen-ulps" failed when building with unmodified
GNU make 4.1, and an objdir /some/where/math/ longer than about 37
characters, because the list of tests in the "for run in $^" loop
exceeded the Linux kernel's MAX_ARG_STRLEN limit (131072 bytes) on the
length of a single argument passed to a command.

Some GNU/Linux distributions have a patch to make to work around this
limit (see e.g. Debian bug 688601), but clearly this ought to work
without needing such a patch.  This patch arranges for the shell loop
to be over the test names without a $(objdir) prefix, which reduces
the space used to less than half MAX_ARG_STRLEN.

(I think we ought to aim to get rid of bits/mathinline.h completely -
filing GCC bugs for any optimizations GCC can't currently do with
-ffast-math - which would mean we could halve the number of libm tests
run because separate inline function tests would no longer be needed.
However, with a long directory name even half the number of tests
could make this command exceed MAX_ARG_STRLEN without my patch.)

Tested regen-ulps on a system where it failed before this patch.

* math/Makefile (run-regen-ulps): Add $(objpfx) to test name here.
(regen-ulps): Use $(libm-tests) not $^ in shell loop.

6 years agoUpdate NEWS to add cosf and sincosf optimization
Rajalakshmi Srinivasaraghavan [Tue, 2 Jan 2018 16:19:49 +0000 (21:49 +0530)] 
Update NEWS to add cosf and sincosf optimization

6 years agoRemove alpha specific fmax, fmin to fix sNaN handling [BZ #22660]
Aurelien Jarno [Tue, 2 Jan 2018 08:55:48 +0000 (09:55 +0100)] 
Remove alpha specific fmax, fmin to fix sNaN handling [BZ #22660]

Various fmax and fmin function implementations mishandle sNaN
arguments:

(a) When both arguments are NaNs, the return value should be a qNaN,
but sometimes it is an sNaN if at least one argument is an sNaN.

(b) Under TS 18661-1 semantics, if either argument is an sNaN then the
result should be a qNaN (whereas if one argument is a qNaN and the
other is not a NaN, the result should be the non-NaN argument).
Various implementations treat sNaNs like qNaNs here.

One way to fix that is to detect the sNaN and add a special case. That
said there is no FPU instruction to do that, so it requires transfering
the FP value to an integer register and testing bits. This becomes quite
complicated so it's probably better to just use the generic versions of
these functions which just do that through issignaling.

Changelog:
[BZ #22660]
* sysdeps/alpha/fpu/s_fmax.S: Remove file.
* sysdeps/alpha/fpu/s_fmaxf.S: Likewise.
* sysdeps/alpha/fpu/s_fmin.S: Likewise.
* sysdeps/alpha/fpu/s_fminf.S: Likewise.

6 years agolinux/arm: sync sys/ptrace.h with Linux 4.15 [BZ #22433]
Dmitry V. Levin [Fri, 29 Dec 2017 23:19:32 +0000 (23:19 +0000)] 
linux/arm: sync sys/ptrace.h with Linux 4.15 [BZ #22433]

Clone generic linux/sys/ptrace.h, remove x86-specific PTRACE_GETFPXREGS
and PTRACE_SETFPXREGS constants, add the following arm-specific
__ptrace_request constants: PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS,
PTRACE_GET_THREAD_AREA, PTRACE_SET_SYSCALL, PTRACE_GETCRUNCHREGS,
PTRACE_SETCRUNCHREGS, PTRACE_GETVFPREGS, PTRACE_SETVFPREGS,
PTRACE_GETHBPREGS, PTRACE_SETHBPREGS, and PTRACE_GETFDPIC.

Tested with strace.

* sysdeps/unix/sysv/linux/arm/sys/ptrace.h: New file.

6 years agoelf: check for rpath emptiness before making a copy of it
Dmitry V. Levin [Wed, 27 Dec 2017 22:12:51 +0000 (22:12 +0000)] 
elf: check for rpath emptiness before making a copy of it

* elf/dl-load.c (decompose_rpath): Check for rpath emptiness before
making a copy of it.

6 years agoUpdate miscellaneous files from upstream sources.
Joseph Myers [Mon, 1 Jan 2018 18:05:06 +0000 (18:05 +0000)] 
Update miscellaneous files from upstream sources.

This patch updates various files from their upstream sources.  This
brings in copyright date updates for some of those files.

Tested for x86_64.

* manual/texinfo.tex: Update to version 2017-12-26.21 with
trailing whitespace removed.
* scripts/config.guess: Update to version 2018-01-01.
* scripts/config.sub: Update to version 2018-01-01.
* scripts/move-if-change: Update from gnulib.

6 years agoRemove accidentally-committed junk file dev/null
Zack Weinberg [Mon, 1 Jan 2018 01:12:01 +0000 (17:12 -0800)] 
Remove accidentally-committed junk file dev/null

6 years agoUpdate copyright dates not handled by scripts/update-copyrights.
Joseph Myers [Mon, 1 Jan 2018 00:41:16 +0000 (00:41 +0000)] 
Update copyright dates not handled by scripts/update-copyrights.

I've updated copyright dates in glibc for 2018.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.

Please remember to include 2018 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).

* NEWS: Update copyright dates.
* catgets/gencat.c (print_version): Likewise.
* csu/version.c (banner): Likewise.
* debug/catchsegv.sh: Likewise.
* debug/pcprofiledump.c (print_version): Likewise.
* debug/xtrace.sh (do_version): Likewise.
* elf/ldconfig.c (print_version): Likewise.
* elf/ldd.bash.in: Likewise.
* elf/pldd.c (print_version): Likewise.
* elf/sotruss.sh: Likewise.
* elf/sprof.c (print_version): Likewise.
* iconv/iconv_prog.c (print_version): Likewise.
* iconv/iconvconfig.c (print_version): Likewise.
* locale/programs/locale.c (print_version): Likewise.
* locale/programs/localedef.c (print_version): Likewise.
* login/programs/pt_chown.c (print_version): Likewise.
* malloc/memusage.sh (do_version): Likewise.
* malloc/memusagestat.c (print_version): Likewise.
* malloc/mtrace.pl: Likewise.
* manual/libc.texinfo: Likewise.
* nptl/version.c (banner): Likewise.
* nscd/nscd.c (print_version): Likewise.
* nss/getent.c (print_version): Likewise.
* nss/makedb.c (print_version): Likewise.
* posix/getconf.c (main): Likewise.
* scripts/test-installation.pl: Likewise.
* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.

6 years agoUpdate copyright dates with scripts/update-copyrights.
Joseph Myers [Mon, 1 Jan 2018 00:32:25 +0000 (00:32 +0000)] 
Update copyright dates with scripts/update-copyrights.

* All files with FSF copyright notices: Update copyright dates
using scripts/update-copyrights.
* locale/programs/charmap-kw.h: Regenerated.
* locale/programs/locfile-kw.h: Likewise.

6 years agoCorrect improper-inclusion check in bits/libio-ldbl.h.
Zack Weinberg [Sun, 31 Dec 2017 16:50:34 +0000 (08:50 -0800)] 
Correct improper-inclusion check in bits/libio-ldbl.h.

The patch which moved libio.h proper into the bits directory also
changed the name of its guard macro, and I neglected to check whether
anything depended on that name.  It turns out that there is a
conditionally-used bits header that looks at it; this broke the libgcc
build on at least sparc64-*-* and sparcv9-*-*.

* libio/bits/libio-ldbl.h: Correct check for improper
inclusion.  Add own multiple include guard.

6 years agoelf: Check for empty tokens before dynamic string token expansion [BZ #22625]
Aurelien Jarno [Sat, 30 Dec 2017 09:54:23 +0000 (10:54 +0100)] 
elf: Check for empty tokens before dynamic string token expansion [BZ #22625]

The fillin_rpath function in elf/dl-load.c loops over each RPATH or
RUNPATH tokens and interprets empty tokens as the current directory
("./"). In practice the check for empty token is done *after* the
dynamic string token expansion. The expansion process can return an
empty string for the $ORIGIN token if __libc_enable_secure is set
or if the path of the binary can not be determined (/proc not mounted).

Fix that by moving the check for empty tokens before the dynamic string
token expansion. In addition, check for NULL pointer or empty strings
return by expand_dynamic_string_token.

The above changes highlighted a bug in decompose_rpath, an empty array
is represented by the first element being NULL at the fillin_rpath
level, but by using a -1 pointer in decompose_rpath and other functions.

Changelog:
[BZ #22625]
* elf/dl-load.c (fillin_rpath): Check for empty tokens before dynamic
string token expansion. Check for NULL pointer or empty string possibly
returned by expand_dynamic_string_token.
(decompose_rpath): Check for empty path after dynamic string
token expansion.

6 years agolinux/x86: sync sys/ptrace.h with Linux 4.14 [BZ #22433]
Dmitry V. Levin [Wed, 27 Dec 2017 00:54:38 +0000 (00:54 +0000)] 
linux/x86: sync sys/ptrace.h with Linux 4.14 [BZ #22433]

Clone generic linux/sys/ptrace.h, add the following x86-specific
__ptrace_request constants: PTRACE_GET_THREAD_AREA,
PTRACE_SET_THREAD_AREA, PTRACE_ARCH_PRCTL, PTRACE_SYSEMU,
PTRACE_SYSEMU_SINGLESTEP, and PTRACE_SINGLEBLOCK.

[BZ #22433]
* sysdeps/unix/sysv/linux/x86/sys/ptrace.h: New file.

6 years agolinux: update sys/ptrace.h comments
Dmitry V. Levin [Wed, 27 Dec 2017 00:54:38 +0000 (00:54 +0000)] 
linux: update sys/ptrace.h comments

* sysdeps/unix/sysv/linux/sys/ptrace.h (__ptrace_request): Add comments
about PTRACE_PEEKSIGINFO, PTRACE_GETSIGMASK, PTRACE_SETSIGMASK, and
PTRACE_SECCOMP_GET_FILTER.  Update comments about PTRACE_SINGLESTEP
and PTRACE_SYSCALL.
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/s390/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/tile/sys/ptrace.h: Likewise.

6 years agolinux: move a shared part of sys/ptrace.h to bits/ptrace-shared.h
Dmitry V. Levin [Wed, 27 Dec 2017 00:54:38 +0000 (00:54 +0000)] 
linux: move a shared part of sys/ptrace.h to bits/ptrace-shared.h

Move a shared part of sys/ptrace.h which is the same on all
architectures to a separate file.

* sysdeps/unix/sysv/linux/sys/ptrace.h: Include <bits/ptrace-shared.h>.
(__ptrace_setoptions, __ptrace_eventcodes, __ptrace_peeksiginfo_args,
__ptrace_peeksiginfo_flags, ptrace): Move to ...
* sysdeps/unix/sysv/linux/bits/ptrace-shared.h: ... new file.
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
bits/ptrace-shared.h.
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h: Include
<bits/ptrace-shared.h>.
(__ptrace_setoptions, __ptrace_eventcodes, __ptrace_peeksiginfo_args,
__ptrace_peeksiginfo_flags, ptrace): Remove.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/s390/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/tile/sys/ptrace.h: Likewise.

6 years agoscandir: fix wrong assumption about errno [BZ #17804]
Aurelien Jarno [Fri, 29 Dec 2017 13:44:57 +0000 (14:44 +0100)] 
scandir: fix wrong assumption about errno [BZ #17804]

malloc and realloc may set errno to ENOMEM even if they are successful.
The scandir code wrongly assume that they do not change errno, this
causes scandir to fail with ENOMEM even if malloc succeed.

The code already handles that readdir might set errno by calling
__set_errno (0) to clear the error. Move that part at the end of the
loop to also take malloc and realloc into account.

Changelog:
[BZ #17804]
* dirent/scandir-tail.c (SCANDIR_TAIL): Move __set_errno (0) at the
end of the loop. Improve comments.

6 years agomanual: clarify errno value on success [BZ #22615]
Aurelien Jarno [Fri, 29 Dec 2017 13:44:57 +0000 (14:44 +0100)] 
manual: clarify errno value on success [BZ #22615]

The current glibc manual is ambiguous about the errno value on success
and suggests that it is left unchanged. Some functions might and
sometimes do change the errno value, however they never set it to 0.

This patch from Zack Weinberg clarifies this section of the manual.

Changelog:
[BZ #22615]
* manual/errno.texi (Checking for Errors): Explicitly say that errno
might be set on success.

6 years agotst-realloc: do not check for errno on success [BZ #22611]
Aurelien Jarno [Fri, 29 Dec 2017 13:44:57 +0000 (14:44 +0100)] 
tst-realloc: do not check for errno on success [BZ #22611]

POSIX explicitly says that applications should check errno only after
failure, so the errno value can be clobbered on success as long as it
is not set to zero.

Changelog:
[BZ #22611]
* malloc/tst-realloc.c (do_test): Remove the test checking that errno
is unchanged on success.

6 years agoelf: remove redundant is_path argument
Dmitry V. Levin [Wed, 20 Dec 2017 11:27:51 +0000 (11:27 +0000)] 
elf: remove redundant is_path argument

is_path argument is no longer used and could be safely removed.

* elf/dl-dst.h (DL_DST_COUNT): Remove is_path argument, all callers
updated.
* elf/dl-load.c (is_dst, _dl_dst_count, _dl_dst_substitute,
expand_dynamic_string_token): Likewise.
* sysdeps/generic/ldsodefs.h (_dl_dst_count, _dl_dst_substitute): Remove
is_path argument.

6 years agoelf: remove redundant code from is_dst
Dmitry V. Levin [Wed, 20 Dec 2017 11:27:51 +0000 (11:27 +0000)] 
elf: remove redundant code from is_dst

is_dst is called either by _dl_dst_count or by _dl_dst_substitute.
_dl_dst_count is called by DL_DST_COUNT only.
DL_DST_COUNT is called either by expand_dst with is_path == 0
or by expand_dynamic_string_token.
_dl_dst_substitute is called either from expand_dst with is_path == 0
or from expand_dynamic_string_token.
The latter function is called either from _dl_map_object with is_path == 0
or from fillin_rpath with is_path == 1 and name containing no ':'.

In any case (is_path && name[i] == ':') is always false and all code
depending on it can be safely removed.

* elf/dl-load.c (is_dst): Remove checks that is_path is set and name
contains ':', and all code depending on these checks.

6 years agoelf: remove redundant code from _dl_dst_substitute
Dmitry V. Levin [Tue, 19 Dec 2017 21:06:23 +0000 (21:06 +0000)] 
elf: remove redundant code from _dl_dst_substitute

There are just two users of _dl_dst_substitute: one is expand_dst that
sets is_path argument to 0, another one is expand_dynamic_string_token.
The latter function also has just two users: one is _dl_map_object that
sets is_path argument to 0, another one is fillin_rpath that sets
is_path argument to 1 and name argument contains no ':'.

In any case (is_path && name[i] == ':') is always false and all code
depending on it can be safely removed.

* elf/dl-load.c (_dl_dst_substitute): Remove checks that is_path
is set and name contains ':', and all code depending on these checks.

6 years agoDeprecate external use of libio.h and _G_config.h.
Zack Weinberg [Sat, 23 Dec 2017 05:06:03 +0000 (00:06 -0500)] 
Deprecate external use of libio.h and _G_config.h.

libio.h was originally the header for a set of supported GNU
extensions, but they have not been maintained as such in many years,
they are now standing in the way of improvements to stdio, and we
don't think there are any remaining external users.  _G_config.h was
never intended for public use, but predates the bits convention.
Move both of these headers into the bits directory and provide stubs
at top level which issue deprecation warnings.

The contents of (bits/)libio.h and (bits/)_G_config.h are still
exposed to external software via stdio.h; changing that requires more
complex surgery than I have time to attempt right now.

* libio/libio.h, libio/_G_config.h: New stub headers which issue a
deprecation warning and then include <bits/libio.h>, <bits/_G_config.h>
respectively.
* libio/libio.h: Rename the original version of this file to
libio/bits/libio.h.  Error out if not included by stdio.h or the
stub libio.h.
* include/libio.h: Move to include/bits.  Forward to libio/bits/libio.h.
* sysdeps/generic/_G_config.h: Move to top-level bits/.  Error out
if not included by bits/libio.h or the stub _G_config.h.
* sysdeps/unix/sysv/linux/_G_config.h: Move to
sysdeps/unix/sysv/linux/bits.  Error out if not included by
bits/libio.h or the stub _G_config.h.
* libio/stdio.h: Include bits/libio.h, not libio.h.
* libio/Makefile: Install bits/libio.h and bits/_G_config.h as
well as libio.h and _G_config.h.

* csu/init.c, libio/fmemopen.c, libio/iolibio.h, libio/oldfmemopen.c
* libio/strfile.h, stdio-common/vfscanf.c
* sysdeps/pthread/flockfile.c, sysdeps/pthread/funlockfile.c
Include stdio.h, not _G_config.h nor libio.h.
* libio/iofgetpos.c: Also rename fgetpos64 out of the way.
* libio/iofsetpos.c: Also rename fsetpos64 out of the way.

* scripts/check-installed-headers.sh: Skip libio.h and _G_config.h.

6 years agogetrandom: fix comment [BZ #22347]
Dmitry V. Levin [Sat, 23 Dec 2017 14:27:30 +0000 (14:27 +0000)] 
getrandom: fix comment [BZ #22347]

* stdlib/getrandom.c (getrandom): Fix comment.
* sysdeps/unix/sysv/linux/getrandom.c (getrandom): Likewise.

6 years agomanual: fix a typo in strtoul description [BZ #21161]
Aurelien Jarno [Sat, 23 Dec 2017 13:53:07 +0000 (14:53 +0100)] 
manual: fix a typo in strtoul description [BZ #21161]

Typo reported by Vincent Lefèvre: 'retrict' -> 'restrict'.

Changelog:
[BZ #21161]
* manual/arith.texi (strtoul): Fix a typo.

6 years agomanual: fix finite description [BZ #22596]
Aurelien Jarno [Sat, 23 Dec 2017 10:48:28 +0000 (11:48 +0100)] 
manual: fix finite description [BZ #22596]

That way it matches the standard and the behaviour of the finite
function.

Changelog:
[BZ #22596]
* manual/arith.texi (finite): Fix the description of the return
value.

6 years agoAvoid gcc warnings on cygwin
Eric Blake [Fri, 22 Dec 2017 15:57:25 +0000 (07:57 -0800)] 
Avoid gcc warnings on cygwin

* posix/regex_internal.c (re_string_reconstruct) [!RE_ENABLE_I18N]:
* posix/regexec.c (check_arrival_add_next_nodes) [!RE_ENABLE_I18N]:
Avoid unused variable.

6 years agocopy_file_range: New function to copy file data
Florian Weimer [Fri, 22 Dec 2017 09:55:40 +0000 (10:55 +0100)] 
copy_file_range: New function to copy file data

The semantics are based on the Linux system call, but a very close
emulation in user space is provided.

6 years agoAdd aarch64 disable-multi-arch variant to build-many-glibcs.py
Szabolcs Nagy [Wed, 20 Dec 2017 11:00:29 +0000 (11:00 +0000)] 
Add aarch64 disable-multi-arch variant to build-many-glibcs.py

aarch64 has several ifuncs now so test it without multiarch support separately.

* scripts/build-many-glibcs.py (Context.add_all_configs): Add
disable-multi-arch variant to aarch64-linux-gnu.

6 years agoUpdate miscellaneous files from upstream sources.
Joseph Myers [Wed, 20 Dec 2017 22:26:24 +0000 (22:26 +0000)] 
Update miscellaneous files from upstream sources.

This patch updates various miscellaneous files from their upstream
sources.

Tested for x86_64, including "make pdf".

* manual/texinfo.tex: Update to version 2017-12-18.20 with
trailing whitespace removed.
* scripts/config.guess: Update to version 2017-12-17.
* scripts/config.sub: Update to version 2017-11-23.
* scripts/install-sh: Update to version 2017-09-23.17.
* scripts/move-if-change: Update to version 2017-09-13 06:45.

6 years agoSimplify tile assembly definitions
Adhemerval Zanella [Wed, 13 Dec 2017 18:14:30 +0000 (16:14 -0200)] 
Simplify tile assembly definitions

With tilepro removal, the uppercase instruction are not anymore
required to be defines as potentially macros.  This is a
mechanical change done by the following shell script:

---
INSNS="LD LD4U ST ST4 BNEZ BEQZ BEQZT BGTZ CMPEQI CMPEQ CMOVEQZ CMOVNEZ"

FILES=$(find sysdeps/tile sysdeps/unix/sysv/linux/tile -iname *.S)

for insn in $INSNS; do
  repl=$(echo $insn | tr '[:upper:]' '[:lower:]')
  sed -i 's/\b'$insn'\b/'$repl'/g' $FILES
done
---

Checked with a build for tilegx-linux-gnu and tilegx-linux-gnu-32 with
and without the patch, there is no difference in generated binary with
a dissassemble.

* sysdeps/tile/__longjmp.S (__longjmp): Use lowercase instructions.
* sysdeps/tile/__tls_get_addr.S (__tls_get_addr): Likewise.
* sysdeps/tile/_mcount.S (__mcount): Likewise.
* sysdeps/tile/crti.S (_init, _fini): Likewise.
* sysdeps/tile/crtn.S: Likewise.
* sysdeps/tile/dl-start.S (_start): Likewise.
* sysdeps/tile/dl-trampoline.S: Likewise.
* sysdeps/tile/setjmp.S (__sigsetjmp): Likewise.
* sysdeps/tile/start.S (_start): Likewise.
* sysdeps/unix/sysv/linux/tile/clone.S (_clone): Likewise.
* sysdeps/unix/sysv/linux/tile/getcontext.S (__getcontext): Likewise.
* sysdeps/unix/sysv/linux/tile/ioctl.S (__ioctl): Likewise.
* sysdeps/unix/sysv/linux/tile/setcontext.S (__setcontext): Likewise.
* sysdeps/unix/sysv/linux/tile/swapcontext.S (__swapcontext): Likewise.
* sysdeps/unix/sysv/linux/tile/syscall.S (syscall): Likewise.
* sysdeps/unix/sysv/linux/tile/vfork.S (__vfork): Likewise.

6 years agoSimplify tilegx sysdeps folder
Adhemerval Zanella [Wed, 13 Dec 2017 13:43:39 +0000 (11:43 -0200)] 
Simplify tilegx sysdeps folder

With tilepro support removal we can now simplify internal tile support by
moving the directory structure to avoid the unnecessary directory levels
in tile/tilegx both on generic and linux folders.

Checked with a build for tilegx-linux-gnu and tilegx-linux-gnu-32 with
and without the patch, there is no difference in generated binary with
a dissassemble.

* stdlib/bug-getcontext.c (do_test): Remove tilepro mention in
comment.
* sysdeps/tile/preconfigure: Remove tilegx folder.
* sysdeps/tile/tilegx/Implies: Move definitions to ...
* sysdeps/tile/Implies: ... here.
* sysdeps/tile/tilegx/Makefile: Move rules to ...
* sysdeps/tile/Makefile: ... here.
* sysdeps/tile/tilegx/atomic-machine.h: Move definitions to ...
* sysdeps/tile/atomic-machine.h: ... here.  Add include guards.
* sysdeps/tile/tilegx/bits/wordsize.h: Move to ...
* sysdeps/tile/bits/wordsize.h: ... here.
* sysdeps/tile/tilegx/*: Move to ...
* sysdeps/tile/*: ... here.
* sysdeps/tile/tilegx/tilegx32/Implies: Move to ...
* sysdeps/tile/tilegx32/Implies: ... here.
* sysdeps/tile/tilegx/tilegx64/Implies: Move to ...
* sysdeps/tile/tilegx64/Implies: ... here.
* sysdeps/unix/sysv/linux/tile/tilegx/Makefile: Move definitions
to ...
* sysdeps/unix/sysv/linux/tile/Makefile: ... here.
* sysdeps/unix/sysv/linux/tile/tilegx/*: Move to ...
* sysdeps/unix/sysv/linux/tile/*: ... here.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/*: Move to ...
* sysdeps/unix/sysv/linux/tile/tilegx32/*: ... here.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/*: Move to ...
* sysdeps/unix/sysv/linux/tile/tilegx64/*: ... here.

6 years agoRemove tilepro-*-linux-gnu support
Adhemerval Zanella [Tue, 12 Dec 2017 21:15:45 +0000 (19:15 -0200)] 
Remove tilepro-*-linux-gnu support

As from previous discussions [1] this patch removes tileprox-*-linux-gnu
support from GLIBC.  This patch is a straigthfoward one, which just remove
tilepro specific implementation and configurations (no sysdep simplfication
or reorganization is done).

* README: Remove tilepro-*-linux-gnu from supported architecture.
* scripts/build-many-glibcs.py: Likewise.
* sysdeps/tile/__tls_get_addr.S (__tls_get_addr): Likewise.
* sysdeps/tile/crti.S (PREINIT_FUNCTION): Likewise.
* sysdeps/tile/dl-machine.h (ELF_MACHINE_NAME,
elf_machine_matches_host, elf_machine_dynamic,
elf_machine_load_address, elf_machine_runtime_setup, reloc_howto
howto, elf_machine_rela): Likewise
* sysdeps/tile/dl-start.S (_start): Likewise.
* sysdeps/tile/memcmp.c (DBLALIGN, REVBYTES): Likewise.
* sysdeps/tile/memcopy.h (MEMCPY_OK_FOR_FWD_MEMMOVE,
MEMCPY_OK_FOR_FWD_MEMMOVE, op_t): Likewise.
* sysdeps/tile/nptl/pthread_spin_lock.c (TNS, CMPTNS): Likewise.
* sysdeps/tile/nptl/pthread_spin_trylock.c (TNS): Likewise.
* sysdeps/tile/nptl/pthread_spin_unlock.c (pthread_spin_unlock):
Likewise.
* sysdeps/tile/nptl/tls.h (DB_THREAD_SELF): Likewise.
* sysdeps/tile/preconfigure: Likewise.
* sysdeps/tile/stackguard-macros.h (STACK_CHK_GUARD,
POINTER_CHK_GUARD): Likewise.
* sysdeps/tile/stackinfo.h (__stackinfo_sub): Likewise.
* sysdeps/tile/start.S (_start): Likewise.
* sysdeps/tile/tls-macros.h (TLS_GD_OFFSET, TLS_IE_OFFSET, _TLS_LE):
Likewise.
* sysdeps/tile/sysdep.h (REGSIZE): Likewise.
(LD, LD4U, ST, ST4, BNEZ, BEQZ, BEQZT, BGTZ, CMPEQI, CMPEQ, CMOVEQZ,
CMOVNEZ): Remove.
* sysdeps/unix/sysv/linux/tile/bits/environments.h
(__ILP32_OFF32_CFLAGS, __ILP32_OFFBIG_CFLAGS, __ILP32_OFF32_LDFLAGS,
__ILP32_OFFBIG_LDFLAGS, __LP64_OFF64_CFLAGS, __LP64_OFF64_LDFLAGS):
Likewise.
* sysdeps/tile/wordcopy.c (DBLALIGN): Likewise.
* sysdeps/tile/tilepro/Implies: Remove file.
* sysdeps/tile/tilepro/atomic-machine.h: Likewise.
* sysdeps/tile/tilepro/bits/wordsize.h: Likewise.
* sysdeps/tile/tilepro/memchr.c: Likewise.
* sysdeps/tile/tilepro/memcpy.S: Likewise.
* sysdeps/tile/tilepro/memset.c: Likewise.
* sysdeps/tile/tilepro/memusage.h: Likewise.
* sysdeps/tile/tilepro/rawmemchr.c: Likewise.
* sysdeps/tile/tilepro/strchr.c: Likewise.
* sysdeps/tile/tilepro/strchrnul.c: Likewise.
* sysdeps/tile/tilepro/strlen.c: Likewise.
* sysdeps/tile/tilepro/strrchr.c: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/Implies: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/c++-types.data: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/jmp_buf-macros.h: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/ldconfig.h: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libBrokenLocale.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libanl.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libcrypt.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libdl.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libnsl.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libpthread.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libresolv.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/librt.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libthread_db.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libutil.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/tile/sysconf.c (linux_sysconf): Remove
tilepro mention in comment.

[1] https://sourceware.org/ml/libc-alpha/2017-12/msg00038.html

6 years agonptl: Consolidate pthread_{timed,try}join{_np}
Adhemerval Zanella [Wed, 25 Jan 2017 19:08:51 +0000 (17:08 -0200)] 
nptl: Consolidate pthread_{timed,try}join{_np}

This patch consolidates the pthread_join and gnu extensions to avoid
code duplication.  The function pthread_join, pthread_tryjoin_np, and
pthread_timedjoin_np are now based on pthread_timedjoin_ex.

It also fixes some inconsistencies on ESRCH, EINVAL, EDEADLK handling
(where each implementation differs from each other) and also on
clenup handler (which now always use a CAS).

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

* nptl/pthreadP.h (__pthread_timedjoin_np): Define.
* nptl/pthread_join.c (pthread_join): Use __pthread_timedjoin_np.
* nptl/pthread_tryjoin.c (pthread_tryjoin): Likewise.
* nptl/pthread_timedjoin.c (cleanup): Use CAS on argument setting.
(pthread_timedjoin_np): Define internal symbol and common code from
pthread_join.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h (__lll_timedwait_tid):
Remove superflous checks.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (__lll_timedwait_tid):
Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>