]> sourceware.org Git - glibc.git/log
glibc.git
4 years agoaarch64: Use math-use-builtins for ceil{f}
Adhemerval Zanella [Thu, 4 Jun 2020 14:35:48 +0000 (14:35 +0000)]
aarch64: Use math-use-builtins for ceil{f}

The define is already set on the math-use-builtins-ceil.h, the patch
just removes the implementations (it was missed on c9feb1be93).

Checked on aarch64-linux-gnu.

4 years agomath: Decompose math-use-builtins.h
Adhemerval Zanella [Thu, 4 Jun 2020 14:32:17 +0000 (14:32 +0000)]
math: Decompose math-use-builtins.h

Each symbol definitions are moved on a separated file and it
cover all symbol type definitions (float, double, long double,
and float128).

It allows to set support for architectures without the boiler
place of copying default values.

Checked with a build on the affected ABIs.

4 years agohurd: Add mremap
Samuel Thibault [Sat, 20 Jun 2020 13:48:04 +0000 (13:48 +0000)]
hurd: Add mremap

* sysdeps/mach/hurd/mremap.c: New file.
* sysdeps/mach/hurd/Makefile [misc] (sysdep_routines): Add mremap.
* sysdeps/mach/hurd/Versions (libc.GLIBC_2.32): Add mremap.
* sysdeps/mach/hurd/i386/libc.abilist: Add mremap.

4 years agoia64: Use generic exp10f
Adhemerval Zanella [Thu, 9 Apr 2020 19:38:27 +0000 (16:38 -0300)]
ia64: Use generic exp10f

The generic implementation is slight worse (Itanium(R) Processor 9020):

Before new code:
  "exp10f": {
   "workload-spec2017.wrf (adapted)": {
    "duration": 3.61582e+08,
    "iterations": 2.384e+07,
    "reciprocal-throughput": 14.8334,
    "latency": 15.5006,
    "max-throughput": 6.74153e+07,
    "min-throughput": 6.45136e+07
   }
  }

With new code:
  "exp10f": {
   "workload-spec2017.wrf (adapted)": {
    "duration": 3.85549e+08,
    "iterations": 2.384e+07,
    "reciprocal-throughput": 15.8391,
    "latency": 16.5056,
    "max-throughput": 6.31348e+07,
    "min-throughput": 6.05857e+07
   }
  }

However it fixes all the issues on both:

  math/test-float-exp10
  math/test-float32-exp10

(all the issues wrong results for non default rounding modes).

The existing ia64 libm interface uses matherrf and matherrl in addition
to matherr for SVID error handling. However, there is no such error
handling support for exp10f in ia64 libm.  So replacing it with the
generic implementation should be fine.

Checked on ia64-linux-gnu.

4 years agoNew exp10f version without SVID compat wrapper
Adhemerval Zanella [Wed, 8 Apr 2020 22:51:44 +0000 (19:51 -0300)]
New exp10f version without SVID compat wrapper

This patch changes the exp10f error handling semantics to only set
errno according to POSIX rules.  New symbol version is introduced at
GLIBC_2.32.  The old wrappers are kept for compat symbols.

There are some outliers that need special handling:

  - ia64 provides an optimized implementation of exp10f that uses ia64
    specific routines to set SVID compatibility.  The new symbol version
    is aliased to the exp10f one.

  - m68k also provides an optimized implementation, and the new version
    uses it instead of the sysdeps/ieee754/flt32 one.

  - riscv and csky uses the generic template implementation that
    does not provide SVID support.  For both cases a new exp10f
    version is not added, but rather the symbols version of the
    generic sysdeps/ieee754/flt32 is adjusted instead.

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

4 years agoi386: Use generic exp10f
Adhemerval Zanella [Wed, 8 Apr 2020 20:42:46 +0000 (17:42 -0300)]
i386: Use generic exp10f

The generic implementation is twice as fast.  Using the exp10f
benchmark:

 * master:
  "exp10f": {
   "workload-spec2017.wrf (adapted)": {
    "duration": 1.02967e+09,
    "iterations": 4.768e+07,
    "reciprocal-throughput": 18.3579,
    "latency": 24.8331,
    "max-throughput": 5.44725e+07,
    "min-throughput": 4.02688e+07
   }
  }

 * patched:
  "exp10f": {
   "workload-spec2017.wrf (adapted)": {
    "duration": 1.01821e+09,
    "iterations": 6.1984e+07,
    "reciprocal-throughput": 13.1975,
    "latency": 19.6563,
    "max-throughput": 7.57719e+07,
    "min-throughput": 5.08743e+07
   }
  }

Checked on i686-linux-gnu.

4 years agomath: Optimized generic exp10f with wrappers
Paul Zimmermann [Wed, 8 Apr 2020 20:32:28 +0000 (17:32 -0300)]
math: Optimized generic exp10f with wrappers

It is inspired by expf and reuses its tables and internal functions.
The error checks are inlined and errno setting is in separate tail
called functions, but the wrappers are kept in this patch to handle
the _LIB_VERSION==_SVID_ case.

Double precision arithmetics is used which is expected to be faster on
most targets (including soft-float) than using single precision and it
is easier to get good precision result with it.

Result for x86_64 (i7-4790K CPU @ 4.00GHz) are:

Before new code:
  "exp10f": {
   "workload-spec2017.wrf (adapted)": {
    "duration": 4.0414e+09,
    "iterations": 1.00128e+08,
    "reciprocal-throughput": 26.6818,
    "latency": 54.043,
    "max-throughput": 3.74787e+07,
    "min-throughput": 1.85038e+07
   }

With new code:
  "exp10f": {
   "workload-spec2017.wrf (adapted)": {
    "duration": 4.11951e+09,
    "iterations": 1.23968e+08,
    "reciprocal-throughput": 21.0581,
    "latency": 45.4028,
    "max-throughput": 4.74876e+07,
    "min-throughput": 2.20251e+07
   }

Result for aarch64 (A72 @ 2GHz) are:

Before new code:
  "exp10f": {
   "workload-spec2017.wrf (adapted)": {
    "duration": 4.62362e+09,
    "iterations": 3.3376e+07,
    "reciprocal-throughput": 127.698,
    "latency": 149.365,
    "max-throughput": 7.831e+06,
    "min-throughput": 6.69501e+06
   }

With new code:
  "exp10f": {
   "workload-spec2017.wrf (adapted)": {
    "duration": 4.29108e+09,
    "iterations": 6.6752e+07,
    "reciprocal-throughput": 51.2111,
    "latency": 77.3568,
    "max-throughput": 1.9527e+07,
    "min-throughput": 1.29271e+07
   }

Checked on x86_64-linux-gnu, powerpc64le-linux-gnu, aarch64-linux-gnu,
and sparc64-linux-gnu.

4 years agobenchtests: Add exp10f benchmark
Adhemerval Zanella [Wed, 8 Apr 2020 20:00:06 +0000 (17:00 -0300)]
benchtests: Add exp10f benchmark

It is based on expf one by converting each line with the formula:

  new_val = (float) log10 (exp ((double) old_val))

4 years agox86: Update F16C detection [BZ #26133]
H.J. Lu [Thu, 18 Jun 2020 12:34:15 +0000 (05:34 -0700)]
x86: Update F16C detection [BZ #26133]

Since F16C requires AVX, set F16C usable only when AVX is usable.

4 years agoFix avx2 strncmp offset compare condition check [BZ #25933]
Sunil K Pandey [Fri, 12 Jun 2020 15:57:16 +0000 (08:57 -0700)]
Fix avx2 strncmp offset compare condition check [BZ #25933]

strcmp-avx2.S: In avx2 strncmp function, strings are compared in
chunks of 4 vector size(i.e. 32x4=128 byte for avx2). After first 4
vector size comparison, code must check whether it already passed
the given offset. This patch implement avx2 offset check condition
for strncmp function, if both string compare same for first 4 vector
size.

4 years agonptl: Remove now-spurious tst-cancelx9 references
Samuel Thibault [Wed, 17 Jun 2020 13:55:52 +0000 (15:55 +0200)]
nptl: Remove now-spurious tst-cancelx9 references

They were to be moved to sysdeps/pthread/Makefile in 45fce058f ('htl:
Enable more cancellation tests')

* nptl/Makefile: (tests): Remove tst-cancelx9.
(CFLAGS-tst-cancelx9.c): Remove.

4 years agox86_64: Use %xmmN with vpxor to clear a vector register
H.J. Lu [Thu, 11 Jun 2020 19:41:18 +0000 (12:41 -0700)]
x86_64: Use %xmmN with vpxor to clear a vector register

Since "vpxor %xmmN, %xmmN, %xmmN" clears the whole vector register, use
%xmmN, instead of %ymmN, with vpxor to clear a vector register.

4 years agox86: Correct bit_cpu_CLFLUSHOPT [BZ #26128]
H.J. Lu [Wed, 17 Jun 2020 12:32:37 +0000 (05:32 -0700)]
x86: Correct bit_cpu_CLFLUSHOPT [BZ #26128]

bit_cpu_CLFLUSHOPT should be (1u << 23), not (1u << 22).

4 years agopowerpc64le: refactor e_sqrtf128.c
Paul E. Murphy [Tue, 7 Apr 2020 21:20:51 +0000 (16:20 -0500)]
powerpc64le: refactor e_sqrtf128.c

Combine both implementations into a single file to allow
building twice with appropriate multiarch support when possible.

4 years agoUpdate syscall-names.list for Linux 5.7.
Joseph Myers [Mon, 15 Jun 2020 22:58:22 +0000 (22:58 +0000)]
Update syscall-names.list for Linux 5.7.

Linux 5.7 has no new syscalls.  Update the version number in
syscall-names.list to reflect that it is still current for 5.7.

Tested with build-many-glibcs.py.

4 years agoieee754/dbl-64: Reduce the scope of temporary storage variables
Vineet Gupta [Fri, 8 Nov 2019 19:32:00 +0000 (11:32 -0800)]
ieee754/dbl-64: Reduce the scope of temporary storage variables

This came to light when adding hard-flaot support to ARC glibc port
without hardware sqrt support causing glibc build to fail:

| ../sysdeps/ieee754/dbl-64/e_sqrt.c: In function '__ieee754_sqrt':
| ../sysdeps/ieee754/dbl-64/e_sqrt.c:58:54: error: unused variable 'ty' [-Werror=unused-variable]
|   double y, t, del, res, res1, hy, z, zz, p, hx, tx, ty, s;

The reason being EMULV() macro uses the hardware provided
__builtin_fma() variant, leaving temporary variables 'p, hx, tx, hy, ty'
unused hence compiler warning and ensuing error.

The intent of the patch was to fix that error, but EMULV is pervasive
and used fair bit indirectly via othe rmacros, hence this patch.
Functionally it should not result in code gen changes and if at all
those would be better since the scope of those temporaries is greatly
reduced now

Built tested with aarch64-linux-gnu arm-linux-gnueabi arm-linux-gnueabihf hppa-linux-gnu x86_64-linux-gnu arm-linux-gnueabihf riscv64-linux-gnu-rv64imac-lp64 riscv64-linux-gnu-rv64imafdc-lp64 powerpc-linux-gnu microblaze-linux-gnu nios2-linux-gnu hppa-linux-gnu

Also as suggested by Joseph [1] used --strip and compared the libs with
and w/o patch and they are byte-for-byte unchanged (with gcc 9).

| for i in `find . -name libm-2.31.9000.so`;
| do
|    echo $i; diff $i /SCRATCH/vgupta/gnu2/install/glibcs/$i ; echo $?;
| done

| ./aarch64-linux-gnu/lib64/libm-2.31.9000.so
| 0
| ./arm-linux-gnueabi/lib/libm-2.31.9000.so
| 0
| ./x86_64-linux-gnu/lib64/libm-2.31.9000.so
| 0
| ./arm-linux-gnueabihf/lib/libm-2.31.9000.so
| 0
| ./riscv64-linux-gnu-rv64imac-lp64/lib64/lp64/libm-2.31.9000.so
| 0
| ./riscv64-linux-gnu-rv64imafdc-lp64/lib64/lp64/libm-2.31.9000.so
| 0
| ./powerpc-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./microblaze-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./nios2-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./hppa-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./s390x-linux-gnu/lib64/libm-2.31.9000.so

[1] https://sourceware.org/pipermail/libc-alpha/2019-November/108267.html

4 years agomanual: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np
Florian Weimer [Mon, 15 Jun 2020 10:18:38 +0000 (12:18 +0200)]
manual: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np

And the PTHREAD_ATTR_NO_SIGMASK_NP constant.

4 years agold.so: Check for new cache format first and enhance corruption check
Florian Weimer [Mon, 15 Jun 2020 07:50:14 +0000 (09:50 +0200)]
ld.so: Check for new cache format first and enhance corruption check

Now that ldconfig defaults to the new format (only), check for it
first.  Also apply the corruption check added in commit 2954daf00bb4d
("Add more checks for valid ld.so.cache file (bug 18093)") to the
new-format-only case.

Suggested-by: Josh Triplett <josh@joshtriplett.org>
4 years agohurd: Fix __writev_nocancel_nostatus
Samuel Thibault [Sun, 14 Jun 2020 17:44:57 +0000 (17:44 +0000)]
hurd: Fix __writev_nocancel_nostatus

* sysdeps/mach/hurd/Makefile [subdir=misc] (sysdep_routines): Add
writev_nocancel writev_nocancel_nostatus.
* sysdeps/mach/hurd/not-cancel.h (__writev_nocancel_nostatus): Replace
macro with function declaration (with hidden prototype in libc).
(__writev_nocancel): New function declaration (with hidden prototype in libc).
* sysdeps/mach/hurd/writev_nocancel_nostatus.c: New file.
* sysdeps/posix/writev_nocancel.c: New file, includes writev.c to make a
nocancel variant that calls __write_nocancel.
* sysdeps/posix/writev.c (writev): Do not define alias if __writev is
renamed.

4 years agohurd: Make send* cancellation points
Samuel Thibault [Sun, 14 Jun 2020 17:09:59 +0000 (17:09 +0000)]
hurd: Make send* cancellation points

* sysdeps/mach/hurd/send.c (__send): Make the __socket_send call
a cancellation point.
* sysdeps/mach/hurd/sendto.c (__sendto): Likewise.
* sysdeps/mach/hurd/sendmsg.c (__libc_sendmsg): Likewise.

4 years agohtl: Enable more cancellation tests
Samuel Thibault [Sun, 14 Jun 2020 16:15:39 +0000 (16:15 +0000)]
htl: Enable more cancellation tests

* nptl/tst-cancel-self-cancelstate.c, tst-cancel-self.c, tst-cancel9.c,
tst-cancelx9.c: Move to...
* sysdeps/pthread: ... here.
* nptl/Makefile: Move corresponding references and rules to...
* sysdeps/pthread/Makefile: ... here.

4 years agohurd: Make write and pwrite64 cancellation points
Samuel Thibault [Sun, 14 Jun 2020 15:50:44 +0000 (15:50 +0000)]
hurd: Make write and pwrite64 cancellation points

and add _nocancel variants.

* sysdeps/mach/hurd/write.c (__libc_write): Call __write_nocancel
surrounded by enabling async cancel, to replace implementation moved
to...
* sysdeps/mach/hurd/write_nocancel.c (__write_nocancel): ... here.
* sysdeps/mach/hurd/pwrite64.c (__libc_pwrite64): Call
__pwrite64_nocancel surrounded by enabling async cancel, to replace
implementation moved to...
* sysdeps/mach/hurd/pwrite64_nocancel.c (__pwrite64_nocancel): ... here.
* sysdeps/mach/hurd/Makefile (sysdep_routines): Add write_nocancel and
pwrite64_nocancel.
* sysdeps/mach/hurd/not-cancel.h (__write_nocancel,
__pwrite64_nocancel): Replace macros with prototypes with a hidden proto on
libc.

* sysdeps/mach/hurd/dl-sysdep.c (__write_nocancel): New alias, check
that it is not hidden.
* sysdeps/mach/hurd/Versions (libc.GLIBC_PRIVATE): Add __write_nocancel.
(ld.GLIBC_PRIVATE): Add __write_nocancel.
* sysdeps/mach/hurd/i386/localplt.data (__write_nocancel): Add
reference.

4 years agohtl: Fix cleanup support for IO locking
Samuel Thibault [Sun, 14 Jun 2020 14:48:07 +0000 (14:48 +0000)]
htl: Fix cleanup support for IO locking

* sysdeps/htl/stdio-lock.h: New file, registers locking cleanup to htl.
* sysdeps/htl/libc-lockP.h: Include <libc-lock.h>.
(__libc_cleanup_region_start, __libc_cleanup_end,
__libc_cleanup_region_end): Override macros from <libc-lock.h> with
versions which register cleanup to htl.
(__pthread_get_cleanup_stack): Make reference weak for skipping
registration on in the static non-libpthread case.

4 years agohtl: Move cleanup stack to variable shared between libc and pthread
Samuel Thibault [Sun, 14 Jun 2020 12:56:54 +0000 (12:56 +0000)]
htl: Move cleanup stack to variable shared between libc and pthread

If libpthread gets loaded dynamically, the stack needs to already contain the
cleanup handlers of the main thread.

* htl/libc_pthread_init.c (__pthread_cleanup_stack): New per-thread variable.
* htl/Versions (libc): Add __pthread_cleanup_stack as private symbol.
* htl/pt-internal.h (struct __pthread): Remove cancelation_handlers
field.
(__pthread_cleanup_stack): Add variable declaration.
* htl/pt-alloc.c (initialize_pthread): Remove initialization of
cancelation_handlers field.
* htl/pt-cleanup.c (__pthread_get_cleanup_stack): Return the address of
__pthread_cleanup_stack instead of that of the cancelation_handlers
field.
* htl/forward.c: Include <pt-internal.h>.
(dummy_list): Remove variable.
(__pthread_get_cleanup_stack): Return the address of __pthread_cleanup_stack
instead of that of dummy_list.

4 years agohtl: initialize first and prevent from unloading
Samuel Thibault [Sun, 14 Jun 2020 15:47:14 +0000 (15:47 +0000)]
htl: initialize first and prevent from unloading

libc does not have codepaths for reverting the load of a libpthread.

* htl/Makefile (LDFLAGS-pthread.so): Pass -z nodelete -z initfirst to
linker.

4 years agohtl: Add noreturn attribute on __pthread_exit forward
Samuel Thibault [Sun, 14 Jun 2020 12:53:38 +0000 (12:53 +0000)]
htl: Add noreturn attribute on __pthread_exit forward

* sysdeps/htl/pthread-functions.h (__pthread_exit): Add noreturn
attribute.
(struct pthread_functions): Add noreturn attribute on ptr___pthread_exit
field.

4 years agohurd: Make recv* cancellation points
Samuel Thibault [Sun, 14 Jun 2020 00:19:35 +0000 (00:19 +0000)]
hurd: Make recv* cancellation points

* sysdeps/mach/hurd/recv.c (__recv): Make the __socket_recv call
cancellable.
* sysdeps/mach/hurd/recvfrom.c (__recvfrom): Make the __socket_recv and
__socket_whatis_address calls cancellable.
* sysdeps/mach/hurd/recvmsg.c (__libc_recvmsg): Make the __socket_recv,
__socket_whatis_address, __io_reauthenticate, and __auth_user_authenticate calls
cancellable.

4 years agopowerpc: Automatic CPU detection in preconfigure
Paul E. Murphy [Fri, 8 May 2020 13:27:56 +0000 (08:27 -0500)]
powerpc: Automatic CPU detection in preconfigure

Added a check to detect the CPU value in preconfigure, so that glibc is
built with the correct --with-cpu value.  And move existing checks into
preconfigure.ac.

Co-Authored-By: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Co-Authored-By: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
4 years agoUse Linux 5.7 in build-many-glibcs.py.
Joseph Myers [Wed, 10 Jun 2020 22:53:55 +0000 (22:53 +0000)]
Use Linux 5.7 in build-many-glibcs.py.

This patch makes build-many-glibcs.py use Linux 5.7.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).

4 years agohtl: Enable more cancel tests
Samuel Thibault [Wed, 10 Jun 2020 20:29:21 +0000 (20:29 +0000)]
htl: Enable more cancel tests

* nptl/tst-cancel11.c, tst-cancel21-static.c, tst-cancel21.c, tst-cancel6.c, tst-cancelx11.c, tst-cancelx21.c, tst-cancelx6.c: Move to...
* sysdeps/pthread: ... here.
* nptl/Makefile: Move corresponding references and rules to...
* sysdeps/pthread/Makefile: ... here.

4 years agohtl: Fix linking static tests by factorizing the symbols list
Samuel Thibault [Wed, 10 Jun 2020 20:03:52 +0000 (20:03 +0000)]
htl: Fix linking static tests by factorizing the symbols list

libpthread_syms.a will contain the symbols that libc tries to get from
libpthread, to be used by the system, but also by tests.

* htl/libpthread.a, htl/libpthread_pic.a: Link libpthread_syms.a and Move EXTERN
references to...
* htl/libpthread_syms.a: ... new file. Add missing
__pthread_enable_asynccancel reference.
* htl/Makefile: Install libpthread_syms.a and link it into static tests.

4 years agoAdd "%d" support to _dl_debug_vdprintf
H.J. Lu [Tue, 9 Jun 2020 19:15:01 +0000 (12:15 -0700)]
Add "%d" support to _dl_debug_vdprintf

"%d" will be used to print out signed value.

4 years agoaarch64: MTE compatible strlen
Andrea Corallo [Fri, 5 Jun 2020 15:22:26 +0000 (17:22 +0200)]
aarch64: MTE compatible strlen

Introduce an Arm MTE compatible strlen implementation.

The existing implementation assumes that any access to the pages in
which the string resides is safe.  This assumption is not true when
MTE is enabled.  This patch updates the algorithm to ensure that
accesses remain within the bounds of an MTE tag (16-byte chunks) and
improves overall performance on modern cores. On cores with less
efficient Advanced SIMD implementation such as Cortex-A53 it can
be slower.

Benchmarked on Cortex-A72, Cortex-A53, Neoverse N1.

Co-authored-by: Wilco Dijkstra <wilco.dijkstra@arm.com>
4 years agoaarch64: MTE compatible strchr
Andrea Corallo [Fri, 5 Jun 2020 15:20:50 +0000 (17:20 +0200)]
aarch64: MTE compatible strchr

Introduce an Arm MTE compatible strchr implementation.

The existing implementation assumes that any access to the pages in
which the string resides is safe.  This assumption is not true when
MTE is enabled.  This patch updates the algorithm to ensure that
accesses remain within the bounds of an MTE tag (16-byte chunks) and
improves overall performance.

Benchmarked on Cortex-A72, Cortex-A53, Neoverse N1.

Co-authored-by: Wilco Dijkstra <wilco.dijkstra@arm.com>
4 years agoaarch64: MTE compatible strchrnul
Andrea Corallo [Fri, 5 Jun 2020 15:18:49 +0000 (17:18 +0200)]
aarch64: MTE compatible strchrnul

Introduce an Arm MTE compatible strchrnul implementation.

The existing implementation assumes that any access to the pages in
which the string resides is safe.  This assumption is not true when
MTE is enabled.  This patch updates the algorithm to ensure that
accesses remain within the bounds of an MTE tag (16-byte chunks) and
improves overall performance.

Benchmarked on Cortex-A72, Cortex-A53, Neoverse N1.

Co-authored-by: Wilco Dijkstra <wilco.dijkstra@arm.com>
4 years agoAArch64: Merge Falkor memcpy and memmove implementations
Krzysztof Koch [Mon, 8 Jun 2020 13:06:15 +0000 (14:06 +0100)]
AArch64: Merge Falkor memcpy and memmove implementations

Falkor's memcpy and memmove share some implementation details,
therefore, the two routines are moved to a single source file
for code reuse.

The two routines now share code for small and medium copies
(up to and including 128 bytes). Large copies in memcpy do not
handle overlap correctly, consequently, the loops for
moving/copying more than 128 bytes stay separate for memcpy
and memmove.

To increase code reuse a number of small modifications were made:

1. The old implementation of memcpy copied the first 16-bytes as
   soon as the size of data was determined to be greater than 32 bytes.
   For memcpy code to also work when copying small/medium overlapping
   data, the first load and store was moved to the large copy case.
2. Medium memcpy case no longer assumes that 16 bytes were already
   copied and uses 8 registers to copy up to 128 bytes.
3. Small case for memmove was enlarged to that of memcpy, which is
   less than or equal to 32 bytes.
4. Medium case for memmove was enlarged to that of memcpy, which is
   less than or equal to 128 bytes.

Other changes include:

1. Improve alignment of existing loop bodies.
2. 'Delouse' memmove and memcpy input arguments. Make sure that
   upper 32-bits of input registers are zeroed if unused.
3. Do one more iteration in memmove loops and reduce the number of
   copies made from the start/end of the buffer, depending on
   the direction of the memmove loop.

Benchmarking:

Looking at the results from bench-memcpy-random.out, we can see that
now memmove_falkor is about 5% faster than memcpy_falkor_old, while
memmove_falkor_old was more than 15% slower. The memcpy implementation
remained largely unmodified, so there is no significant performance
change.

The reason for such a significant memmove performance gain is the
increase of the upper bound on the small copy case to 32 bytes and
the increase of the upper bound on the medium copy case to 128 bytes.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agohurd: document that gcc&gdb look at the trampoline code
Samuel Thibault [Mon, 8 Jun 2020 12:41:57 +0000 (14:41 +0200)]
hurd: document that gcc&gdb look at the trampoline code

* sysdeps/mach/hurd/i386/trampoline.c (rpc_wait_trampoline): Document
which gcc and gdb files look at the code of the trampoline.

4 years agopthread: Move back linking rules to nptl and htl
Samuel Thibault [Mon, 8 Jun 2020 11:32:08 +0000 (13:32 +0200)]
pthread: Move back linking rules to nptl and htl

d6d74ec16 ('htl: Enable more tests') moved the linking rules from
nptl/Makefile and htl/Makefile to the shared sysdeps/pthread/Makefile.  But
e.g. on powerpc some tests are added in sysdeps/powerpc/Makefile, which is
included *after* sysdeps/pthread/Makefile, and thus the tests don't get
affected by the rules and fail to link.  For now let's just copy over the
set of rules in both nptl/Makefile and htl/Makefile.

* sysdeps/pthread/Makefile: Move libpthread linking rules to...
* htl/Makefile: ... here and...
* nptl/Makefile: ... there.

4 years agohtl: Enable more tests
Samuel Thibault [Sun, 7 Jun 2020 23:32:58 +0000 (23:32 +0000)]
htl: Enable more tests

* nptl/tst-_res1.c, tst-_res1mod1.c, tst-_res1mod2.c, tst-atfork2.c,
tst-atfork2mod.c, tst-fini1.c, tst-fini1mod.c, tst-tls4.c, tst-tls4moda.c,
tst-tls4modb.c: Move to...
* sysdeps/pthread: ... here.  Rename tst-tls4.c to tst-pt-tls4.c to avoid
conflicting with elf/tst-tls4.c.
* nptl/Makefile: Move corresponding references and rules to...
* sysdeps/pthread/Makefile: ... here.

4 years agohtl: Fix registration of atfork handlers in modules
Samuel Thibault [Sun, 7 Jun 2020 23:29:44 +0000 (23:29 +0000)]
htl: Fix registration of atfork handlers in modules

We really need modules to use their own pthread_atfork so that
__dso_handle properly identifies them.

* sysdeps/htl/pt-atfork.c (__pthread_atfork): Hide function.
(pthread_atfork): Hide alias.
* sysdeps/htl/old_pt-atfork.c (pthread_atfork): Rename macro to
__pthread_atfork to fix building the compatibility alias.

4 years agohtl: Fix tls initialization for already-created threads
Samuel Thibault [Sun, 7 Jun 2020 23:27:46 +0000 (23:27 +0000)]
htl: Fix tls initialization for already-created threads

* sysdeps/htl/pthreadP.h: Include <link.h>
(__pthread_init_static_tls): New prototype.
* htl/pt-alloc.c (__pthread_init_static_tls): New function.
* sysdeps/mach/hurd/htl/pt-sysdep.c (_init_routine): Initialize tcb
field of initial thread. Set GL(dl_init_static_tls) to
&__pthread_init_static_tls.

4 years agohurd: Make read and pread64 cancellable
Samuel Thibault [Sun, 7 Jun 2020 23:16:46 +0000 (23:16 +0000)]
hurd: Make read and pread64 cancellable

and add _nocancel variants.

* sysdeps/mach/hurd/pread64.c (__libc_pread64):  Call __pread64_nocancel
surrounded by enabling async cancel, to replace implementation moved to...
* sysdeps/mach/hurd/pread64_nocancel.c (__pread64_nocancel): ... here.
* sysdeps/mach/hurd/read.c (__libc_read): Call __read_nocancel surrounded by
enabling async cancel, to replace implementation moved to...
* sysdeps/mach/hurd/read_nocancel.c (__read_nocancel): ... here.
* sysdeps/mach/hurd/Makefile (sysdep_routines): Add read_nocancel and
pread64_nocancel.
* sysdeps/mach/hurd/not-cancel.h (__read_nocancel, __pread64_nocancel):
Replace macros with prototypes with a hidden proto on libc.

* sysdeps/mach/hurd/dl-sysdep.c: Include <not-cancel.h>.
(__pread64_nocancel): New alias, check that it is not hidden.
(__read_nocancel): New alias, check that it is not hidden.

* sysdeps/mach/hurd/Versions (libc.GLIBC_PRIVATE): Add __read_nocancel and
__pread64_nocancel.
(ld.GLIBC_2.1): Add __pread64.
(ld.GLIBC_PRIVATE): Add __read_nocancel and __pread64_nocancel.
* sysdeps/mach/hurd/i386/ld.abilist (__pread64): Add symbol.
* sysdeps/mach/hurd/i386/localplt.data (__read_nocancel, __pread64,
__pread64_nocancel): Add references.

4 years agohurd: Fix unwinding over interruptible RPC
Samuel Thibault [Sun, 7 Jun 2020 17:51:21 +0000 (17:51 +0000)]
hurd: Fix unwinding over interruptible RPC

* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Set CFA register to
%ecx while %esp is altered.

4 years agohtl: Enable but XFAIL tst-flock2, tst-signal1, tst-signal2
Samuel Thibault [Sun, 7 Jun 2020 14:02:18 +0000 (14:02 +0000)]
htl: Enable but XFAIL tst-flock2, tst-signal1, tst-signal2

They need setpshared support.

* nptl/tst-flock2.c, tst-signal1.c, tst-signal2.c: Move to...
* sysdeps/pthread: ... here.
* nptl/Makefile: Move corresponding tests references to...
* sysdeps/pthread/Makefile: ... here.
* sysdeps/mach/hurd/i386/Makefile (test-xfail-tst-flock2,
test-xfail-tst-signal1, test-xfail-tst-signal2): Add.

4 years agohurd: XFAIL more tests that require setpshared support
Samuel Thibault [Sun, 7 Jun 2020 13:37:08 +0000 (15:37 +0200)]
hurd: XFAIL more tests that require setpshared support

* sysdeps/mach/hurd/i386/Makefile (test-xfail-tst-pututxline-cache,
test-xfail-tst-pututxline-lockfail, test-xfail-tst-mallocfork2): Add.

4 years agohurd: Briefly document in xfails the topics of the bugzilla entries
Samuel Thibault [Sun, 7 Jun 2020 13:35:08 +0000 (15:35 +0200)]
hurd: Briefly document in xfails the topics of the bugzilla entries

* sysdeps/mach/hurd/i386/Makefile: Add comments.

4 years agohtl: Enable more tests
Samuel Thibault [Sun, 7 Jun 2020 02:03:45 +0000 (02:03 +0000)]
htl: Enable more tests

* htl/Makefile: Remove rules adding libpthread.so and libpthread.a to link
lines.
* nptl/Makefile: Move rules adding libpthread.so and libpthread.a to
link lines to...
* sysdeps/pthread/Makefile: ... here.

* nptl/eintr.c, tst-align.c tst-align3.c tst-atfork1.c tst-backtrace1.c
tst-bad-schedattr.c tst-cancel-self-canceltype.c tst-cancel-self-cleanup.c
tst-cancel-self-testcancel.c tst-cancel1.c tst-cancel10.c tst-cancel12.c
tst-cancel14.c tst-cancel15.c tst-cancel18.c tst-cancel19.c tst-cancel2.c
tst-cancel22.c tst-cancel23.c tst-cancel26.c tst-cancel27.c tst-cancel28.c
tst-cancel3.c tst-cancel8.c tst-cancelx1.c tst-cancelx10.c tst-cancelx12.c
tst-cancelx14.c tst-cancelx15.c tst-cancelx18.c tst-cancelx2.c tst-cancelx3.c
tst-cancelx8.c tst-cleanup0.c tst-cleanup0.expect tst-cleanup1.c tst-cleanup2.c
tst-cleanup3.c tst-cleanupx0.c tst-cleanupx0.expect tst-cleanupx1.c
tst-cleanupx2.c tst-cleanupx3.c tst-clock1.c tst-create-detached.c tst-detach1.c
tst-eintr2.c tst-eintr3.c tst-eintr4.c tst-eintr5.c tst-exec1.c tst-exec2.c
tst-exec3.c tst-exit1.c tst-exit2.c tst-exit3.c tst-flock1.c tst-fork1.c
tst-fork2.c tst-fork3.c tst-fork4.c tst-getpid3.c tst-kill1.c tst-kill2.c
tst-kill3.c tst-kill4.c tst-kill5.c tst-kill6.c tst-locale1.c tst-locale2.c
tst-memstream.c tst-popen1.c tst-raise1.c tst-sem5.c tst-setuid3.c tst-signal4.c
tst-signal5.c tst-signal6.c tst-signal8.c tst-stack1.c tst-stdio1.c tst-stdio2.c
tst-sysconf.c tst-tls1.c tst-tls2.c tst-tsd1.c tst-tsd2.c tst-tsd5.c tst-tsd6.c
tst-umask1.c tst-unload.c tst-unwind-thread.c tst-vfork1.c tst-vfork1x.c
tst-vfork2.c tst-vfork2x.c: Move tests to...
* sysdeps/pthread: ... here.
Rename
tst-popen1.c -> tst-pt-popen1.c
tst-align.c -> tst-pt-align.c
tst-align3.c -> tst-pt-align3.c
tst-sysconf.c -> tst-pt-sysconf.c
tst-tls1.c -> tst-pt-tls1.c
tst-tls2.c -> tst-pt-tls2.c
tst-vfork1.c -> tst-pt-vfork1.c
tst-vfork2.c -> tst-pt-vfork2.c
to avoid conflicting with libio/tst-popen1.c, elf/tst-align.c,
posix/tst-sysconf.c, elf/tst-tls1.c, elf/tst-tls2.c, posix/tst-vfork1.c,
posix/tst-vfork2.c.

* nptl/Makefile: Move corresponding tests references and special rules to...
* sysdeps/pthread/Makefile: ... here.

* sysdeps/pthread/tst-stack1.c (do_test): Do not clamp stack size to
PTHREAD_STACK_MIN if not defined.

Tested on linux-x86_64 and hurd-i386

4 years agohtl: Add sem_clockwait support
Samuel Thibault [Sun, 7 Jun 2020 01:12:36 +0000 (03:12 +0200)]
htl: Add sem_clockwait support

* sysdeps/htl/sem-timedwait.c (__sem_timedwait_internal): Add clock_id
parameter instead of hardcoding CLOCK_REALTIME.
(__sem_clockwait): New function.
(sem_clockwait): New weak alias.
* sysdeps/htl/sem-wait.c (__sem_timedwait_internal): Update declaration.
(__sem_wait): Update call to __sem_timedwait_internal.
* htl/Versions (GLIBC_2.32): Add sem_clockwait.
* sysdeps/mach/hurd/i386/libpthread.abilist (sem_clockwait): Add symbol.
* nptl/Makefile (tests): Move tst-sem5 to...
* sysdeps/pthread/Makefile (tests): ... here.

4 years agohtl: fix register-atfork ordering
Samuel Thibault [Sun, 7 Jun 2020 00:57:04 +0000 (02:57 +0200)]
htl: fix register-atfork ordering

* htl/register-atfork.c (__register_atfork): Add new hooks at the end of
the list instead of the beginning.

4 years agohurd: Fix hang in _hurd_raise_signal from pthread_kill
Samuel Thibault [Sat, 6 Jun 2020 23:55:54 +0000 (01:55 +0200)]
hurd: Fix hang in _hurd_raise_signal from pthread_kill

When ss is not NULL, it is assumed to be locked.

* hurd/hurd-raise.c (_hurd_raise_signal): Unlock before returning an
error if ss is not NULL.

4 years agohurd: Reject raising invalid signals
Samuel Thibault [Sat, 6 Jun 2020 23:35:18 +0000 (01:35 +0200)]
hurd: Reject raising invalid signals

* hurd/hurd-raise.c (_hurd_raise_signal): Return  EINVAL if signo <= 0
or signo >= NSI.

4 years agohurd: fix clearing SS_ONSTACK when longjmp-ing from sighandler
Samuel Thibault [Sat, 6 Jun 2020 18:21:22 +0000 (20:21 +0200)]
hurd: fix clearing SS_ONSTACK when longjmp-ing from sighandler

* sysdeps/i386/htl/Makefile: New file.
* sysdeps/i386/htl/tcb-offsets.sym: New file.
* sysdeps/mach/hurd/i386/Makefile [setjmp] (gen-as-const-headers): Add
signal-defines.sym.
* sysdeps/mach/hurd/i386/____longjmp_chk.S: Include tcb-offsets.h.
(____longjmp_chk): Harmonize with i386's __longjmp. Clear SS_ONSTACK
when jumping off the alternate stack.
* sysdeps/mach/hurd/i386/__longjmp.S: New file.

4 years agohurd: Add pointer guard support
Samuel Thibault [Sat, 6 Jun 2020 01:26:00 +0000 (01:26 +0000)]
hurd: Add pointer guard support

* sysdeps/mach/hurd/i386/tls.h (THREAD_SET_POINTER_GUARD,
THREAD_COPY_POINTER_GUARD): New macros.

4 years agohurd: Add stack guard support
Samuel Thibault [Sat, 6 Jun 2020 00:00:19 +0000 (00:00 +0000)]
hurd: Add stack guard support

* sysdeps/mach/hurd/i386/tls.h (THREAD_SET_STACK_GUARD,
THREAD_COPY_STACK_GUARD): New macros
* sysdeps/mach/hurd/i386/ld.abilist (__stack_chk_guard): Remove symbol.

4 years agodl-runtime: reloc_{offset,index} now functions arch overide'able
Vineet Gupta [Wed, 27 May 2020 19:54:21 +0000 (12:54 -0700)]
dl-runtime: reloc_{offset,index} now functions arch overide'able

The existing macros are fragile and expect local variables with a
certain name. Fix this by defining them as functions with default
implementation in a new header dl-runtime.h which arches can override
if need be.

This came up during ARC port review, hence the need for argument pltgot
in reloc_index() which is not needed by existing ports.

This patch potentially only affects hppa/x86 ports,
build tested for both those configs and a few more.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agopowerpc64le: add optimized strlen for P9
Paul E. Murphy [Mon, 18 May 2020 16:16:06 +0000 (11:16 -0500)]
powerpc64le: add optimized strlen for P9

This started as a trivial change to Anton's rawmemchr.  I got
carried away.  This is a hybrid between P8's asympotically
faster 64B checks with extremely efficient small string checks
e.g <64B (and sometimes a little bit more depending on alignment).

The second trick is to align to 64B by running a 48B checking loop
16B at a time until we naturally align to 64B (i.e checking 48/96/144
bytes/iteration based on the alignment after the first 5 comparisons).
This allieviates the need to check page boundaries.

Finally, explicly use the P7 strlen with the runtime loader when building
P9.  We need to be cautious about vector/vsx extensions here on P9 only
builds.

4 years agopowerpc64le: use common fmaf128 implementation
Paul E. Murphy [Wed, 3 Jun 2020 18:57:20 +0000 (13:57 -0500)]
powerpc64le: use common fmaf128 implementation

This defines the macro such that it should behave best on all
supported powerpc targets.  Likewise, this allows us to remove the
ppc64le specific s_fmaf128.c.

I have verified powerpc64le multiarch and powerpc64le power9
no-multiarch builds continue to generate optimize fmaf128.

4 years agobenchtests: Restore the clock_gettime option
H.J. Lu [Fri, 5 Jun 2020 16:48:04 +0000 (09:48 -0700)]
benchtests: Restore the clock_gettime option

commit 7621e38bf3c58b2d0359545f1f2898017fd89d05
Author: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Date:   Tue Jan 29 17:43:45 2019 +0000

    Add generic hp-timing support

removed the clock_gettime option.  Restore the clock_gettime option for
some x86 CPUs on which value from RDTSC may not be incremented at a fixed
rate.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agoUpdate HP_TIMING_NOW for _ISOMAC in sysdeps/generic/hp-timing.h
H.J. Lu [Fri, 5 Jun 2020 16:43:13 +0000 (09:43 -0700)]
Update HP_TIMING_NOW for _ISOMAC in sysdeps/generic/hp-timing.h

commit e9698175b0b60407db1e89bcf29437ab224bca0b
Author: Lukasz Majewski <lukma@denx.de>
Date:   Mon Mar 16 08:31:41 2020 +0100

    y2038: Replace __clock_gettime with __clock_gettime64

breaks benchtests with sysdeps/generic/hp-timing.h:

In file included from ./bench-timing.h:23,
                 from ./bench-skeleton.c:25,
                 from
/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/benchtests/bench-rint.c:45:
./bench-skeleton.c: In function â€˜main’:
../sysdeps/generic/hp-timing.h:37:23: error: storage size of â€˜tv’ isn’t known
   37 |   struct __timespec64 tv;      \
      |                       ^~

Define HP_TIMING_NOW with clock_gettime in sysdeps/generic/hp-timing.h
if _ISOMAC is defined.  Don't define __clock_gettime in bench-timing.h
since it is no longer needed.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agoReplace val with __val in TUNABLE_SET_VAL_IF_VALID_RANGE
H.J. Lu [Thu, 4 Jun 2020 19:53:28 +0000 (12:53 -0700)]
Replace val with __val in TUNABLE_SET_VAL_IF_VALID_RANGE

There are:

 #define TUNABLE_SET_VAL_IF_VALID_RANGE(__cur, __val, __type)                 \
({                                                                            \
  __type min = (__cur)->type.min;                                             \
  __type max = (__cur)->type.max;                                             \
                                                                              \
  if ((__type) (__val) >= min && (__type) (val) <= max)                       \
                                           ^^^ Should be __val
    {                                                                         \
      (__cur)->val.numval = val;                                              \
                            ^^^ Should be __val
      (__cur)->initialized = true;                                            \
    }                                                                         \
})

Luckily since all TUNABLE_SET_VAL_IF_VALID_RANGE usages are

TUNABLE_SET_VAL_IF_VALID_RANGE (cur, val, int64_t);

this didn't cause any issues.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agosupport: Fix detecting hole support on >2KB-block filesystems
Samuel Thibault [Thu, 4 Jun 2020 18:52:19 +0000 (20:52 +0200)]
support: Fix detecting hole support on >2KB-block filesystems

When detecting hole support, we write at 16MiB, and filesystems will
typically need two levels of data to record that. On filesystems with
8KB block, the two indirection blocks will require a total of 16KB
overhead, thus 32 512-byte sectors.

Spotted on GNU/Hurd with a 4KB blocks filesystem, but also happens on Linux
with 4KB or 8KB blocks filesystems.

* support/support_descriptor_supports_holes.c
(support_descriptor_supports_holes): Set block_headroom to 32.

4 years agopowerpc: Fix powerpc64le due a7a3435c9a
Adhemerval Zanella [Thu, 4 Jun 2020 11:54:08 +0000 (08:54 -0300)]
powerpc: Fix powerpc64le due a7a3435c9a

The build uses an undefined macro evaluation for fmaf128 build.
For now set USE_FMAL_BUILTIN and USE_FMAF128_BUILTIN to 0.

Checked with a build for:

  powerpc64le-linux-gnu-power9-disable-multi-arch
  powerpc64le-linux-gnu-power9
  powerpc64le-linux-gnu
  powerpc64-linux-gnu-power8
  powerpc64-linux-gnu
  powerpc-linux-gnu-power4
  powerpc-linux-gnu

4 years agomanual/jobs.texi: remove unused var from example code
Aurélien Aptel [Sat, 23 May 2020 19:18:09 +0000 (21:18 +0200)]
manual/jobs.texi: remove unused var from example code

The do_job_notification() function defines a variable without using
it. Remove it.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agopowerpc/fpu: use generic fma functions
Vineet Gupta [Fri, 29 May 2020 23:12:44 +0000 (16:12 -0700)]
powerpc/fpu: use generic fma functions

Tested with build-many-glibcs for powerpc-linux-gnu

This is a non functional change and powerpc libm before/after was
byte invariant as compared below:

| cd /SCRATCH/vgupta/gnu/install-glibc-A-baseline
| for i in `find . -name libm-2.31.9000.so`; do
|   echo $i; diff $i /SCRATCH/vgupta/gnu/install-glibc-C-reduce-scope/$i ;
|   echo $?;
| done

| ./aarch64-linux-gnu/lib64/libm-2.31.9000.so
| 0
| ./arm-linux-gnueabi/lib/libm-2.31.9000.so
| 0
| ./x86_64-linux-gnu/lib64/libm-2.31.9000.so
| 0
| ./arm-linux-gnueabihf/lib/libm-2.31.9000.so
| 0
| ./riscv64-linux-gnu-rv64imac-lp64/lib64/lp64/libm-2.31.9000.so
| 0
| ./riscv64-linux-gnu-rv64imafdc-lp64/lib64/lp64/libm-2.31.9000.so
| 0
| ./powerpc-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./microblaze-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./nios2-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./hppa-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./s390x-linux-gnu/lib64/libm-2.31.9000.so
| 0

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoaarch/fpu: use generic builtins based math functions
Vineet Gupta [Fri, 29 May 2020 23:06:59 +0000 (16:06 -0700)]
aarch/fpu: use generic builtins based math functions

introduce sysdep header math-use-builtins.h to replace aarch64
implementations with corresponding generic ones.

 - newly inroduced generic sqrt{,f}, fma{,f}
 - existing floor{,f}, nearbyint{,f}, rint{,f}, round{,f}, trunc{,f}
 - Note that generic copysign was already enabled (via generic
   math-use-builtins.h) now thru sysdep header

Tested with build-many-glibcs for aarch64-linux-gnu

This is a non functional change and aarch64 libm before/after was
byte invariant as compared below:

| cd /SCRATCH/vgupta/gnu/install-glibc-A-baseline
| for i in `find . -name libm-2.31.9000.so`; do
|   echo $i; diff $i /SCRATCH/vgupta/gnu/install-glibc-C-reduce-scope/$i ;
|   echo $?;
| done

| ./aarch64-linux-gnu/lib64/libm-2.31.9000.so
| 0
| ./arm-linux-gnueabi/lib/libm-2.31.9000.so
| 0
| ./x86_64-linux-gnu/lib64/libm-2.31.9000.so
| 0
| ./arm-linux-gnueabihf/lib/libm-2.31.9000.so
| 0
| ./riscv64-linux-gnu-rv64imac-lp64/lib64/lp64/libm-2.31.9000.so
| 0
| ./riscv64-linux-gnu-rv64imafdc-lp64/lib64/lp64/libm-2.31.9000.so
| 0
| ./powerpc-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./microblaze-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./nios2-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./hppa-linux-gnu/lib/libm-2.31.9000.so
| 0
| ./s390x-linux-gnu/lib64/libm-2.31.9000.so
| 0

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoieee754: provide gcc builtins based generic fma functions
Vineet Gupta [Fri, 29 May 2020 22:58:33 +0000 (15:58 -0700)]
ieee754: provide gcc builtins based generic fma functions

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoieee754: provide gcc builtins based generic sqrt functions
Vineet Gupta [Fri, 29 May 2020 22:21:39 +0000 (15:21 -0700)]
ieee754: provide gcc builtins based generic sqrt functions

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoLinux: Use __pthread_attr_setsigmask_internal for timer helper thread
Florian Weimer [Tue, 19 May 2020 10:03:44 +0000 (12:03 +0200)]
Linux: Use __pthread_attr_setsigmask_internal for timer helper thread

timer_create needs to create threads with all signals blocked,
including SIGTIMER (which happens to equal SIGCANCEL).

Fixes commit b3cae39dcbfa2432b3f3aa28854d8ac57f0de1b8 ("nptl: Start
new threads with all signals blocked [BZ #25098]").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agonptl: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np
Florian Weimer [Tue, 2 Jun 2020 08:34:55 +0000 (10:34 +0200)]
nptl: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
4 years agonptl: Make pthread_attr_t dynamically extensible
Florian Weimer [Tue, 2 Jun 2020 08:33:30 +0000 (10:33 +0200)]
nptl: Make pthread_attr_t dynamically extensible

This introduces the function __pthread_attr_extension to allocate the
extension space, which is freed by pthread_attr_destroy.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agonptl: Destroy the default thread attribute as part of freeres
Florian Weimer [Tue, 19 May 2020 09:03:11 +0000 (11:03 +0200)]
nptl: Destroy the default thread attribute as part of freeres

This avoids a spurious memory leak report by valgrind.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agonptl: Change type of __default_pthread_attr
Florian Weimer [Mon, 18 May 2020 16:25:18 +0000 (18:25 +0200)]
nptl: Change type of __default_pthread_attr

union pthread_attr_transparent has always the correct size, even if
pthread_attr_t has padding that is not present in struct pthread_attr.

This should not result in an observable behavioral change.  The
existing code appears to have been correct, but it was brittle because
it was not clear which functions were allowed to write to an entire
pthread_attr_t argument (e.g., by copying it).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agonptl: Use __pthread_attr_setaffinity_np in pthread_getattr_np
Florian Weimer [Fri, 15 May 2020 15:38:57 +0000 (17:38 +0200)]
nptl: Use __pthread_attr_setaffinity_np in pthread_getattr_np

This avoids duplicating the code for the affinity mask allocation
handling.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agonptl: Use __pthread_getattr_default_np in pthread_create
Florian Weimer [Mon, 18 May 2020 15:58:30 +0000 (17:58 +0200)]
nptl: Use __pthread_getattr_default_np in pthread_create

This removes another instance of custom attribute copying code.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agonptl: Add internal alias __pthread_getattr_default_np
Florian Weimer [Fri, 15 May 2020 20:49:46 +0000 (22:49 +0200)]
nptl: Add internal alias __pthread_getattr_default_np

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 years agohtl: Fix gsync_wait symbol exposition
Samuel Thibault [Mon, 1 Jun 2020 20:21:08 +0000 (22:21 +0200)]
htl: Fix gsync_wait symbol exposition

* sysdeps/htl/pt-cond-destroy.c (__pthread_cond_destroy): Call
__gsync_wait instead of gsync_wait.

4 years agohtl: Make pthread_cond_destroy wait for threads to be woken
Samuel Thibault [Mon, 1 Jun 2020 17:27:48 +0000 (17:27 +0000)]
htl: Make pthread_cond_destroy wait for threads to be woken

This allows to reuse the storage after calling pthread_cond_destroy.

* sysdeps/htl/bits/types/struct___pthread_cond.h (__pthread_cond):
Replace unused struct __pthread_condimpl *__impl field with unsigned int
__wrefs.
(__PTHREAD_COND_INITIALIZER): Update accordingly.
* sysdeps/htl/pt-cond-timedwait.c (__pthread_cond_timedwait_internal):
Register as waiter in __wrefs field. On unregistering, wake any pending
pthread_cond_destroy.
* sysdeps/htl/pt-cond-destroy.c (__pthread_cond_destroy): Register wake
request in __wrefs.
* nptl/Makefile (tests): Move tst-cond20 tst-cond21 to...
* sysdeps/pthread/Makefile (tests): ... here.
* nptl/tst-cond20.c nptl/tst-cond21.c: Move to...
* sysdeps/pthread/tst-cond20.c sysdeps/pthread/tst-cond21.c: ... here.

4 years agohtl: Enable more cond tests
Samuel Thibault [Mon, 1 Jun 2020 17:06:21 +0000 (17:06 +0000)]
htl: Enable more cond tests

* nptl/Makefile (tests): Move tst-cond11 and tst-cond27 to...
* sysdeps/pthread/Makefile (tests): ... here.

4 years agotst-cond11: Fix build with _SC_MONOTONIC_CLOCK > 0
Samuel Thibault [Mon, 1 Jun 2020 17:04:02 +0000 (17:04 +0000)]
tst-cond11: Fix build with _SC_MONOTONIC_CLOCK > 0

* sysdeps/pthread/tst-cond11.c (do_test): Fix misplaced brace.

4 years agombstowcs: Document, test, and fix null pointer dst semantics (Bug 25219)
Carlos O'Donell [Thu, 21 May 2020 21:50:53 +0000 (17:50 -0400)]
mbstowcs: Document, test, and fix null pointer dst semantics (Bug 25219)

The function mbstowcs, by an XSI extension to POSIX, accepts a null
pointer for the destination wchar_t array.  This API behaviour allows
you to use the function to compute the length of the required wchar_t
array i.e. does the conversion without storing it and returns the
number of wide characters required.

We remove the __write_only__ markup for the first argument because it
is not true since the destination may be a null pointer, and so the
length argument may not apply.  We remove the markup otherwise the new
test case cannot be compiled with -Werror=nonnull.

We add a new test case for mbstowcs which exercises the destination is
a null pointer behaviour which we have now explicitly documented.

The mbsrtowcs and mbsnrtowcs behave similarly, and mbsrtowcs is
documented as doing this in C11, even if the standard doesn't come out
and call out this specific use case.  We add one note to each of
mbsrtowcs and mbsnrtowcs to call out that they support a null pointer
for the destination.

The wcsrtombs function behaves similarly but in the other way around
and allows you to use a null destination pointer to compute how many
bytes you would need to convert the wide character input.  We document
this particular case also, but leave wcsnrtombs as a references to
wcsrtombs, so the reader must still read the details of the semantics
for wcsrtombs.

4 years agobuild: Use FAIL_EXIT1 () on failure to exec child [BZ #23990]
Girish Joshi [Fri, 29 May 2020 13:11:24 +0000 (10:11 -0300)]
build: Use FAIL_EXIT1 () on failure to exec child [BZ #23990]

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agomanual: Fix backtraces code example [BZ #10441]
Girish Joshi [Fri, 29 May 2020 13:06:53 +0000 (10:06 -0300)]
manual: Fix backtraces code example [BZ #10441]

Validation for pointer returned by backtrace_symbols () added.
Type of variables size and i is changed from size_t to int.

Variable size is used to collect the result from backtrace ()
that is an int. i is the loop counter variable so it can be an int.

Since, size_t size is changed to int size, in printf %zd is changed to %d.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 years agohurd: Fix fexecve
Samuel Thibault [Thu, 28 May 2020 23:28:07 +0000 (23:28 +0000)]
hurd: Fix fexecve

* sysdeps/mach/hurd/fexecve.c (fexecve): Re-lookup fd with O_EXEC before
calling _hurd_exec_paths.

4 years agoi386: Remove unused file sysdeps/unix/i386/sysdep.S
Florian Weimer [Thu, 28 May 2020 08:50:24 +0000 (10:50 +0200)]
i386: Remove unused file sysdeps/unix/i386/sysdep.S

Linux overrides this file via sysdeps/unix/sysv/linux/i386/sysdep.c.
Hurd does not have sysdeps/unix/i386 on its search path, so it uses
csu/sysdep.c instead.

4 years agohurd: fix ptsname error when called on a non-tty
Samuel Thibault [Thu, 28 May 2020 10:22:36 +0000 (10:22 +0000)]
hurd: fix ptsname error when called on a non-tty

* sysdeps/mach/hurd/ptsname.c (__ptsname_internal): Replace
not-supported errors from __term_get_peername with ENOTTY.

4 years agohurd: Fix fdopendir checking for directory type
Samuel Thibault [Thu, 28 May 2020 10:13:14 +0000 (10:13 +0000)]
hurd: Fix fdopendir checking for directory type

* sysdeps/mach/hurd/fdopendir.c (__fdopendir): Lookup "./" instead of
"/" that would designate the root of the filesystem.

4 years agoi386: Remove NO_TLS_DIRECT_SEG_REFS handling
Florian Weimer [Thu, 28 May 2020 08:51:15 +0000 (10:51 +0200)]
i386: Remove NO_TLS_DIRECT_SEG_REFS handling

This was needed for 32-bit PV Xen, which has been superseded by this
point according to Xen developers.

4 years agoHurd: Move <hurd/sigpreempt.h> internals into wrapper header
Florian Weimer [Thu, 28 May 2020 09:19:04 +0000 (11:19 +0200)]
Hurd: Move <hurd/sigpreempt.h> internals into wrapper header

_hurdsig_preemptors and _hurdsig_preempted_set are not ABI symbols,
so do not declare them.  HURD_PREEMPT_SIGNAL_P is an implementation
detail, so move it as well.

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agoHurd: Use __sigmask in favor of deprecated sigmask
Florian Weimer [Thu, 28 May 2020 09:17:51 +0000 (11:17 +0200)]
Hurd: Use __sigmask in favor of deprecated sigmask

This fixes various build errors due to deprecation warnings.

Fixes commit 02802fafcf6e11ea3f998f685035ffe568dfddeb
("signal: Deprecate additional legacy signal handling functions").

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agohurd: Fix pselect atomicity
Samuel Thibault [Wed, 27 May 2020 23:42:24 +0000 (23:42 +0000)]
hurd: Fix pselect atomicity

In case the signal arrives before the __mach_msg call, we need to catch
between the sigprocmask call and the __mach_msg call.  Let's just reuse
the support for sigsuspend to make the signal send a message that
our __mach_msg call will just receive.

* hurd/hurdselect.c (_hurd_select): Add sigport and ss variables. When
sigmask is not NULL, create a sigport port and register as
ss->suspended.  Add it to the portset.  When we receive a message on it,
set error to EINTR.  Clean up sigport and portset appropriately.

* hurd/hurdsig.c (wake_sigsuspend): Note that pselect also uses it.

4 years agoelf: Remove extra hwcap mechanism from ldconfig
Florian Weimer [Thu, 28 May 2020 08:21:17 +0000 (10:21 +0200)]
elf: Remove extra hwcap mechanism from ldconfig

Historically, this mechanism was used to process "nosegneg"
subdirectories, and it is still used to include the "tls"
subdirectories.  With nosegneg support gone from ld.so, this is part
no longer useful.

The entire mechanism is not well-designed because it causes the
meaning of hwcap bits in ld.so.cache to depend on the kernel version
that was used to generate the cache, which makes it difficult to use
this mechanism for anything else in the future.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoelf: Do not read hwcaps from the vDSO in ld.so
Florian Weimer [Thu, 28 May 2020 08:20:56 +0000 (10:20 +0200)]
elf: Do not read hwcaps from the vDSO in ld.so

This was only ever used for the "nosegneg" flag.  This approach for
passing hardware capability information creates a subtle dependency
between the kernel and userspace, and ld.so.cache contents.  It seems
inappropriate for toady, where people expect to be able to run
system images which very different kernel versions.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agolinux: Use internal DIR locks when accessing filepos on telldir
Adhemerval Zanella [Tue, 14 Apr 2020 20:41:56 +0000 (17:41 -0300)]
linux: Use internal DIR locks when accessing filepos on telldir

Since it might change during a readdir call.

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

4 years agoUpdate i386 libm-test-ulps
Samuel Thibault [Tue, 26 May 2020 11:21:57 +0000 (13:21 +0200)]
Update i386 libm-test-ulps

4 years agohtl: Add clock variants
Samuel Thibault [Tue, 26 May 2020 00:09:11 +0000 (00:09 +0000)]
htl: Add clock variants

* htl/pt-join.c (__pthread_join): Move implementation to...
(__pthread_join_common): ... new function. Add try, timed and clock support.
(__pthread_join): Reimplement on top of __pthread_join_common.
(__pthread_tryjoin_np, __pthread_timedjoin_np, __pthread_clockjoin_np):
Implement on top of __pthread_join_common.
(pthread_tryjoin_np, pthread_timedjoin_np, pthread_clockjoin_np): New
aliases.

* hurd/hurdlock.c (__lll_abstimed_wait, __lll_abstimed_xwait,
__lll_abstimed_lock): Check for supported clock.

* sysdeps/htl/pt-cond-timedwait.c (__pthread_cond_timedwait_internal):
Add clockid parameter and support it.
(__pthread_cond_timedwait): Pass -1 as clockid.
(__pthread_cond_clockwait): New function.
(pthread_cond_clockwait): New alias.
* sysdeps/htl/pt-cond-wait.c (__pthread_cond_timedwait_internal): Update
prototype.
(__pthread_cond_wait): Pass -1 as clockid.

* sysdeps/htl/pt-rwlock-timedrdlock.c
(__pthread_rwlock_timedrdlock_internal): Add clockid parameter, and
support id.
(__pthread_rwlock_clockrdlock): New function.
(pthread_rwlock_clockrdlock): New alias.
* sysdeps/htl/pt-rwlock-rdlock.c (__pthread_rwlock_timedrdlock_internal): Update
prototype.
(__pthread_rwlock_rdlock): Pass -1 as clockid.

* sysdeps/htl/pt-rwlock-timedwrlock.c
(__pthread_rwlock_timedwrlock_internal): Add clockid parameter, and
support id.
(__pthread_rwlock_clockwrlock): New function.
(pthread_rwlock_clockwrlock): New alias.
* sysdeps/htl/pt-rwlock-wrlock.c (__pthread_rwlock_timedwrlock_internal): Update
prototype.
(__pthread_rwlock_wrlock): Pass -1 as clockid.

* sysdeps/mach/hurd/htl/pt-mutex-timedlock.c (__pthread_mutex_timedlock): Move implementation to
(__pthread_mutex_clocklock): New function with additional clockid
parameter and support it.
(pthread_mutex_clocklock): New alias.
(__pthread_mutex_timedlock): Reimplement on top of __pthread_mutex_clocklock.

* sysdeps/htl/pthread.h (pthread_tryjoin_np, pthread_timedjoin_np,
pthread_clockjoin_np, pthread_mutex_clocklock, pthread_cond_clockwait,
pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock): New prototypes.
* sysdeps/htl/pthreadP.h (__pthread_cond_clockwait): New prototype.

* htl/Versions (GLIBC_2.32): Add pthread_cond_clockwait,
pthread_mutex_clocklock, pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock,
pthread_tryjoin_np, pthread_timedjoin_np, pthread_clockjoin_np.
* sysdeps/mach/hurd/i386/libpthread.abilist (pthread_clockjoin_np,
pthread_cond_clockwait, pthread_mutex_clocklock, pthread_rwlock_clockrdlock,
pthread_rwlock_clockwrlock, pthread_timedjoin_np, pthread_tryjoin_np):
New functions.

* nptl/tst-abstime.c, nptl/tst-join10.c, nptl/tst-join11.c, nptl/tst-join12.c,
nptl/tst-join13.c, nptl/tst-join14.c, nptl/tst-join2.c, nptl/tst-join3.c,
nptl/tst-join8.c, nptl/tst-join9.c, nptl/tst-mutex-errorcheck.c,
nptl/tst-pthread-mutexattr.c, nptl/tst-mutex11.c, nptl/tst-mutex5.c,
nptl/tst-mutex7.c, nptl/tst-mutex7robus.c, nptl/tst-mutex9.c,
nptl/tst-rwlock12.c, nptl/tst-rwlock14.c: Move to sysdeps/pthread.
* sysdeps/pthread/tst-mutex8.c: Move back to nptl.
* nptl/Makefile (tests): Move tst-mutex5, tst-mutex7, tst-mutex7robust,
tst-mutex9, tst-mutex11, tst-rwlock12, tst-rwlock14, tst-join2, tst-join3,
tst-join8, tst-join9 tst-join10, tst-join11, tst-join12, tst-join13, tst-join14,
tst-abstime, tst-mutex-errorcheck, tst-pthread-mutexattr to ...
* sysdeps/pthread/Makefile (tests): ... here.

4 years agosignal: Deprecate additional legacy signal handling functions
Florian Weimer [Mon, 25 May 2020 16:32:28 +0000 (18:32 +0200)]
signal: Deprecate additional legacy signal handling functions

This needs a few test adjustments: In some cases, sigignore was
used for convenience (replaced with xsignal with SIG_IGN).  Tests
for the deprecated functions need to disable
-Wdeprecated-declarations, and for the sigmask deprecation,
-Wno-error.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoelf: Turn _dl_printf, _dl_error_printf, _dl_fatal_printf into functions
Florian Weimer [Mon, 25 May 2020 16:17:27 +0000 (18:17 +0200)]
elf: Turn _dl_printf, _dl_error_printf, _dl_fatal_printf into functions

This change makes it easier to set a breakpoint on these calls.

This also addresses the issue that including <ldsodefs.h> without
<unistd.h> does not result usable _dl_*printf macros because of the
use of the STD*_FILENO macros there.

(The private symbol for _dl_fatal_printf will go away again
once the exception handling implementation is unified between
libc and ld.so.)

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agox86: Update Intel Atom processor family optimization
H.J. Lu [Thu, 21 May 2020 20:36:54 +0000 (13:36 -0700)]
x86: Update Intel Atom processor family optimization

Enable Intel Silvermont optimization for Intel Goldmont Plus.  Detect more
Intel Airmont processors.  Optimize Intel Tremont like Intel Silvermont
with rep string instructions.

4 years agoelf.h: add aarch64 property definitions
Szabolcs Nagy [Wed, 1 Apr 2020 08:25:47 +0000 (09:25 +0100)]
elf.h: add aarch64 property definitions

These property values are specified by the AArch64 ELF ABI and
binutils can create binaries marked with them.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 years agoelf.h: Add PT_GNU_PROPERTY
Szabolcs Nagy [Thu, 26 Mar 2020 09:22:12 +0000 (09:22 +0000)]
elf.h: Add PT_GNU_PROPERTY

This program header type is already used in binaries on x86 and
aarch64 targets.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This page took 0.149819 seconds and 5 git commands to generate.