Adhemerval Zanella Netto [Thu, 24 Aug 2023 16:42:17 +0000 (13:42 -0300)]
linux: Add posix_spawnattr_{get, set}cgroup_np (BZ 26371)
These functions allow to posix_spawn and posix_spawnp to use
CLONE_INTO_CGROUP with clone3, allowing the child process to
be created in a different cgroup version 2. These are GNU
extensions that are available only for Linux, and also only
for the architectures that implement clone3 wrapper
(HAVE_CLONE3_WRAPPER).
To create a process on a different cgroupv2, one can use the:
posix_spawnattr_t attr;
posix_spawnattr_init (&attr);
posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETCGROUP);
posix_spawnattr_setcgroup_np (&attr, cgroup);
posix_spawn (...)
Similar to other posix_spawn flags, POSIX_SPAWN_SETCGROUP control
whether the cgroup file descriptor will be used or not with
clone3.
There is no fallback if either clone3 does not support the flag
or if the architecture does not provide the clone3 wrapper, in
this case posix_spawn returns EOPNOTSUPP.
Checked on x86_64-linux-gnu.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Adhemerval Zanella Netto [Thu, 24 Aug 2023 16:42:16 +0000 (13:42 -0300)]
linux: Define __ASSUME_CLONE3 to 0 for alpha, ia64, nios2, sh, and sparc
Not all architectures added clone3 syscall.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Adhemerval Zanella Netto [Thu, 24 Aug 2023 16:42:15 +0000 (13:42 -0300)]
mips: Add the clone3 wrapper
It follows the internal signature:
extern int clone3 (struct clone_args *__cl_args, size_t __size,
int (*__func) (void *__arg), void *__arg);
Checked on mips64el-linux-gnueabihf, mips64el-n32-linux-gnu, and
mipsel-linux-gnu.
Adhemerval Zanella Netto [Thu, 24 Aug 2023 16:42:14 +0000 (13:42 -0300)]
arm: Add the clone3 wrapper
It follows the internal signature:
extern int clone3 (struct clone_args *__cl_args, size_t __size,
int (*__func) (void *__arg), void *__arg);
Checked on arm-linux-gnueabihf.
Samuel Thibault [Tue, 5 Sep 2023 09:58:26 +0000 (11:58 +0200)]
hurd: Avoid including thread_state.h in installed header
thread_state.h is not actually installed. It was only needed for
struct machine_thread_all_state, which we can just declare, actually.
Samuel Thibault [Mon, 4 Sep 2023 18:03:37 +0000 (20:03 +0200)]
__call_tls_dtors: Use call_function_static_weak
Bruno Haible [Mon, 4 Sep 2023 13:31:36 +0000 (15:31 +0200)]
intl: Treat C.UTF-8 locale like C locale (BZ# 16621)
The wiki page https://sourceware.org/glibc/wiki/Proposals/C.UTF-8
says that "Setting LC_ALL=C.UTF-8 will ignore LANGUAGE just like it
does with LC_ALL=C." This patch implements it.
* intl/dcigettext.c (guess_category_value): Treat C.<encoding> locale
like the C locale.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Samuel Thibault [Sun, 3 Sep 2023 19:11:09 +0000 (21:11 +0200)]
htl: Fix stack information for main thread
We can easily directly ask the kernel with vm_region rather than
assuming a one-page stack.
Samuel Thibault [Sun, 3 Sep 2023 13:23:56 +0000 (15:23 +0200)]
htl: thread_local destructors support
Szabolcs Nagy [Tue, 16 Feb 2021 12:55:13 +0000 (12:55 +0000)]
elf: Fix slow tls access after dlopen [BZ #19924]
In short: __tls_get_addr checks the global generation counter and if
the current dtv is older then _dl_update_slotinfo updates dtv up to the
generation of the accessed module. So if the global generation is newer
than generation of the module then __tls_get_addr keeps hitting the
slow dtv update path. The dtv update path includes a number of checks
to see if any update is needed and this already causes measurable tls
access slow down after dlopen.
It may be possible to detect up-to-date dtv faster. But if there are
many modules loaded (> TLS_SLOTINFO_SURPLUS) then this requires at
least walking the slotinfo list.
This patch tries to update the dtv to the global generation instead, so
after a dlopen the tls access slow path is only hit once. The modules
with larger generation than the accessed one were not necessarily
synchronized before, so additional synchronization is needed.
This patch uses acquire/release synchronization when accessing the
generation counter.
Note: in the x86_64 version of dl-tls.c the generation is only loaded
once, since relaxed mo is not faster than acquire mo load.
I have not benchmarked this. Tested by Adhemerval Zanella on aarch64,
powerpc, sparc, x86 who reported that it fixes the performance issue
of bug 19924.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
H.J. Lu [Mon, 28 Aug 2023 19:08:14 +0000 (12:08 -0700)]
x86: Check the lower byte of EAX of CPUID leaf 2 [BZ #30643]
The old Intel software developer manual specified that the low byte of
EAX of CPUID leaf 2 returned 1 which indicated the number of rounds of
CPUDID leaf 2 was needed to retrieve the complete cache information. The
newer Intel manual has been changed to that it should always return 1
and be ignored. If the lower byte isn't 1, CPUID leaf 2 can't be used.
In this case, we ignore CPUID leaf 2 and use CPUID leaf 4 instead. If
CPUID leaf 4 doesn't contain the cache information, cache information
isn't available at all. This addresses BZ #30643.
lijianglin [Tue, 27 Jun 2023 12:15:49 +0000 (20:15 +0800)]
add GB18030-2022 charmap and test the entire GB18030 charmap [BZ #30243]
support GB18030-2022 after add and change some transcoding relationship
of GB18030-2022.Details are as follows:
add 25 transcoding relationship
UE81E 0x82359037
UE826 0x82359038
UE82B 0x82359039
UE82C 0x82359130
UE832 0x82359131
UE843 0x82359132
UE854 0x82359133
UE864 0x82359134
UE78D 0x84318236
UE78F 0x84318237
UE78E 0x84318238
UE790 0x84318239
UE791 0x84318330
UE792 0x84318331
UE793 0x84318332
UE794 0x84318333
UE795 0x84318334
UE796 0x84318335
UE816 0xfe51
UE817 0xfe52
UE818 0xfe53
UE831 0xfe6c
UE83B 0xfe76
UE855 0xfe91
change 6 transcoding relationship
U20087 0x95329031
U20089 0x95329033
U200CC 0x95329730
U215D7 0x9536b937
U2298F 0x9630ba35
U241FE 0x9635b630
Test the entire GB18030 charmap, not only the Unicode BMP part.
Co-authored-by: yangyanchao <yangyanchao6@huawei.com>
Co-authored-by: liqingqing <liqingqing3@huawei.com>
Co-authored-by: Bruno Haible <bruno@clisp.org>
Reviewed-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Mike FABIAN <mfabian@redhat.com>
Joseph Myers [Tue, 29 Aug 2023 14:11:35 +0000 (14:11 +0000)]
Use GMP 6.3.0, MPFR 4.2.1 in build-many-glibcs.py
This patch makes build-many-glibcs.py use the new GMP 6.3.0 and MPFR
4.2.1 releases.
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
Colin Leroy-Mira [Tue, 29 Aug 2023 06:02:50 +0000 (08:02 +0200)]
localedata: Translit common emojis to smileys [BZ #30649]
Add common emojis to the translit-able characters (mostly
faces and hearts), and translit them to old-fashioned
smileys.
Signed-off-by: Colin Leroy-Mira <colin@colino.net>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Florian Weimer [Tue, 29 Aug 2023 06:28:31 +0000 (08:28 +0200)]
nscd: Skip unusable entries in first pass in prune_cache (bug 30800)
Previously, if an entry was marked unusable for any reason, but had
not timed out yet, the assert would trigger.
One way to get into such state is if a data change is detected during
re-validation of an entry. This causes the entry to be marked as not
usable. If exits nscd soon after that, then the clock jumps
backwards, and nscd restarted, the cache re-validation run after
startup triggers the removed assert.
The change is more complicated than just the removal of the assert
because entries marked as not usable should be garbage-collected in
the second pass. To make this happen, it is necessary to update some
book-keeping data.
Reviewed-by: DJ Delorie <dj@redhat.com>
dengjianbo [Mon, 28 Aug 2023 02:08:40 +0000 (10:08 +0800)]
LoongArch: Change loongarch to LoongArch in comments
dengjianbo [Mon, 28 Aug 2023 02:08:39 +0000 (10:08 +0800)]
LoongArch: Add ifunc support for memcmp{aligned, lsx, lasx}
According to glibc memcmp microbenchmark test results(Add generic
memcmp), this implementation have performance improvement
except the length is less than 3, details as below:
Name Percent of time reduced
memcmp-lasx 16%-74%
memcmp-lsx 20%-50%
memcmp-aligned 5%-20%
dengjianbo [Mon, 28 Aug 2023 02:08:38 +0000 (10:08 +0800)]
LoongArch: Add ifunc support for memset{aligned, unaligned, lsx, lasx}
According to glibc memset microbenchmark test results, for LSX and LASX
versions, A few cases with length less than 8 experience performace
degradation, overall, the LASX version could reduce the runtime about
15% - 75%, LSX version could reduce the runtime about 15%-50%.
The unaligned version uses unaligned memmory access to set data which
length is less than 64 and make address aligned with 8. For this part,
the performace is better than aligned version. Comparing with the generic
version, the performance is close when the length is larger than 128. When
the length is 8-128, the unaligned version could reduce the runtime about
30%-70%, the aligned version could reduce the runtime about 20%-50%.
dengjianbo [Mon, 28 Aug 2023 02:08:37 +0000 (10:08 +0800)]
LoongArch: Add ifunc support for memrchr{lsx, lasx}
According to glibc memrchr microbenchmark, this implementation could reduce
the runtime as following:
Name Percent of rutime reduced
memrchr-lasx 20%-83%
memrchr-lsx 20%-64%
dengjianbo [Mon, 28 Aug 2023 02:08:36 +0000 (10:08 +0800)]
LoongArch: Add ifunc support for memchr{aligned, lsx, lasx}
According to glibc memchr microbenchmark, this implementation could reduce
the runtime as following:
Name Percent of runtime reduced
memchr-lasx 37%-83%
memchr-lsx 30%-66%
memchr-aligned 0%-15%
dengjianbo [Mon, 28 Aug 2023 02:08:35 +0000 (10:08 +0800)]
LoongArch: Add ifunc support for rawmemchr{aligned, lsx, lasx}
According to glibc rawmemchr microbenchmark, A few cases tested with
char '\0' experience performance degradation due to the lasx and lsx
versions don't handle the '\0' separately. Overall, rawmemchr-lasx
implementation could reduce the runtime about 40%-80%, rawmemchr-lsx
implementation could reduce the runtime about 40%-66%, rawmemchr-aligned
implementation could reduce the runtime about 20%-40%.
Xi Ruoyao [Sat, 26 Aug 2023 16:36:51 +0000 (00:36 +0800)]
LoongArch: Micro-optimize LD_PCREL
We are requiring Binutils >= 2.41, so explicit relocation syntax is
always supported by the assembler. Use it to reduce one instruction.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Xi Ruoyao [Sat, 26 Aug 2023 16:36:50 +0000 (00:36 +0800)]
LoongArch: Remove support code for old linker in start.S
We are requiring Binutils >= 2.41, so la.pcrel always works here.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Xi Ruoyao [Sat, 26 Aug 2023 16:36:49 +0000 (00:36 +0800)]
LoongArch: Simplify the autoconf check for static PIE
We are strictly requiring GAS >= 2.41 now, so we don't need to check
assembler capability anymore.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Kir Kolyshkin [Fri, 25 Aug 2023 02:31:40 +0000 (19:31 -0700)]
Add F_SEAL_EXEC from Linux 6.3 to bits/fcntl-linux.h.
This patch adds the new F_SEAL_EXEC constant from Linux 6.3 (see Linux
commit
6fd7353829c ("mm/memfd: add F_SEAL_EXEC") to bits/fcntl-linux.h.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Joe Simmons-Talbott [Mon, 28 Aug 2023 16:49:02 +0000 (16:49 +0000)]
argp-parse: Get rid of alloca
Even though the alloca usage is relatively small and fixed size the code
can be written without using alloca. Convert to local variables.
Checked on x86_64-linux-gnu.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Joe Simmons-Talbott [Mon, 28 Aug 2023 16:42:13 +0000 (16:42 +0000)]
gencat: Get rid of alloca.
Convert to scratch_buffers to avoid potential stack overflow.
Checked on x86_64-linux-gnu and aarch64-linux-gnu.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Adhemerval Zanella [Fri, 18 Aug 2023 17:49:31 +0000 (14:49 -0300)]
m68k: Use M68K_SCALE_AVAILABLE on __mpn_lshift and __mpn_rshift
This patch adds a new macro, M68K_SCALE_AVAILABLE, similar to gmp
scale_available_p (mpn/m68k/m68k-defs.m4) that expand to 1 if a
scale factor can be used in addressing modes. This is used
instead of __mc68020__ for some optimization decisions.
Checked on a build for m68k-linux-gnu target mc68020 and mc68040.
Adhemerval Zanella [Fri, 18 Aug 2023 17:59:51 +0000 (14:59 -0300)]
m68k: Fix build with -mcpu=68040 or higher (BZ 30740)
GCC currently does not define __mc68020__ for -mcpu=68040 or higher,
which memcpy/memmove assumptions. Since this memory copy optimization
seems only intended for m68020, disable for other m680X0 variants.
Checked on a build for m68k-linux-gnu target mc68020 and mc68040.
Florian Weimer [Fri, 25 Aug 2023 12:15:29 +0000 (14:15 +0200)]
elf: Check that --list-diagnostics output has the expected syntax
Parts of elf/tst-rtld-list-diagnostics.py have been copied from
scripts/tst-ld-trace.py.
The abnf module is entirely optional and used to verify the
ABNF grammar as included in the manual.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Fri, 25 Aug 2023 12:15:28 +0000 (14:15 +0200)]
manual: Document ld.so --list-diagnostics output
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Mark Wielaard [Thu, 24 Aug 2023 19:36:34 +0000 (21:36 +0200)]
manual/jobs.texi: Add missing @item EPERM for getpgid
The missing @item makes it look like errno will be set to ESRCH
if a cross-session getpgid is not permitted.
Found by ulfvonbelow on irc.
dengjianbo [Thu, 24 Aug 2023 08:50:19 +0000 (16:50 +0800)]
LoongArch: Add ifunc support for strncmp{aligned, lsx}
Based on the glibc microbenchmark, only a few short inputs with this
strncmp-aligned and strncmp-lsx implementation experience performance
degradation, overall, strncmp-aligned could reduce the runtime 0%-10%
for aligned comparision, 10%-25% for unaligend comparision, strncmp-lsx
could reduce the runtime about 0%-60%.
dengjianbo [Thu, 24 Aug 2023 08:50:18 +0000 (16:50 +0800)]
LoongArch: Add ifunc support for strcmp{aligned, lsx}
Based on the glibc microbenchmark, strcmp-aligned implementation could
reduce the runtime 0%-10% for aligned comparison, 10%-20% for unaligned
comparison, strcmp-lsx implemenation could reduce the runtime 0%-50%.
dengjianbo [Thu, 24 Aug 2023 08:50:17 +0000 (16:50 +0800)]
LoongArch: Add ifunc support for strnlen{aligned, lsx, lasx}
Based on the glibc microbenchmark, strnlen-aligned implementation could
reduce the runtime more than 10%, strnlen-lsx implementation could reduce
the runtime about 50%-78%, strnlen-lasx implementation could reduce the
runtime about 50%-88%.
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:14 +0000 (10:44 +0200)]
htl: move pthread_attr_setdetachstate into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-11-gfleury@disroot.org>
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:13 +0000 (10:44 +0200)]
htl: move pthread_attr_getdetachstate into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-10-gfleury@disroot.org>
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:12 +0000 (10:44 +0200)]
htl: move pthread_attr_setschedpolicy into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-9-gfleury@disroot.org>
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:11 +0000 (10:44 +0200)]
htl: move pthread_attr_getschedpolicy into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-8-gfleury@disroot.org>
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:10 +0000 (10:44 +0200)]
htl: move pthread_attr_setinheritsched into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-7-gfleury@disroot.org>
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:09 +0000 (10:44 +0200)]
htl: move pthread_attr_getinheritsched into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-6-gfleury@disroot.org>
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:08 +0000 (10:44 +0200)]
htl: move pthread_attr_getschedparam into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-5-gfleury@disroot.org>
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:07 +0000 (10:44 +0200)]
htl: move pthread_setschedparam into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-4-gfleury@disroot.org>
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:06 +0000 (10:44 +0200)]
htl: move pthread_getschedparam into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-3-gfleury@disroot.org>
Guy-Fleury Iteriteka [Sun, 16 Jul 2023 08:44:05 +0000 (10:44 +0200)]
htl: move pthread_equal into libc
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <
20230716084414.107245-2-gfleury@disroot.org>
Florian Weimer [Fri, 4 Aug 2023 10:44:01 +0000 (12:44 +0200)]
Linux: Avoid conflicting types in ld.so --list-diagnostics
The path auxv[*].a_val could either be an integer or a string,
depending on the a_type value. Use a separate field, a_val_string, to
simplify mechanical parsing of the --list-diagnostics output.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 22 Aug 2023 11:56:25 +0000 (13:56 +0200)]
elf: Do not run constructors for proxy objects
Otherwise, the ld.so constructor runs for each audit namespace
and each dlmopen namespace.
H.J. Lu [Thu, 17 Aug 2023 16:42:29 +0000 (09:42 -0700)]
x86_64: Add log1p with FMA
On Skylake, it changes log1p bench performance by:
Before After Improvement
max 63.349 58.347 8%
min 4.448 5.651 -30%
mean 12.0674 10.336 14%
The minimum code path is
if (hx < 0x3FDA827A) /* x < 0.41422 */
{
if (__glibc_unlikely (ax >= 0x3ff00000)) /* x <= -1.0 */
{
...
}
if (__glibc_unlikely (ax < 0x3e200000)) /* |x| < 2**-29 */
{
math_force_eval (two54 + x); /* raise inexact */
if (ax < 0x3c900000) /* |x| < 2**-54 */
{
...
}
else
return x - x * x * 0.5;
FMA and non-FMA code sequences look similar. Non-FMA version is slightly
faster. Since log1p is called by asinh and atanh, it improves asinh
performance by:
Before After Improvement
max 75.645 63.135 16%
min 10.074 10.071 0%
mean 15.9483 14.9089 6%
and improves atanh performance by:
Before After Improvement
max 91.768 75.081 18%
min 15.548 13.883 10%
mean 18.3713 16.8011 8%
Andreas Schwab [Fri, 18 Aug 2023 19:10:29 +0000 (21:10 +0200)]
Remove references to the defunct db2 subdir
The db2 subdir has been removed more than 20 years ago.
Mahesh Bodapati [Fri, 11 Aug 2023 15:38:25 +0000 (10:38 -0500)]
string: Fix tester build with fortify enable with gcc < 12
When building with fortify enabled, GCC < 12 issues a warning on the
fortify strncat wrapper might overflow the destination buffer (the
failure is tied to -Werror).
Checked on ppc64 and x86_64.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Stefan Liebler [Mon, 14 Aug 2023 12:22:24 +0000 (14:22 +0200)]
s390x: Fix static PIE condition for toolchain bootstrapping.
The static PIE configure check uses link tests. When bootstrapping
a cross-toolchain, the link tests fail due to missing crt-files /
libc.so. As we explicitely want to test an issue in binutils (ld),
we now also explicitely check for known linker versions.
See also commit
368b7c614b102122b86af3953daea2b30230d0a8
S390: Use compile-only instead of also link-tests in configure.
Andreas Schwab [Thu, 17 Aug 2023 15:15:34 +0000 (17:15 +0200)]
m68k: fix __mpn_lshift and __mpn_rshift for non-68020
From revision
03f3d275d0d6 in the gmp repository.
Sam James [Thu, 17 Aug 2023 08:30:29 +0000 (09:30 +0100)]
sysdeps: tst-bz21269: fix -Wreturn-type
Thanks to Andreas Schwab for reporting.
Fixes:
652b9fdb77d9fd056d4dd26dad2c14142768ab49
Signed-off-by: Sam James <sam@gentoo.org>
dengjianbo [Tue, 15 Aug 2023 01:11:53 +0000 (09:11 +0800)]
Loongarch: Add ifunc support for memcpy{aligned, unaligned, lsx, lasx} and memmove{aligned, unaligned, lsx, lasx}
These implementations improve the time to copy data in the glibc
microbenchmark as below:
memcpy-lasx reduces the runtime about 8%-76%
memcpy-lsx reduces the runtime about 8%-72%
memcpy-unaligned reduces the runtime of unaligned data copying up to 40%
memcpy-aligned reduece the runtime of unaligned data copying up to 25%
memmove-lasx reduces the runtime about 20%-73%
memmove-lsx reduces the runtime about 50%
memmove-unaligned reduces the runtime of unaligned data moving up to 40%
memmove-aligned reduces the runtime of unaligned data moving up to 25%
dengjianbo [Tue, 15 Aug 2023 01:08:11 +0000 (09:08 +0800)]
Loongarch: Add ifunc support for strchr{aligned, lsx, lasx} and strchrnul{aligned, lsx, lasx}
These implementations improve the time to run strchr{nul}
microbenchmark in glibc as below:
strchr-lasx reduces the runtime about 50%-83%
strchr-lsx reduces the runtime about 30%-67%
strchr-aligned reduces the runtime about 10%-20%
strchrnul-lasx reduces the runtime about 50%-83%
strchrnul-lsx reduces the runtime about 36%-65%
strchrnul-aligned reduces the runtime about 6%-10%
Sam James [Fri, 4 Aug 2023 23:04:33 +0000 (00:04 +0100)]
sysdeps: tst-bz21269: handle ENOSYS & skip appropriately
SYS_modify_ldt requires CONFIG_MODIFY_LDT_SYSCALL to be set in the kernel, which
some distributions may disable for hardening. Check if that's the case (unset)
and mark the test as UNSUPPORTED if so.
Reviewed-by: DJ Delorie <dj@redhat.com>
Signed-off-by: Sam James <sam@gentoo.org>
Sam James [Fri, 4 Aug 2023 22:58:27 +0000 (23:58 +0100)]
sysdeps: tst-bz21269: fix test parameter
All callers pass 1 or 0x11 anyway (same meaning according to man page),
but still.
Reviewed-by: DJ Delorie <dj@redhat.com>
Signed-off-by: Sam James <sam@gentoo.org>
Samuel Thibault [Tue, 15 Aug 2023 22:12:33 +0000 (00:12 +0200)]
hurd: Fix strictness of <mach/thread_state.h>
Fixes:
db25bc52026f ("hurd: Add prototype for and thus fix _hurdsig_abort_rpcs call")
Samuel Thibault [Tue, 15 Aug 2023 20:41:23 +0000 (22:41 +0200)]
hurd: Add prototype for and thus fix _hurdsig_abort_rpcs call
This was actually not a problem since NULL was getting passed.
наб [Tue, 15 Aug 2023 13:07:59 +0000 (15:07 +0200)]
io/tst-statvfs: fix statfs().f_type comparison test on some arches
On i686 f_type is an i32 so the test fails when that has the top bit set.
Explicitly cast to u32.
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Joe Simmons-Talbott [Tue, 15 Aug 2023 14:28:25 +0000 (14:28 +0000)]
fxprintf: Get rid of alloca
Use a scratch_buffer rather than alloca/malloc to avoid potential stack
overflow.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Mon, 14 Aug 2023 11:48:01 +0000 (13:48 +0200)]
configure: Add -Wall again to the default CFLAGS
Commit
78ceef25d64efeeb6067d1cb282a00466e637e2a ("configure: Remove
--enable-all-warnings option") removed it due to a missing +.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Florian Weimer [Thu, 10 Aug 2023 17:36:56 +0000 (19:36 +0200)]
malloc: Remove bin scanning from memalign (bug 30723)
On the test workload (mpv --cache=yes with VP9 video decoding), the
bin scanning has a very poor success rate (less than 2%). The tcache
scanning has about 50% success rate, so keep that.
Update comments in malloc/tst-memalign-2 to indicate the purpose
of the tests. Even with the scanning removed, the additional
merging opportunities since commit
542b1105852568c3ebc712225ae78b
("malloc: Enable merging of remainders in memalign (bug 30723)")
are sufficient to pass the existing large bins test.
Remove leftover variables from _int_free from refactoring in the
same commit.
Reviewed-by: DJ Delorie <dj@redhat.com>
Joe Simmons-Talbott [Mon, 14 Aug 2023 20:50:40 +0000 (20:50 +0000)]
resolv/nss_dns/dns-host: Get rid of alloca.
Since the alloca is a small constant size use an array instead.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
H.J. Lu [Fri, 11 Aug 2023 15:04:08 +0000 (08:04 -0700)]
x86_64: Add expm1 with FMA
On Skylake, it improves expm1 bench performance by:
Before After Improvement
max 70.204 68.054 3%
min 20.709 16.2 22%
mean 22.1221 16.7367 24%
NB: Add
extern long double __expm1l (long double);
extern long double __expm1f128 (long double);
for __typeof (__expm1l) and __typeof (__expm1f128) when __expm1 is
defined since __expm1 may be expanded in their declarations which
causes the build failure.
caiyinyu [Mon, 14 Aug 2023 07:34:08 +0000 (15:34 +0800)]
LoongArch: elf: Add new LoongArch reloc types 109 into elf.h
These reloc types are generated by GNU assembler >= 2.41 for relaxation
support.
Xi Ruoyao [Wed, 9 Aug 2023 11:12:54 +0000 (19:12 +0800)]
elf: Add new LoongArch reloc types (101 to 108) into elf.h
These reloc types are generated by GNU assembler >= 2.41 for relaxation
support.
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=57a930e3
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
dengjianbo [Tue, 8 Aug 2023 06:15:44 +0000 (14:15 +0800)]
Loongarch: Add ifunc support and add different versions of strlen
strlen-lasx is implemeted by LASX simd instructions(256bit)
strlen-lsx is implemeted by LSX simd instructions(128bit)
strlen-align is implemented by LA basic instructions and never use unaligned memory acess
dengjianbo [Tue, 8 Aug 2023 06:15:43 +0000 (14:15 +0800)]
LoongArch: Add minuimum binutils required version
LoongArch glibc can add some LASX/LSX vector instructions codes,
change the required minimum binutils version to 2.41 which could
support vector instructions. HAVE_LOONGARCH_VEC_ASM is removed
accordingly.
dengjianbo [Tue, 8 Aug 2023 06:15:42 +0000 (14:15 +0800)]
LoongArch: Redefine macro LEAF/ENTRY.
The following usage of macro LEAF/ENTRY are all feasible:
1. LEAF(fcn) -- the align value of fcn is .align 3(default value)
2. LEAF(fcn, 6) -- the align value of fcn is .align 6
Noah Goldstein [Fri, 11 Aug 2023 00:28:24 +0000 (19:28 -0500)]
x86: Fix incorrect scope of setting `shared_per_thread` [BZ# 30745]
The:
```
if (shared_per_thread > 0 && threads > 0)
shared_per_thread /= threads;
```
Code was accidentally moved to inside the else scope. This doesn't
match how it was previously (before
af992e7abd).
This patch fixes that by putting the division after the `else` block.
H.J. Lu [Thu, 10 Aug 2023 18:24:30 +0000 (11:24 -0700)]
x86_64: Add log2 with FMA
On Skylake, it improves log2 bench performance by:
Before After Improvement
max 208.779 63.827 69%
min 9.977 6.55 34%
mean 10.366 6.8191 34%
Florian Weimer [Fri, 11 Aug 2023 09:18:17 +0000 (11:18 +0200)]
malloc: Enable merging of remainders in memalign (bug 30723)
Previously, calling _int_free from _int_memalign could put remainders
into the tcache or into fastbins, where they are invisible to the
low-level allocator. This results in missed merge opportunities
because once these freed chunks become available to the low-level
allocator, further memalign allocations (even of the same size are)
likely obstructing merges.
Furthermore, during forwards merging in _int_memalign, do not
completely give up when the remainder is too small to serve as a
chunk on its own. We can still give it back if it can be merged
with the following unused chunk. This makes it more likely that
memalign calls in a loop achieve a compact memory layout,
independently of initial heap layout.
Drop some useless (unsigned long) casts along the way, and tweak
the style to more closely match GNU on changed lines.
Reviewed-by: DJ Delorie <dj@redhat.com>
Florian Weimer [Fri, 11 Aug 2023 08:10:16 +0000 (10:10 +0200)]
nscd: Do not rebuild getaddrinfo (bug 30709)
The nscd daemon caches hosts data from NSS modules verbatim, without
filtering protocol families or sorting them (otherwise separate caches
would be needed for certain ai_flags combinations). The cache
implementation is complete separate from the getaddrinfo code. This
means that rebuilding getaddrinfo is not needed. The only function
actually used is __bump_nl_timestamp from check_pf.c, and this change
moves it into nscd/connections.c.
Tested on x86_64-linux-gnu with -fexceptions, built with
build-many-glibcs.py. I also backported this patch into a distribution
that still supports nscd and verified manually that caching still works.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
H.J. Lu [Wed, 9 Aug 2023 18:08:52 +0000 (11:08 -0700)]
x86_64: Sort fpu/multiarch/Makefile
Sort Makefile variables using scripts/sort-makefile-lines.py.
No code generation changes observed in libm. No regressions on x86_64.
Adhemerval Zanella [Tue, 8 Aug 2023 12:27:55 +0000 (09:27 -0300)]
i686: Fix build with --disable-multiarch
Since i686 provides the fortified wrappers for memcpy, mempcpy,
memmove, and memset on the same string implementation, the static
build tries to optimized it by not tying the fortified wrappers
to string routine (to avoid pulling the fortify function if
they are not required).
Checked on i686-linux-gnu building with different option:
default and --disable-multi-arch plus default, --disable-default-pie,
--enable-fortify-source={2,3}, and --enable-fortify-source={2,3}
with --disable-default-pie.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Adhemerval Zanella [Tue, 8 Aug 2023 12:27:54 +0000 (09:27 -0300)]
x86_64: Fix build with --disable-multiarch (BZ 30721)
With multiarch disabled, the default memmove implementation provides
the fortify routines for memcpy, mempcpy, and memmove. However, it
does not provide the internal hidden definitions used when building
with fortify enabled. The memset has a similar issue.
Checked on x86_64-linux-gnu building with different options:
default and --disable-multi-arch plus default, --disable-default-pie,
--enable-fortify-source={2,3}, and --enable-fortify-source={2,3}
with --disable-default-pie.
Tested-by: Andreas K. Huettel <dilfridge@gentoo.org>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Joseph Myers [Tue, 8 Aug 2023 14:38:22 +0000 (14:38 +0000)]
Add PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG etc. from Linux 6.4 to sys/ptrace.h
Linux 6.4 adds new constants PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG
and PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG. Add those to all
relevant sys/ptrace.h headers, along with adding the associated
argument structure to bits/ptrace-shared.h (named struct
__ptrace_sud_config there following the usual convention for such
structures).
Tested for x86_64 and with build-many-glibcs.py.
Joseph Myers [Tue, 8 Aug 2023 14:37:45 +0000 (14:37 +0000)]
Add PACKET_VNET_HDR_SZ from Linux 6.4 to netpacket/packet.h
Linux 6.4 adds a new constant PACKET_VNET_HDR_SZ; add it to glibc's
netpacket/packet.h.
Tested for x86_64.
Samuel Thibault [Tue, 8 Aug 2023 14:03:24 +0000 (16:03 +0200)]
hurd: Make error_t an int in C++
Making error_t defined to enum __error_t_codes conveniently makes the
debugger print symbolic values, but in C++ int is not interoperable with
enum __error_t_codes, leading to C++ application build issues, so let's
revert error_t to int in C++.
Joseph Myers [Tue, 8 Aug 2023 12:53:50 +0000 (12:53 +0000)]
Use binutils 2.41 branch in build-many-glibcs.py
This patch makes build-many-glibcs.py use binutils 2.41 branch.
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
наб [Sun, 6 Aug 2023 20:23:36 +0000 (22:23 +0200)]
linux: statvfs: allocate spare for f_type
This is the only missing part in struct statvfs.
The LSB calls [f]statfs() deprecated, and its weird types are definitely
off-putting. However, its use is required to get f_type.
Instead, allocate one of the six spares to f_type,
copied directly from struct statfs.
This then becomes a small glibc extension to the standard interface
on Linux and the Hurd, instead of two different interfaces, one of which
is quite odd due to being an ABI type, and there no longer is any reason
to use statfs().
The underlying kernel type is a mess, but all architectures agree on u32
(or more) for the ABI, and all filesystem magicks are 32-bit integers.
We don't lose any generality by using u32, and by doing so we both make
the API consistent with the Hurd, and allow C++
switch(f_type) { case RAMFS_MAGIC: ...; }
Also fix tst-statvfs so that it actually fails;
as it stood, all it did was return 0 always.
Test statfs()' and statvfs()' f_types are the same.
Link: https://lore.kernel.org/linux-man/f54kudgblgk643u32tb6at4cd3kkzha6hslahv24szs4raroaz@ogivjbfdaqtb/t/#u
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
наб [Sun, 6 Aug 2023 20:23:24 +0000 (22:23 +0200)]
hurd: statvfs: __f_type -> f_type
No further changes needed ([f]statvfs() just cast to struct statfs *
and call [f]statfs()).
Link: https://lore.kernel.org/linux-man/f54kudgblgk643u32tb6at4cd3kkzha6hslahv24szs4raroaz@ogivjbfdaqtb/t/#u
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Samuel Thibault [Tue, 8 Aug 2023 10:19:29 +0000 (12:19 +0200)]
htl: Initialize ___pthread_self early
When using jemalloc, malloc() needs to use TSD, while libpthread
initialization needs malloc(). Having ___pthread_self set early to some
static storage allows TSD to work early, thus allowing jemalloc and
libpthread to initialize together.
This incidentaly simplifies __pthread_enable/disable_asynccancel and
__pthread_self, now that ___pthread_self is always initialized.
Samuel Thibault [Tue, 8 Aug 2023 10:10:06 +0000 (12:10 +0200)]
htl: Add support for static TSD data
When using jemalloc, malloc() needs to use TSD, while libpthread
initialization needs malloc(). Supporting a static TSD area allows jemalloc
and libpthread to initialize together.
Sajan Karumanchi [Tue, 1 Aug 2023 15:20:55 +0000 (15:20 +0000)]
x86: Fix for cache computation on AMD legacy cpus.
Some legacy AMD CPUs and hypervisors have the _cpuid_ '0x8000_001D'
set to Zero, thus resulting in zeroed-out computed cache values.
This patch reintroduces the old way of cache computation as a
fail-safe option to handle these exceptions.
Fixed 'level4_cache_size' value through handle_amd().
Reviewed-by: Premachandra Mallappa <premachandra.mallappa@amd.com>
Tested-by: Florian Weimer <fweimer@redhat.com>
Samuel Thibault [Sun, 6 Aug 2023 20:32:46 +0000 (20:32 +0000)]
hurd: Rework generating errno.h
We only need to give to gawk the headers that actually define error
numbers, so let's rather filter out the other included headers early.
Samuel Thibault [Fri, 4 Aug 2023 08:01:11 +0000 (10:01 +0200)]
powerpc longjmp: Fix build after chk hidden builtin fix
04bf7d2d8a79 ("chk: Add and fix hidden builtin definitions for *_chk")
added an #undef for longjmp and siglongjmp to compensate for the
definition in include/setjmp.h, but missed doing so for the powerpc
version too.
Fixes:
04bf7d2d8a79 ("chk: Add and fix hidden builtin definitions for
*_chk")
Yang Yujie [Thu, 3 Aug 2023 08:35:24 +0000 (16:35 +0800)]
LoongArch: Fix static PIE condition for toolchain bootstrapping.
This patch allows the static PIE startfile rcrt1.o to be built
without requiring libgcc_s.so from GCC, which depends on libc
in the first place.
Samuel Thibault [Thu, 3 Aug 2023 19:16:41 +0000 (21:16 +0200)]
chk: Add and fix hidden builtin definitions for *_chk
Otherwise on gnu-i686 there are unwanted PLT entries in libc.so when
fortification is enabled.
Tested for i686-gnu, x86_64-gnu, i686-linux-gnu and x86_64-linux-gnu
Samuel Thibault [Thu, 3 Aug 2023 19:16:16 +0000 (21:16 +0200)]
tst-realpath-toolong: return "unsupported" when PATH_MAX is undefined
When PATH_MAX is undefined, realpath cannot ever ENAMETOOLONG, so
this test is unsupported.
Samuel Thibault [Thu, 3 Aug 2023 19:15:58 +0000 (21:15 +0200)]
Subject: hurd: Make __realpath return EINVAL on NULL buf
As Posix and stdlib/test-canon.c expects it, and rather than letting
pathconf crash.
Samuel Thibault [Thu, 3 Aug 2023 19:15:39 +0000 (21:15 +0200)]
tst-*glob*: Do not check d_name size
Posix says that d_name is of unspecified size, and sizeof(d_name)
should not be used. It is indeed only 1-byte long in bits/dirent.h. We
can instead explictly provide the actual allocated size to
__strcpy_chk.
Florian Weimer [Mon, 31 Jul 2023 10:38:12 +0000 (12:38 +0200)]
hurd: Do not include full <stdarg.h> in <hurd.h>
This fixes a hurd/check-installed-headers-c failure with
-std=c89 #define _FORTIFY_SOURCE 1:
In file included from ../hurd/hurd.h:354,
from ../sysdeps/hurd/include/hurd.h:2,
from /tmp/cih_test_9IaUwa.c:10:
/home/bmg/install/compilers/i686-gnu/lib/gcc/i686-glibc-gnu/13.2.1/include/stdarg.h:54:34: error: "__STDC_VERSION__" is not defined, evaluates to 0 [-Werror=undef]
54 | #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L \
| ^~~~~~~~~~~~~~~~
/home/bmg/install/compilers/i686-gnu/lib/gcc/i686-glibc-gnu/13.2.1/include/stdarg.h:55:8: error: "__cplusplus" is not defined, evaluates to 0 [-Werror=undef]
55 | || __cplusplus + 0 >= 201103L
| ^~~~~~~~~~~
cc1: all warnings being treated as errors
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Andreas Schwab [Tue, 1 Aug 2023 15:01:37 +0000 (17:01 +0200)]
iconv: restore verbosity with unrecognized encoding names (bug 30694)
Commit
91927b7c76 ("Rewrite iconv option parsing [BZ #19519]") changed the
iconv program to call __gconv_open directly instead of the iconv_open
wrapper, but the former does not set errno. Update the caller to
interpret the return codes like iconv_open does.
Adhemerval Zanella Netto [Mon, 24 Jul 2023 17:22:27 +0000 (14:22 -0300)]
configure: Remove --enable-all-warnings option
The option is not activelly tested and has bitrotten, to fix it
would require a lot of work and multiple fixes. A better option
would to evaluate each option and enable the warning if it makes
sense.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Joseph Myers [Tue, 1 Aug 2023 17:22:12 +0000 (17:22 +0000)]
Add IP_PROTOCOL from Linux 6.4 to bits/in.h
Linux 6.4 adds a new constant IP_PROTOCOL; add it to glibc's
bits/in.h.
Tested for x86_64.
Joseph Myers [Tue, 1 Aug 2023 12:42:41 +0000 (12:42 +0000)]
Update kernel version to 6.4 in header constant tests
This patch updates the kernel version in the tests tst-mman-consts.py,
tst-mount-consts.py and tst-pidfd-consts.py to 6.4. (There are no new
constants covered by these tests in 6.4 that need any other header
changes.)
Tested with build-many-glibcs.py.
Mahesh Bodapati [Tue, 1 Aug 2023 12:41:17 +0000 (07:41 -0500)]
PowerPC: Influence cpu/arch hwcap features via GLIBC_TUNABLES
This patch enables the option to influence hwcaps used by PowerPC.
The environment variable, GLIBC_TUNABLES=glibc.cpu.hwcaps=-xxx,yyy,-zzz....,
can be used to enable CPU/ARCH feature yyy, disable CPU/ARCH feature xxx
and zzz, where the feature name is case-sensitive and has to match the ones
mentioned in the file{sysdeps/powerpc/dl-procinfo.c}.
Note that the hwcap tunables only used in the IFUNC selection.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Joe Simmons-Talbott [Mon, 31 Jul 2023 19:42:32 +0000 (19:42 +0000)]
vfprintf-internal: Get rid of alloca.
Avoid potential stack overflow from unbounded alloca. Use the existing
scratch_buffer instead.
Add testcases to exercise the code as suggested by Adhemerval Zanella Netto.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>