Commit Graph

35919 Commits

Author SHA1 Message Date
Samuel Thibault
e2b9d562d1 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.
2020-06-14 15:53:04 +00:00
Samuel Thibault
ea5cad3e37 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.
2020-06-14 12:53:38 +00:00
Samuel Thibault
89edef7b39 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.
2020-06-14 00:19:35 +00:00
Paul E. Murphy
146fea0764 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>
2020-06-11 17:15:49 -05:00
Joseph Myers
c477beb2cc 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).
2020-06-10 22:53:55 +00:00
Samuel Thibault
62d97c3432 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.
2020-06-10 21:34:19 +00:00
Samuel Thibault
bc9cf8fbe8 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.
2020-06-10 21:34:19 +00:00
H.J. Lu
533dd2acf7 Add "%d" support to _dl_debug_vdprintf
"%d" will be used to print out signed value.
2020-06-09 12:15:01 -07:00
Andrea Corallo
a365ac45b7 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>
2020-06-09 09:21:11 +01:00
Andrea Corallo
49beaaec1b 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>
2020-06-09 09:20:27 +01:00
Andrea Corallo
f7de454f20 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>
2020-06-09 09:20:27 +01:00
Krzysztof Koch
d1f75e9644 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>
2020-06-08 14:13:05 +01:00
Samuel Thibault
f112dcc506 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.
2020-06-08 14:41:57 +02:00
Samuel Thibault
dd7a8ad7ba 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.
2020-06-08 14:34:22 +02:00
Samuel Thibault
314a431d37 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.
2020-06-07 23:45:25 +00:00
Samuel Thibault
15e995a8fb 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.
2020-06-07 23:36:42 +00:00
Samuel Thibault
af27fabe40 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.
2020-06-07 23:36:40 +00:00
Samuel Thibault
3944c61bdf 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.
2020-06-07 23:36:10 +00:00
Samuel Thibault
337a7b74fa 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.
2020-06-07 23:36:10 +00:00
Samuel Thibault
4bab9ad854 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.
2020-06-07 16:14:23 +02:00
Samuel Thibault
7b6b18319e 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.
2020-06-07 15:37:33 +02:00
Samuel Thibault
e797c57f93 hurd: Briefly document in xfails the topics of the bugzilla entries
* sysdeps/mach/hurd/i386/Makefile: Add comments.
2020-06-07 15:35:12 +02:00
Samuel Thibault
d6d74ec16c 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
2020-06-07 13:35:54 +02:00
Samuel Thibault
be22a151f3 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.
2020-06-07 03:14:49 +02:00
Samuel Thibault
6c5ca98d09 htl: fix register-atfork ordering
* htl/register-atfork.c (__register_atfork): Add new hooks at the end of
the list instead of the beginning.
2020-06-07 03:00:22 +02:00
Samuel Thibault
fab94894d5 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.
2020-06-07 01:57:26 +02:00
Samuel Thibault
785ec62dbd hurd: Reject raising invalid signals
* hurd/hurd-raise.c (_hurd_raise_signal): Return  EINVAL if signo <= 0
or signo >= NSI.
2020-06-07 01:36:24 +02:00
Samuel Thibault
02937d825a 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.
2020-06-06 20:24:30 +02:00
Samuel Thibault
8fcc772da8 hurd: Add pointer guard support
* sysdeps/mach/hurd/i386/tls.h (THREAD_SET_POINTER_GUARD,
THREAD_COPY_POINTER_GUARD): New macros.
2020-06-06 03:29:44 +02:00
Samuel Thibault
ecfa912f42 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.
2020-06-06 02:04:32 +02:00
Vineet Gupta
8dbb7a08ec 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>
2020-06-05 13:45:46 -07:00
Paul E. Murphy
a23bd00f9d 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.
2020-06-05 15:30:00 -05:00
Paul E. Murphy
6ef4227509 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.
2020-06-05 15:29:44 -05:00
H.J. Lu
e52434a2e4 benchtests: Restore the clock_gettime option
commit 7621e38bf3
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>
2020-06-05 09:48:07 -07:00
H.J. Lu
f607047668 Update HP_TIMING_NOW for _ISOMAC in sysdeps/generic/hp-timing.h
commit e9698175b0
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>
2020-06-05 09:44:06 -07:00
H.J. Lu
9b7424215b 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>
2020-06-04 14:01:14 -07:00
Samuel Thibault
3f6e4fc454 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.
2020-06-04 21:27:05 +02:00
Adhemerval Zanella
6f10ff02cb 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
2020-06-04 09:05:41 -03:00
Aurélien Aptel
74edc05817 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>
2020-06-03 18:09:45 -04:00
Vineet Gupta
a7a3435c9a 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>
2020-06-03 10:23:33 -07:00
Vineet Gupta
c9feb1be93 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>
2020-06-03 10:23:33 -07:00
Vineet Gupta
628d90c5f9 ieee754: provide gcc builtins based generic fma functions
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2020-06-03 10:23:28 -07:00
Vineet Gupta
3374868668 ieee754: provide gcc builtins based generic sqrt functions
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2020-06-03 10:23:22 -07:00
Florian Weimer
ba9f6ee9bb 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 b3cae39dcb ("nptl: Start
new threads with all signals blocked [BZ #25098]").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-06-02 11:59:26 +02:00
Florian Weimer
ec41af45a6 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>
2020-06-02 11:59:18 +02:00
Florian Weimer
7538d46113 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>
2020-06-02 11:54:58 +02:00
Florian Weimer
6993670b52 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>
2020-06-02 10:32:47 +02:00
Florian Weimer
c2322a561f 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>
2020-06-02 10:32:37 +02:00
Florian Weimer
86ed0774cf 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>
2020-06-02 10:32:30 +02:00
Florian Weimer
8111c457b8 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>
2020-06-02 10:32:23 +02:00