Commit Graph

37476 Commits

Author SHA1 Message Date
Siddhesh Poyarekar
fc5bfade69 iconvdata: Move gconv-modules configuration to gconv-modules.conf
Move all gconv-modules configuration files to gconv-modules.conf.
That is, the S390 extensions now become gconv-modules-s390.conf.  Move
both configuration files into gconv-modules.d.

Now GCONV_PATH/gconv-modules is read only for backward compatibility
for third-party gconv modules directories.

Reviewed-by: DJ Delorie <dj@redhat.com>
2021-06-09 09:47:16 +05:30
Siddhesh Poyarekar
b17d29b390 gconv_conf: Read configuration files in gconv-modules.d
Read configuration files with names ending in .conf in
GCONV_PATH/gconv-modules.d to mirror configuration flexibility in
iconvconfig into the iconv program and function.

Reviewed-by: DJ Delorie <dj@redhat.com>
2021-06-09 09:47:16 +05:30
Siddhesh Poyarekar
3979c3e1ba iconvconfig: Read configuration from gconv-modules.d subdirectory
In addition to GCONV_PATH/gconv-modules, also read module
configuration from *.conf files in GCONV_PATH/gconv-modules.d.  This
allows a single gconv directory to have multiple sets of gconv modules
but at the same time, a single modules cache.

With this feature, one could separate the glibc supported gconv
modules into a minimal essential set (ISO-8859-*, UTF, etc.) from the
remaining modules.  In future, these could be further segregated into
langpack-associated sets with their own
gconv-modules.d/someconfig.conf.

Reviewed-by: DJ Delorie <dj@redhat.com>
2021-06-09 09:47:16 +05:30
Siddhesh Poyarekar
0c78b0bb78 iconvconfig: Make file handling more general purpose
Split out configuration file handling code from handle_dir into its
own function so that it can be reused for multiple configuration
files.

Reviewed-by: DJ Delorie <dj@redhat.com>
2021-06-09 09:47:16 +05:30
Wilco Dijkstra
6a86bc0992 AArch64: Add support for roundeven[f]
Add inline assembler for the roundeven functions.
Passes GLIBC regression.  Note GCC does not inline the builtin (PR100966),
so this cannot be used for now.
2021-06-08 13:33:09 +01:00
Naohiro Tamura
b190bccc8a configure: Replaced obsolete AC_TRY_COMPILE
This patch replaced obsolete AC_TRY_COMPILE to AC_COMPILE_IFELSE or
AC_PREPROC_IFELSE.
It has been confirmed that GNU 'autoconf' 2.69 suppressed obsolete
warnings, updated the following files:
  - configure
  - sysdeps/mach/configure
  - sysdeps/mach/hurd/configure
  - sysdeps/s390/configure
  - sysdeps/unix/sysv/linux/configure
and didn't change the following files:
  - sysdeps/ieee754/ldbl-opt/configure
  - sysdeps/unix/sysv/linux/powerpc/configure

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-04 10:16:00 -03:00
Adhemerval Zanella
57094e576a libio: Assume _IO_lock_inexpensive
It is already set by both Linux and Hurd.
2021-06-04 09:54:52 -03:00
Adhemerval Zanella
eaa53d0f77 nptl: Remove exit-thread.h
No function change.  The code is used only for Linux, besides
being included in generic code.
2021-06-04 09:52:28 -03:00
Sunil K Pandey
642213e043 Improve test coverage of strnlen function
This patch covers the following condition:

Strings start with different alignments and end with length less than or
equal to 512 byte.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-06-03 11:16:51 -07:00
Florian Weimer
466c1ea15f dlfcn: Rework static dlopen hooks
Consolidate all hooks structures into a single one.  There are
no static dlopen ABI concerns because glibc 2.34 already comes
with substantial ABI-incompatible changes in this area.  (Static
dlopen requires the exact same dynamic glibc version that was used
for static linking.)

The new approach uses a pointer to the hooks structure into
_rtld_global_ro and initalizes it in __rtld_static_init.  This avoids
a back-and-forth with various callback functions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 09:12:05 +02:00
Florian Weimer
9c76debc98 dlfcn: Eliminate GLIBC_PRIVATE dependency from tststatic2
The test appears to use _dlfcn_hook@@GLIBC_PRIVATE as a way to
test dlvsym without having to know the appropriate symbol version.
With <first-versions.h>, we can use a public symbol and the symbol
version at which it was defined first.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 09:12:05 +02:00
Florian Weimer
6f1c701026 dlfcn: Cleanups after -ldl is no longer required
This commit removes the ELF constructor and internal variables from
dlfcn/dlfcn.c.  The file now serves the same purpose as
nptl/libpthread-compat.c, so it is renamed to dlfcn/libdl-compat.c.
The use of libdl-shared-only-routines ensures that libdl.a is empty.

This commit adjusts the test suite not to use $(libdl).  The libdl.so
symbolic link is no longer installed.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 09:11:45 +02:00
Florian Weimer
0c1c3a771e dlfcn: Move dlopen into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 08:26:04 +02:00
Florian Weimer
add8d7ea01 dlfcn: Move dlvsym into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 08:26:04 +02:00
Florian Weimer
6dfc0207eb dlfcn: Move dlinfo into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 08:26:04 +02:00
Florian Weimer
492560a32e dlfcn: Move dladdr1 into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 08:26:04 +02:00
Florian Weimer
6a1ed32789 dlfcn: Move dlmopen into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 08:26:04 +02:00
Florian Weimer
77f876c0e3 dlfcn: Move dlsym into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

In elf/Makefile, remove the $(libdl) dependency from testobj1.so
because it the unused libdl DSO now causes elf/tst-unused-deps to
fail.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 08:26:04 +02:00
Florian Weimer
602252b553 dlfcn: Move dladdr into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 08:26:04 +02:00
Florian Weimer
d8cce17d2a dlfcn: Move dlclose into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-03 08:26:04 +02:00
Sunil K Pandey
c9ff9cf66a Improve test coverage of strlen function
This patch covers the following conditions:

- Strings start with different alignments and end at the page boundary
  with less than 64 byte length.
- Strings starts with different alignments and cross page boundary with
  fixed length.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-06-02 05:37:43 -07:00
Xeonacid
5295172e20 fix typo
"accomodate" should be "accommodate"
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2021-06-02 12:16:49 +02:00
Florian Weimer
a23c28ec0d dlfcn: Move dlerror into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

There is a minor functionality enhancement: dlerror now sets
errno if it was set as part of the exception.  (This is the result
of using %m in asprintf, to avoid the strerror PLT call.) The
previous errno value upon function return was unpredictable.
Documenting this as a feature is premature; we need to make sure
that the error codes are meaningful when they are set by the dynamic
loader.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-02 09:06:10 +02:00
Florian Weimer
c44838ebf8 Add libc ABI extension kludge for baseline-violating libdl symbols
Some targets have a GLIBC_2.0 baseline for libdl, while using
GLIBC_2.2 for libc.  This means that the generated libc.map file
does not have any version nodes for GLIBC_2.0 or GLIBC_2.1.  However,
moving symbols from libdl into libc needs such version nodes.
(Future symbol moves from librt will need this as well.)

This kludge is only necessary for symbols predating GLIBC_2.2 because
the affected targets use GLIBC_2.2 as the baseline for libc.  Given
the small number and fixed set of affected architectures, no generic
mechanism is implemented, and instead the map file fragment is
hard-coded in scripts/versions.mk.

The compat_symbol macro already emits the appropriate version strings,
so no adjustments are needed there.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-02 07:34:24 +02:00
Florian Weimer
d32ee64df7 scripts/versions.awk: Add local: * to all version nodes
This requires that all exported symbol versions are listed in
Versions files.  It results in more consistent behavior across
architectures because previously, symbols could be exported
via explicit versioned_symbol and compat_symbol macros if the
version node existed in some Versions file (without listing the
symbol), and it was not the base version for the library (which
already had the local: * directive).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-02 07:32:44 +02:00
Florian Weimer
186cd80b1e Add missing symbols to Version files
Some symbols have explicit versioned_symbol or compat_symbol markers
in the sources, but no corresponding entry in the Versions files.
This presently works because the local: * directive is only applied
to the base version.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-02 07:32:19 +02:00
Florian Weimer
217b6dc298 Fix use of __pthread_attr_copy in mq_notify (bug 27896)
__pthread_attr_copy can fail and does not initialize the attribute
structure in that case.

If __pthread_attr_copy is never called and there is no allocated
attribute, pthread_attr_destroy should not be called, otherwise
there is a null pointer dereference in rt/tst-mqueue6.

Fixes commit 42d3593505
("Use __pthread_attr_copy in mq_notify (bug 27896)").

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-06-02 07:12:18 +02:00
Andreas Schwab
42d3593505 Use __pthread_attr_copy in mq_notify (bug 27896)
Make a deep copy of the pthread attribute object to remove a potential
use-after-free issue.
2021-06-01 17:12:33 +02:00
Joseph Myers
858045ad1c Update floating-point feature test macro handling for C2X
ISO C2X has made some changes to the handling of feature test macros
related to features from the floating-point TSes, and to exactly what
such features are present in what headers, that require corresponding
changes in glibc.

* For the few features that were controlled by
  __STDC_WANT_IEC_60559_BFP_EXT__ (and the corresponding DFP macro) in
  C2X, there is now instead a new feature test macro
  __STDC_WANT_IEC_60559_EXT__ covering both binary and decimal FP.
  This controls CR_DECIMAL_DIG in <float.h> (provided by GCC; I
  implemented support for the new feature test macro for GCC 11) and
  the totalorder and payload functions in <math.h>.  C2X no longer
  says anything about __STDC_WANT_IEC_60559_BFP_EXT__ (so it's
  appropriate for that macro to continue to enable exactly the
  features from TS 18661-1).

* The SNAN macros for each floating-point type have moved to <float.h>
  (and been renamed in the process).  Thus, the copies in <math.h>
  should only be defined for __STDC_WANT_IEC_60559_BFP_EXT__, not for
  C2X.

* The fmaxmag and fminmag functions have been removed (replaced by new
  functions for the new min/max operations in IEEE 754-2019).  Thus
  those should also only be declared for
  __STDC_WANT_IEC_60559_BFP_EXT__.

* The _FloatN / _FloatNx handling for the last two points in glibc is
  trickier, since __STDC_WANT_IEC_60559_TYPES_EXT__ is still in C2X
  (the integration of TS 18661-3 as an Annex, that is, which hasn't
  yet been merged into the C standard git repository but has been
  accepted by WG14), so C2X with that macro should not declare some
  things that are declared for older standards with that macro.  The
  approach taken here is to provide the declarations (when
  __STDC_WANT_IEC_60559_TYPES_EXT__ is enabled) only when (defined
  __USE_GNU || !__GLIBC_USE (ISOC2X)), so if C2X features are enabled
  then those declarations (that are only in TS 18661-3 and not in C2X)
  will only be provided if _GNU_SOURCE is defined as well.  Thus
  _GNU_SOURCE remains a superset of the TS features as well as of C2X.

Some other somewhat related changes in C2X are not addressed here.
There's an open proposal not to include the fmin and fmax functions
for the _FloatN / _FloatNx types, given the new min/max operations,
which could be handled like the previous point if adopted.  And the
fromfp functions have been changed to return a result in floating type
rather than intmax_t / uintmax_t; my inclination there is to treat
that like that change of totalorder type (new symbol versions etc. for
the ABI change; old versions become compat symbols and are no longer
supported as an API).

Tested for x86_64 and x86.
2021-06-01 14:22:06 +00:00
Florian Weimer
c8a11c5867 stdio-common: Remove _IO_vfwscanf
The symbol has never been exported, so no compatibility symbol is
needed.  Removing this file prevents ld from creation an exported
symbol in case GLIBC_2_0 expands to a symbol version which
does not have a local: *; directive in the symbol version map file.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-01 16:00:52 +02:00
Szabolcs Nagy
3842ba4949 aarch64: align stack in clone [BZ #27939]
The AArch64 PCS requires 16 byte aligned stack.  Previously if the
caller passed an unaligned stack to clone then the child crashed.

Fixes bug 27939.
2021-06-01 09:47:48 +01:00
Lucas A. M. Magalhaes
a55e2da270 powerpc: Optimized memcmp for power10
This patch was based on the __memcmp_power8 and the recent
__strlen_power10.

Improvements from __memcmp_power8:

1. Don't need alignment code.

   On POWER10 lxvp and lxvl do not generate alignment interrupts, so
they are safe for use on caching-inhibited memory.  Notice that the
comparison on the main loop will wait for both VSR to be ready.
Therefore aligning one of the input address does not improve
performance.  In order to align both registers a vperm is necessary
which add too much overhead.

2. Uses new POWER10 instructions

   This code uses lxvp to decrease contention on load by loading 32 bytes
per instruction.
   The vextractbm is used to have a smaller tail code for calculating the
return value.

3. Performance improvement

   This version has around 35% better performance on average. I saw no
performance regressions for any length or alignment.

Thanks Matheus for helping me out with some details.

Co-authored-by: Matheus Castanho <msc@linux.ibm.com>
Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
2021-05-31 18:00:20 -03:00
H.J. Lu
92a7d13439 x86-64: Align child stack to 16 bytes [BZ #27902]
In the x86-64 clone wrapper, align child stack to 16 bytes per the
x86-64 psABI.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-05-31 12:03:36 -07:00
Adhemerval Zanella
271ec55d0a support: Do not build xpthread_attr_setaffinity_np for hurd
It does not provide pthread_attr_setaffinity_np extension.
2021-05-28 16:00:19 -03:00
Adhemerval Zanella
2c44452b61 nptl: Add pthread_attr_setaffinity_np failure test
It checks whether an invalid affinity mask does return an error,
similar to what sysdeps/pthread/tst-bad-schedattr.c does for
pthread_attr_setschedparam.

Checked on x86_64-linux-gnu.
2021-05-27 13:12:16 -03:00
Adhemerval Zanella
d85ad0e58a support: Add xpthread_attr_setaffinity_np wrapper 2021-05-27 13:12:07 -03:00
Adhemerval Zanella
42813c675d nptl: Move createthread to pthread_create
The 'create_thread' function is moved to pthread_create.c.  It removes
the START_THREAD_DEFN and START_THREAD_SELF macros and make the
lock usage more clear (no need to cross-reference multiple files).

No functional change.
2021-05-27 13:11:41 -03:00
Adhemerval Zanella
65ba6fa431 nptl: Move Linux createthread to nptl
git mv -f sysdeps/unix/sysv/linux/createthread.c nptl/createthread.c

No functional change.
2021-05-27 13:11:35 -03:00
Florian Weimer
76b0c59e33 nptl: Install SIGSETXID handler with SA_ONSTACK [BZ #27914]
The signal is sent to all threads, some of which may have switched
to very small stacks.  If they have also installed an alternate
signal stack, SA_ONSTACK makes this work.  The Go runtime needs this:

  runtime: C.setuid/C.setgid smashes Go stack
  <https://github.com/golang/go/issues/9400>

Doing this for SIGCANCEL is less obviously beneficial and needs further
testing.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-05-27 15:37:35 +02:00
Naohiro Tamura
4f26956d5b aarch64: Added optimized memset for A64FX
This patch optimizes the performance of memset for A64FX [1] which
implements ARMv8-A SVE and has L1 64KB cache per core and L2 8MB cache
per NUMA node.

The performance optimization makes use of Scalable Vector Register
with several techniques such as loop unrolling, memory access
alignment, cache zero fill and prefetch.

SVE assembler code for memset is implemented as Vector Length Agnostic
code so theoretically it can be run on any SOC which supports ARMv8-A
SVE standard.

We confirmed that all testcases have been passed by running 'make
check' and 'make xcheck' not only on A64FX but also on ThunderX2.

And also we confirmed that the SVE 512 bit vector register performance
is roughly 4 times better than Advanced SIMD 128 bit register and 8
times better than scalar 64 bit register by running 'make bench'.

[1] https://github.com/fujitsu/A64FX

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Reviewed-by: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
2021-05-27 09:47:53 +01:00
Naohiro Tamura
fa527f345c aarch64: Added optimized memcpy and memmove for A64FX
This patch optimizes the performance of memcpy/memmove for A64FX [1]
which implements ARMv8-A SVE and has L1 64KB cache per core and L2 8MB
cache per NUMA node.

The performance optimization makes use of Scalable Vector Register
with several techniques such as loop unrolling, memory access
alignment, cache zero fill, and software pipelining.

SVE assembler code for memcpy/memmove is implemented as Vector Length
Agnostic code so theoretically it can be run on any SOC which supports
ARMv8-A SVE standard.

We confirmed that all testcases have been passed by running 'make
check' and 'make xcheck' not only on A64FX but also on ThunderX2.

And also we confirmed that the SVE 512 bit vector register performance
is roughly 4 times better than Advanced SIMD 128 bit register and 8
times better than scalar 64 bit register by running 'make bench'.

[1] https://github.com/fujitsu/A64FX

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Reviewed-by: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
2021-05-27 09:47:53 +01:00
Naohiro Tamura
f12ec02f53 benchtests: Fixed bench-memcpy-random: buf1: mprotect failed
This patch fixed mprotect system call failure on AArch64.
This failure happened on not only A64FX but also ThunderX2.

Also this patch updated a JSON key from "max-size" to "length" so that
'plot_strings.py' can process 'bench-memcpy-random.out'
2021-05-26 12:01:06 +01:00
Naohiro Tamura
3856056358 aarch64: Added Vector Length Set test helper script
This patch is a test helper script to change Vector Length for child
process. This script can be used as test-wrapper for 'make check'.

Usage examples:

~/build$ make check subdirs=string \
test-wrapper='~/glibc/sysdeps/unix/sysv/linux/aarch64/vltest.py 16'

~/build$ ~/glibc/sysdeps/unix/sysv/linux/aarch64/vltest.py 16 \
make test t=string/test-memcpy

~/build$ ~/glibc/sysdeps/unix/sysv/linux/aarch64/vltest.py 32 \
./debugglibc.sh string/test-memmove

~/build$ ~/glibc/sysdeps/unix/sysv/linux/aarch64/vltest.py 64 \
./testrun.sh string/test-memset
2021-05-26 12:01:06 +01:00
Naohiro Tamura
bd4317fbd6 aarch64: define BTI_C and BTI_J macros as NOP unless HAVE_AARCH64_BTI
This patch defines BTI_C and BTI_J macros conditionally for
performance.
If HAVE_AARCH64_BTI is true, BTI_C and BTI_J are defined as HINT
instruction for ARMv8.5 BTI (Branch Target Identification).
If HAVE_AARCH64_BTI is false, both BTI_C and BTI_J are defined as
NOP.
2021-05-26 12:01:06 +01:00
Naohiro Tamura
77d175e14e config: Added HAVE_AARCH64_SVE_ASM for aarch64
This patch checks if assembler supports '-march=armv8.2-a+sve' to
generate SVE code or not, and then define HAVE_AARCH64_SVE_ASM macro.
2021-05-26 12:01:06 +01:00
Yang Xu
bfbdfe4eab tst-mallinfo2.c: Use correct multiple for total variable
Since test uses 160 multiple for malloc size, we should also use 160 multiple
for total variable instead of 16, then comparison is meaningful. So fix it.

Also change the ">" to ">=" so that the test is technically valid.

Reviewed-by: DJ Delorie <dj@redhat.com>
2021-05-25 16:47:01 -04:00
Florian Weimer
ac0353af81 Linux: Remove remaining references to $(shared-thread-library)
Since the variable expands to nothing under Linux, it is no longer
necessary to clutter the makefiles with it.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-05-25 11:30:23 +02:00
Florian Weimer
3b638095a5 nptl: Do not install libpthread.so and do not link tests with it
Keep installing libpthread.a, so that -lpthread works.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-05-25 11:30:23 +02:00
Lucas A. M. Magalhaes
709e3709a0 testrun.sh: Improve --help message
The testrun.sh --help message was missing the "container" option.
Besides just adding the missing option I decide to rewrite it in the
same layout as other tools.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-05-25 10:14:19 +05:30
Nicholas Piggin
7de36744ee powerpc: Fix handling of scv return error codes [BZ #27892]
When using scv for templated ASM syscalls, current code interprets any
negative return value as error, but the only valid error codes are in
the range -4095..-1 according to the ABI.

This commit also fixes 'signal.gen.test' strace test, where the issue
was first identified.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
2021-05-24 17:01:40 -03:00