]> sourceware.org Git - glibc.git/log
glibc.git
20 months agoAdd Arm HWCAP values from Linux 6.2 to bits/hwcap.h
Joseph Myers [Tue, 28 Feb 2023 00:07:59 +0000 (00:07 +0000)]
Add Arm HWCAP values from Linux 6.2 to bits/hwcap.h

Linux 6.2 adds six new Arm HWCAP values and two new HWCAP2 values; add
them to glibc's Arm bits/hwcap.h, with corresponding dl-procinfo.c and
dl-procinfo.h updates.

Tested with build-many-glibcs.py for arm-linux-gnueabi.

20 months agohtl: Add pthreadtypes-arch.h for x86_64
Sergey Bugaev [Tue, 21 Feb 2023 21:19:32 +0000 (00:19 +0300)]
htl: Add pthreadtypes-arch.h for x86_64

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230221211932.296459-5-bugaevc@gmail.com>

20 months agohurd: Implement TLS for x86_64
Sergey Bugaev [Tue, 21 Feb 2023 21:19:31 +0000 (00:19 +0300)]
hurd: Implement TLS for x86_64

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230221211932.296459-4-bugaevc@gmail.com>

20 months agohtl: Make pthread_mutex_t pointer-aligned
Sergey Bugaev [Tue, 14 Feb 2023 17:37:22 +0000 (20:37 +0300)]
htl: Make pthread_mutex_t pointer-aligned

This is for future-proofing. On i386, it is 4-byte aligned anyway, but
on x86_64, we want it 8-byte aligned, not 4-byte aligned.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230214173722.428140-4-bugaevc@gmail.com>

20 months agox86_64: Update libm test ulps
H.J. Lu [Fri, 24 Feb 2023 17:01:55 +0000 (09:01 -0800)]
x86_64: Update libm test ulps

Update libm test ulps for

commit 3efbf11fdf15ed991d2c41743921c524a867e145
Author: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Date:   Tue Feb 14 11:24:59 2023 +0100

    update auto-libm-test-out-hypot

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
20 months agolocaledata: de_DE should not use Fräulein
Florian Weimer [Mon, 27 Feb 2023 15:54:22 +0000 (16:54 +0100)]
localedata: de_DE should not use Fräulein

This honorific has fallen out of use quite some time ago.

20 months agoLoongArch: Add math-barriers.h
Xi Ruoyao [Tue, 14 Feb 2023 08:57:13 +0000 (16:57 +0800)]
LoongArch: Add math-barriers.h

This patch implements the LoongArch specific math barriers in order to omit
the store and load from stack if possible.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
20 months agocdefs.h: fix "__clang_major" typo
Paul Eggert [Tue, 21 Dec 2021 22:13:29 +0000 (14:13 -0800)]
cdefs.h: fix "__clang_major" typo

* misc/sys/cdefs.h: Fix misspelling of "__clang_major__".
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
20 months agohppa: Drop old parisc-specific MADV_* constants
John David Anglin [Sat, 25 Feb 2023 21:59:24 +0000 (21:59 +0000)]
hppa: Drop old parisc-specific MADV_* constants

The Linux kernel upstream commit 71bdea6f798b ("parisc: Align parisc
MADV_XXX constants with all other architectures") dropped the
parisc-specific MADV_* values in favour of the same constants as
other architectures. In the same commit a wrapper was added which
translates the old values to the standard MADV_* values to avoid
breakage of existing programs.

This upstream patch has been downported to all stable kernel trees as
well.

This patch now drops the parisc specific constants from glibc to
allow newly compliled programs to use the standard MADV_* constants.

v2: Added NEWS section, based on feedback from Florian Weimer

Signed-off-by: Helge Deller <deller@gmx.de>
20 months agohurd: Generalize init-first.c to support x86_64
Sergey Bugaev [Thu, 23 Feb 2023 15:14:36 +0000 (18:14 +0300)]
hurd: Generalize init-first.c to support x86_64

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230223151436.49180-2-bugaevc@gmail.com>

20 months agohurd: Simplify init-first.c further
Sergey Bugaev [Thu, 23 Feb 2023 15:14:35 +0000 (18:14 +0300)]
hurd: Simplify init-first.c further

This drops all of the return address rewriting kludges. The only
remaining hack is the jump out of a call stack while adjusting the
stack pointer.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
20 months agohurd: Mark some audit tests as unsupported
Samuel Thibault [Fri, 24 Feb 2023 19:36:30 +0000 (20:36 +0100)]
hurd: Mark some audit tests as unsupported

They hang the testsuite.

20 months agohtl: Mark select loop test as unsupported
Samuel Thibault [Fri, 24 Feb 2023 19:34:03 +0000 (20:34 +0100)]
htl: Mark select loop test as unsupported

It overflows pflocal and doesn't manage to terminate.

20 months agohurd: Mark RLIMIT_AS tests as unsupported
Samuel Thibault [Fri, 24 Feb 2023 19:28:15 +0000 (20:28 +0100)]
hurd: Mark RLIMIT_AS tests as unsupported

Otherwise they put the system on its knees.

20 months agoaarch64: update libm test ulps
Szabolcs Nagy [Wed, 22 Feb 2023 11:23:49 +0000 (11:23 +0000)]
aarch64: update libm test ulps

20 months agopowerpc:Regenerate ulps for hypot
Mahesh Bodapati [Thu, 23 Feb 2023 17:23:39 +0000 (11:23 -0600)]
powerpc:Regenerate ulps for hypot

For new inputs added in commit 3efbf11fdf15ed991d2c41743921c524a867e145,
regenerate the ulps of hypot from 0(default) to 1

20 months agoUpdate syscall lists for Linux 6.2
Joseph Myers [Thu, 23 Feb 2023 22:53:17 +0000 (22:53 +0000)]
Update syscall lists for Linux 6.2

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

Tested with build-many-glibcs.py.

20 months agotunables.texi: Change \code{1} to @code{1}
H.J. Lu [Thu, 23 Feb 2023 04:04:26 +0000 (20:04 -0800)]
tunables.texi: Change \code{1} to @code{1}

Update

317f1c0a8a x86-64: Add glibc.cpu.prefer_map_32bit_exec [BZ #28656]

20 months agox86-64: Add glibc.cpu.prefer_map_32bit_exec [BZ #28656]
H.J. Lu [Thu, 26 Jan 2023 16:26:18 +0000 (08:26 -0800)]
x86-64: Add glibc.cpu.prefer_map_32bit_exec [BZ #28656]

Crossing 2GB boundaries with indirect calls and jumps can use more
branch prediction resources on Intel Golden Cove CPU (see the
"Misprediction for Branches >2GB" section in Intel 64 and IA-32
Architectures Optimization Reference Manual.)  There is visible
performance improvement on workloads with many PLT calls when executable
and shared libraries are mmapped below 2GB.  Add the Prefer_MAP_32BIT_EXEC
bit so that mmap will try to map executable or denywrite pages in shared
libraries with MAP_32BIT first.

NB: Prefer_MAP_32BIT_EXEC reduces bits available for address space
layout randomization (ASLR), which is always disabled for SUID programs
and can only be enabled by the tunable, glibc.cpu.prefer_map_32bit_exec,
or the environment variable, LD_PREFER_MAP_32BIT_EXEC.  This works only
between shared libraries or between shared libraries and executables with
addresses below 2GB.  PIEs are usually loaded at a random address above
4GB by the kernel.

20 months agogmon: fix memory corruption issues [BZ# 30101]
Simon Kissane [Fri, 10 Feb 2023 21:58:02 +0000 (08:58 +1100)]
gmon: fix memory corruption issues [BZ# 30101]

V2 of this patch fixes an issue in V1, where the state was changed to ON not
OFF at end of _mcleanup. I hadn't noticed that (counterintuitively) ON=0 and
OFF=3, hence zeroing the buffer turned it back on. So set the state to OFF
after the memset.

1. Prevent double free, and reads from unallocated memory, when
   _mcleanup is (incorrectly) called two or more times in a row,
   without an intervening call to __monstartup; with this patch, the
   second and subsequent calls effectively become no-ops instead.
   While setting tos=NULL is minimal fix, safest action is to zero the
   whole gmonparam buffer.

2. Prevent memory leak when __monstartup is (incorrectly) called two
   or more times in a row, without an intervening call to _mcleanup;
   with this patch, the second and subsequent calls effectively become
   no-ops instead.

3. After _mcleanup, treat __moncontrol(1) as __moncontrol(0) instead.
   With zeroing of gmonparam buffer in _mcleanup, this stops the
   state incorrectly being changed to GMON_PROF_ON despite profiling
   actually being off. If we'd just done the minimal fix to _mcleanup
   of setting tos=NULL, there is risk of far worse memory corruption:
   kcount would point to deallocated memory, and the __profil syscall
   would make the kernel write profiling data into that memory,
   which could have since been reallocated to something unrelated.

4. Ensure __moncontrol(0) still turns off profiling even in error
   state. Otherwise, if mcount overflows and sets state to
   GMON_PROF_ERROR, when _mcleanup calls __moncontrol(0), the __profil
   syscall to disable profiling will not be invoked. _mcleanup will
   free the buffer, but the kernel will still be writing profiling
   data into it, potentially corrupted arbitrary memory.

Also adds a test case for (1). Issues (2)-(4) are not feasible to test.

Signed-off-by: Simon Kissane <skissane@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
20 months agogmon: improve mcount overflow handling [BZ# 27576]
Simon Kissane [Sat, 11 Feb 2023 09:12:13 +0000 (20:12 +1100)]
gmon: improve mcount overflow handling [BZ# 27576]

When mcount overflows, no gmon.out file is generated, but no message is printed
to the user, leaving the user with no idea why, and thinking maybe there is
some bug - which is how BZ 27576 ended up being logged. Print a message to
stderr in this case so the user knows what is going on.

As a comment in sys/gmon.h acknowledges, the hardcoded MAXARCS value is too
small for some large applications, including the test case in that BZ. Rather
than increase it, add tunables to enable MINARCS and MAXARCS to be overridden
at runtime (glibc.gmon.minarcs and glibc.gmon.maxarcs). So if a user gets the
mcount overflow error, they can try increasing maxarcs (they might need to
increase minarcs too if the heuristic is wrong in their case.)

Note setting minarcs/maxarcs too large can cause monstartup to fail with an
out of memory error. If you set them large enough, it can cause an integer
overflow in calculating the buffer size. I haven't done anything to defend
against that - it would not generally be a security vulnerability, since these
tunables will be ignored in suid/sgid programs (due to the SXID_ERASE default),
and if you can set GLIBC_TUNABLES in the environment of a process, you can take
it over anyway (LD_PRELOAD, LD_LIBRARY_PATH, etc). I thought about modifying
the code of monstartup to defend against integer overflows, but doing so is
complicated, and I realise the existing code is susceptible to them even prior
to this change (e.g. try passing a pathologically large highpc argument to
monstartup), so I decided just to leave that possibility in-place.

Add a test case which demonstrates mcount overflow and the tunables.

Document the new tunables in the manual.

Signed-off-by: Simon Kissane <skissane@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
20 months agogmon: Fix allocated buffer overflow (bug 29444)
Леонид Юрьев (Leonid Yuriev) [Sat, 4 Feb 2023 11:41:38 +0000 (14:41 +0300)]
gmon: Fix allocated buffer overflow (bug 29444)

The `__monstartup()` allocates a buffer used to store all the data
accumulated by the monitor.

The size of this buffer depends on the size of the internal structures
used and the address range for which the monitor is activated, as well
as on the maximum density of call instructions and/or callable functions
that could be potentially on a segment of executable code.

In particular a hash table of arcs is placed at the end of this buffer.
The size of this hash table is calculated in bytes as
   p->fromssize = p->textsize / HASHFRACTION;

but actually should be
   p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));

This results in writing beyond the end of the allocated buffer when an
added arc corresponds to a call near from the end of the monitored
address range, since `_mcount()` check the incoming caller address for
monitored range but not the intermediate result hash-like index that
uses to write into the table.

It should be noted that when the results are output to `gmon.out`, the
table is read to the last element calculated from the allocated size in
bytes, so the arcs stored outside the buffer boundary did not fall into
`gprof` for analysis. Thus this "feature" help me to found this bug
during working with https://sourceware.org/bugzilla/show_bug.cgi?id=29438

Just in case, I will explicitly note that the problem breaks the
`make test t=gmon/tst-gmon-dso` added for Bug 29438.
There, the arc of the `f3()` call disappears from the output, since in
the DSO case, the call to `f3` is located close to the end of the
monitored range.

Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
Another minor error seems a related typo in the calculation of
`kcountsize`, but since kcounts are smaller than froms, this is
actually to align the p->froms data.

Co-authored-by: DJ Delorie <dj@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
20 months agomalloc: remove redundant check of unsorted bin corruption
Ayush Mittal [Thu, 8 Apr 2021 09:29:09 +0000 (14:59 +0530)]
malloc: remove redundant check of unsorted bin corruption

* malloc/malloc.c (_int_malloc): remove redundant check of
  unsorted bin corruption

With commit "b90ddd08f6dd688e651df9ee89ca3a69ff88cd0c"
(malloc: Additional checks for unsorted bin integrity),
same check of (bck->fd != victim) is added before checking of unsorted
chunk corruption, which was added in "bdc3009b8ff0effdbbfb05eb6b10966753cbf9b8"
(Added check before removing from unsorted list).

..
3773           if (__glibc_unlikely (bck->fd != victim)
3774               || __glibc_unlikely (victim->fd != unsorted_chunks (av)))
3775             malloc_printerr ("malloc(): unsorted double linked list corrupted");
..
..
3815           /* remove from unsorted list */
3816          if (__glibc_unlikely (bck->fd != victim))
3817            malloc_printerr ("malloc(): corrupted unsorted chunks 3");
3818          unsorted_chunks (av)->bk = bck;
..

So this extra check can be removed.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Ayush Mittal <ayush.m@samsung.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
20 months agoUse Linux 6.2 in build-many-glibcs.py
Joseph Myers [Wed, 22 Feb 2023 21:37:03 +0000 (21:37 +0000)]
Use Linux 6.2 in build-many-glibcs.py

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

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

20 months agoIgnore MAP_VARIABLE in tst-mman-consts.py
Joseph Myers [Wed, 22 Feb 2023 21:36:34 +0000 (21:36 +0000)]
Ignore MAP_VARIABLE in tst-mman-consts.py

Linux 6.2 removed the hppa compatibility MAP_VARIABLE define.  That
means that, whether or not we remove it in glibc, it needs to be
ignored in tst-mman-consts.py (since this macro comparison
infrastructure expects that new kernel header versions only add new
macros, not remove old ones).

Tested with build-many-glibcs.py for hppa-linux-gnu (Linux 6.2
headers).

20 months agoAArch64: Fix HP_TIMING_DIFF computation [BZ# 29329]
Jun Tang [Wed, 22 Feb 2023 16:45:59 +0000 (16:45 +0000)]
AArch64: Fix HP_TIMING_DIFF computation [BZ# 29329]

Fix the computation to allow for cntfrq_el0 being larger than 1GHz.
Assume cntfrq_el0 is a multiple of 1MHz to increase the maximum
interval (1024 seconds at 1GHz).

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
20 months agos390: Fix build for -march=z13
Adhemerval Zanella [Mon, 20 Feb 2023 14:18:08 +0000 (11:18 -0300)]
s390: Fix build for -march=z13

It fixes the build after 7ea510127e2067e and 22999b2f0fb62.

Checked with build for s390x-linux-gnu with -march=z13.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
20 months agoarm: Support gcc older than 10 for find_zero_all
Adhemerval Zanella [Mon, 20 Feb 2023 16:46:36 +0000 (13:46 -0300)]
arm: Support gcc older than 10 for find_zero_all

__builtin_arm_uqsub8 is only available on gcc newer or equal than 10.

Checked on arm-linux-gnueabihf built with gcc 9.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agoLinux: Remove generic Implies
Adhemerval Zanella [Wed, 19 Oct 2022 12:36:09 +0000 (09:36 -0300)]
Linux: Remove generic Implies

The default Linux implementation already handled the Linux generic
ABIs interface used on newer architectures, so there is no need to
Imply the generic any longer.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
20 months agoLinux: Remove unused generic Makefile
Adhemerval Zanella [Tue, 18 Oct 2022 20:04:59 +0000 (17:04 -0300)]
Linux: Remove unused generic Makefile

Both are already defined on default linux Makefile.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
20 months agoLinux: Assume and consolidate getpeername wire-up syscall
Adhemerval Zanella [Tue, 18 Oct 2022 19:29:48 +0000 (16:29 -0300)]
Linux: Assume and consolidate getpeername wire-up syscall

And disable if kernel does not support it.

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

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
20 months agoLinux: Assume and consolidate getsockname wire-up syscall
Adhemerval Zanella [Tue, 18 Oct 2022 19:28:44 +0000 (16:28 -0300)]
Linux: Assume and consolidate getsockname wire-up syscall

And disable if kernel does not support it.

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

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
20 months agoLinux: Move wordsize-32 Version to default
Adhemerval Zanella [Tue, 18 Oct 2022 13:44:19 +0000 (10:44 -0300)]
Linux: Move wordsize-32 Version to default

And remove redundant entries on other architectures Version.  The
version for fallocate64 was supposed to be 2.10, but it was then
added to 32-bit platforms in 2.11 because it mistakenly wasn't
exported for them in  2.10 (see the commit message for
1f3615a1c97a030bca59f728f998947f852679b9).

The linux/generic did not exist before 2.15, i.e. when the tile
ports were added (and microblaze did not exist before 2.18), which
explains those differences but also illustrates that "2.11 for 32-bit,
2.10 for 64-bit" should be sufficient since versions older than the
minimum for the architecture are automatically adjusted.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
20 months ago__glob64_time64: Fix typo for stub_warning call (BZ #30146)
Samuel Thibault [Mon, 20 Feb 2023 12:44:06 +0000 (13:44 +0100)]
__glob64_time64: Fix typo for stub_warning call (BZ #30146)

The exported symbol is actually __glob64_time64, not glob64_time64.

20 months agoelf: Restore ldconfig libc6 implicit soname logic [BZ #30125]
Joan Bruguera [Sat, 18 Feb 2023 21:52:15 +0000 (21:52 +0000)]
elf: Restore ldconfig libc6 implicit soname logic [BZ #30125]

While cleaning up old libc version support, the deprecated libc4 code was
accidentally kept in `implicit_soname`, instead of the libc6 code.

This causes additional symlinks to be created by `ldconfig` for libraries
without a soname, e.g. a library `libsomething.123.456.789` without a soname
will create a `libsomething.123` -> `libsomething.123.456.789` symlink.

As the libc6 version of the `implicit_soname` code is a trivial `xstrdup`,
just inline it and remove `implicit_soname` altogether.

Some further simplification looks possible (e.g. the call to `create_links`
looks like a no-op if `soname == NULL`, other than the verbose printfs), but
logic is kept as-is for now.

Fixes: BZ #30125
Fixes: 8ee878592c4a ("Assume only FLAG_ELF_LIBC6 suport")
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
20 months agostdlib: Undo post review change to 16adc58e73f3 [BZ #27749]
Vitaly Buka [Sat, 18 Feb 2023 20:53:41 +0000 (12:53 -0800)]
stdlib: Undo post review change to 16adc58e73f3 [BZ #27749]

Post review removal of "goto restart" from
https://sourceware.org/pipermail/libc-alpha/2021-April/125470.html
introduced a bug when some atexit handers skipped.

Signed-off-by: Vitaly Buka <vitalybuka@google.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
20 months agoDefine PC, SP and SYSRETURN for hurd x86_64
Flavio Cruz [Wed, 15 Feb 2023 06:16:38 +0000 (01:16 -0500)]
Define PC, SP and SYSRETURN for hurd x86_64

Moved thread_state.h to x86 directory since we only need to customize
those 3 definitions.
Message-Id: <Y+x4xrsDMkAomncO@jupiter.tail36e24.ts.net>

20 months agomach: Use PAGE_SIZE
Sergey Bugaev [Sat, 18 Feb 2023 20:37:14 +0000 (23:37 +0300)]
mach: Use PAGE_SIZE

The PAGE_SIZE from the Mach headers statically defines the machine's
page size. There's no need to query it dynamically; furthermore, the
implementation of the vm_statistics () RPC unconditionally fills in

pagesize = PAGE_SIZE;

Not doing the extra RPC shaves off 2 RPCs from the start-up of every
process!

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230218203717.373211-7-bugaevc@gmail.com>

20 months agohurd: Simplify init-first.c a bit
Sergey Bugaev [Sat, 18 Feb 2023 20:37:13 +0000 (23:37 +0300)]
hurd: Simplify init-first.c a bit

And make it a bit more 64-bit ready. This is in preparation to moving this
file into x86/

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230218203717.373211-6-bugaevc@gmail.com>

20 months agohurd: Make timer_t pointer-sized
Sergey Bugaev [Sat, 18 Feb 2023 20:37:12 +0000 (23:37 +0300)]
hurd: Make timer_t pointer-sized

This ensures that a timer_t value can be cast to struct timer_node *
and back.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230218203717.373211-5-bugaevc@gmail.com>

20 months agohurd: Fix xattr function return type
Sergey Bugaev [Sat, 18 Feb 2023 20:37:11 +0000 (23:37 +0300)]
hurd: Fix xattr function return type

They all return int, not size_t.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230218203717.373211-4-bugaevc@gmail.com>

20 months agohurd: Use proper integer types
Sergey Bugaev [Sat, 18 Feb 2023 20:37:10 +0000 (23:37 +0300)]
hurd: Use proper integer types

Fix a few more cases of build errors caused by mismatched types. This is a
continuation of f4315054b46d5e58b44a709a51943fb73f846afb.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230218203717.373211-3-bugaevc@gmail.com>

20 months agohurd: Move thread state manipulation into _hurd_tls_new ()
Sergey Bugaev [Sat, 18 Feb 2023 20:37:09 +0000 (23:37 +0300)]
hurd: Move thread state manipulation into _hurd_tls_new ()

This is going to be done differently on x86_64.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230218203717.373211-2-bugaevc@gmail.com>

20 months agoglob64_time64: Fix typo for stub_warning call (BZ #30146)
Samuel Thibault [Sun, 19 Feb 2023 22:22:41 +0000 (23:22 +0100)]
glob64_time64: Fix typo for stub_warning call (BZ #30146)

We were erroneously reporting a stub warning for glob64 instead of
glob64_time64.

20 months agoUse uintptr_t instead of performing pointer subtraction with a null pointer
Qihao Chencao [Tue, 28 Jun 2022 08:57:55 +0000 (16:57 +0800)]
Use uintptr_t instead of performing pointer subtraction with a null pointer

Signed-off-by: Qihao Chencao <twose@qq.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
20 months agoARC:fpu: add extra capability check before use of sqrt and fma builtins
Pavel Kozlov [Tue, 17 Jan 2023 12:12:23 +0000 (16:12 +0400)]
ARC:fpu: add extra capability check before use of sqrt and fma builtins

Add extra check for compiler definitions to ensure that compiler provides
sqrt and fma hw fpu instructions else use software implementation.

As divide/sqrt and FMA hw support from CPU side is optional,
the compiler can be configured by options to generate hw FPU instructions,
but without use of FDDIV, FDSQRT, FSDIV, FSSQRT, FDMADD and FSMADD
instructions. In this case __builtin_sqrt and __builtin_sqrtf provided by
compiler can't be used inside the glibc code, as these builtins are used
in implementations of sqrt() and sqrtf() functions but at the same time
these builtins unfold to sqrt() and sqrtf(). So it is possible to receive
code like that:

0001c4b4 <__ieee754_sqrtf>:
   1c4b4:    0001 0000      b     0         ;1c4b4 <__ieee754_sqrtf>

The same is also true for __builtin_fma and __builtin_fmaf.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
20 months agoARC: align child stack in clone
Pavel Kozlov [Wed, 21 Dec 2022 16:19:46 +0000 (20:19 +0400)]
ARC: align child stack in clone

The ARCv2 ABI requires 4 byte stack pointer alignment. Don't allow to
use unaligned child stack in clone. As the stack grows down,
align it down.

This was pointed by misc/tst-misalign-clone-internal and
misc/tst-misalign-clone tests. Stack alignmet fixes these tests
fails.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
20 months agostring: Remove string_private.h
Adhemerval Zanella [Fri, 10 Feb 2023 19:48:15 +0000 (16:48 -0300)]
string: Remove string_private.h

Now that _STRING_ARCH_unaligned is not used anymore.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
20 months agoiconv: Remove _STRING_ARCH_unaligned usage
Adhemerval Zanella [Fri, 10 Feb 2023 19:37:36 +0000 (16:37 -0300)]
iconv: Remove _STRING_ARCH_unaligned usage

Use put/get macros __builtin_bswap32 instead.  It allows to remove
the unaligned routines, the compiler will generate unaligned access
if the ABI allows it.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
20 months agoiconv: Remove _STRING_ARCH_unaligned usage for get/set macros
Adhemerval Zanella [Fri, 10 Feb 2023 17:09:10 +0000 (14:09 -0300)]
iconv: Remove _STRING_ARCH_unaligned usage for get/set macros

And use a packed structure instead.  The compiler generates optimized
unaligned code if the architecture supports it.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
20 months agoresolv: Remove _STRING_ARCH_unaligned usage
Adhemerval Zanella [Fri, 10 Feb 2023 14:24:15 +0000 (11:24 -0300)]
resolv: Remove _STRING_ARCH_unaligned usage

GCC with default implementation already generates optimized code.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
20 months agonscd: Remove _STRING_ARCH_unaligned usage
Adhemerval Zanella [Fri, 10 Feb 2023 13:54:47 +0000 (10:54 -0300)]
nscd: Remove _STRING_ARCH_unaligned usage

It only adds a small overhead for unaligned inputs (which should not
be common) and unify the code.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
20 months agostdlib: Simplify getenv
Adhemerval Zanella [Thu, 9 Feb 2023 13:36:57 +0000 (10:36 -0300)]
stdlib: Simplify getenv

And remove _STRING_ARCH_unaligned usage.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
20 months agocrypto: Remove _STRING_ARCH_unaligned usage
Adhemerval Zanella [Thu, 9 Feb 2023 13:26:43 +0000 (10:26 -0300)]
crypto: Remove _STRING_ARCH_unaligned usage

Assume unaligned inputs on all cases.  The code is built and used only
in compat mode.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
20 months agoFix ifunc-impl-list.c build for s390
Joseph Myers [Fri, 17 Feb 2023 17:23:50 +0000 (17:23 +0000)]
Fix ifunc-impl-list.c build for s390

Builds for s390 recently started failing with:

../sysdeps/s390/multiarch/ifunc-impl-list.c: In function '__libc_ifunc_impl_list':
../sysdeps/s390/multiarch/ifunc-impl-list.c:83:21: error: unused variable 'dl_hwcap' [-Werror=unused-variable]
   83 |   unsigned long int dl_hwcap = features->hwcap;
      |                     ^~~~~~~~

https://sourceware.org/pipermail/libc-testresults/2023q1/010855.html

Add __attribute__ ((unused)) as already done for another variable
there.

Tested with build-many-glibcs.py (compilers and glibcs) for
s390x-linux-gnu and s390-linux-gnu.

Note: s390x-linux-gnu-O3 started failing with a different error
earlier; that problem may still need to be fixed after this fix is in.

https://sourceware.org/pipermail/libc-testresults/2023q1/010829.html

20 months ago[hurd] Fix i686 build breakage caused by 4fedebc91108
Flavio Cruz [Fri, 17 Feb 2023 06:16:09 +0000 (01:16 -0500)]
[hurd] Fix i686 build breakage caused by 4fedebc91108

Message-Id: <Y+8bqZzYTl7WaUm7@jupiter.tail36e24.ts.net>

20 months agoC2x strtol binary constant handling
Joseph Myers [Thu, 16 Feb 2023 23:02:40 +0000 (23:02 +0000)]
C2x strtol binary constant handling

C2x adds binary integer constants starting with 0b or 0B, and supports
those constants in strtol-family functions when the base passed is 0
or 2.  Implement that strtol support for glibc.

As discussed at
<https://sourceware.org/pipermail/libc-alpha/2020-December/120414.html>,
this is incompatible with previous C standard versions, in that such
an input string starting with 0b or 0B was previously required to be
parsed as 0 (with the rest of the string unprocessed).  Thus, as
proposed there, this patch adds 20 new __isoc23_* functions with
appropriate header redirection support.  This patch does *not* do
anything about scanf %i (which will need 12 new functions per long
double variant, so 12, 24 or 36 depending on the glibc configuration),
instead leaving that for a future patch.  The function names would
remain as __isoc23_* even if C2x ends up published in 2024 rather than
2023.

Making this change leads to the question of what should happen to
internal uses of these functions in glibc and its tests.  The header
redirection (which applies for _GNU_SOURCE or any other feature test
macros enabling C2x features) has the effect of redirecting internal
uses but without those uses then ending up at a hidden alias (see the
comment in include/stdio.h about interaction with libc_hidden_proto).
It seems desirable for the default for internal uses to be the same
versions used by normal code using _GNU_SOURCE, so rather than doing
anything to disable that redirection, similar macro definitions to
those in include/stdio.h are added to the include/ headers for the new
functions.

Given that the default for uses in glibc is for the redirections to
apply, the next question is whether the C2x semantics are correct for
all those uses.  Uses with the base fixed to 10, 16 or any other value
other than 0 or 2 can be ignored.  I think this leaves the following
internal uses to consider (an important consideration for review of
this patch will be both whether this list is complete and whether my
conclusions on all entries in it are correct):

benchtests/bench-malloc-simple.c
benchtests/bench-string.h
elf/sotruss-lib.c
math/libm-test-support.c
nptl/perf.c
nscd/nscd_conf.c
nss/nss_files/files-parse.c
posix/tst-fnmatch.c
posix/wordexp.c
resolv/inet_addr.c
rt/tst-mqueue7.c
soft-fp/testit.c
stdlib/fmtmsg.c
support/support_test_main.c
support/test-container.c
sysdeps/pthread/tst-mutex10.c

I think all of these places are OK with the new semantics, except for
resolv/inet_addr.c, where the POSIX semantics of inet_addr do not
allow for binary constants; thus, I changed that file (to use
__strtoul_internal, whose semantics are unchanged) and added a test
for this case.  In the case of posix/wordexp.c I think accepting
binary constants is OK since POSIX explicitly allows additional forms
of shell arithmetic expressions, and in stdlib/fmtmsg.c SEV_LEVEL is
not in POSIX so again I think accepting binary constants is OK.

Functions such as __strtol_internal, which are only exported for
compatibility with old binaries from when those were used in inline
functions in headers, have unchanged semantics; the __*_l_internal
versions (purely internal to libc and not exported) have a new
argument to specify whether to accept binary constants.

As well as for the standard functions, the header redirection also
applies to the *_l versions (GNU extensions), and to legacy functions
such as strtoq, to avoid confusing inconsistency (the *q functions
redirect to __isoc23_*ll rather than needing their own __isoc23_*
entry points).  For the functions that are only declared with
_GNU_SOURCE, this means the old versions are no longer available for
normal user programs at all.  An internal __GLIBC_USE_C2X_STRTOL macro
is used to control the redirections in the headers, and cases in glibc
that wish to avoid the redirections - the function implementations
themselves and the tests of the old versions of the GNU functions -
then undefine and redefine that macro to allow the old versions to be
accessed.  (There would of course be greater complexity should we wish
to make any of the old versions into compat symbols / avoid them being
defined at all for new glibc ABIs.)

strtol_l.c has some similarity to strtol.c in gnulib, but has already
diverged some way (and isn't listed at all at
https://sourceware.org/glibc/wiki/SharedSourceFiles unlike strtoll.c
and strtoul.c); I haven't made any attempts at gnulib compatibility in
the changes to that file.

I note incidentally that inttypes.h and wchar.h are missing the
__nonnull present on declarations of this family of functions in
stdlib.h; I didn't make any changes in that regard for the new
declarations added.

20 months ago[hurd] Add MTU_DISCOVER values
Samuel Thibault [Wed, 15 Feb 2023 14:13:19 +0000 (15:13 +0100)]
[hurd] Add MTU_DISCOVER values

20 months agohurd: Fix unwinding over INTR_MSG_TRAP in shared too
Samuel Thibault [Tue, 14 Feb 2023 19:32:15 +0000 (19:32 +0000)]
hurd: Fix unwinding over INTR_MSG_TRAP in shared too

This follows 63550530d98d ("hurd: Fix unwinding over INTR_MSG_TRAP"),
for the shared library case.

20 months agomach: undef ENTRY2
Sergey Bugaev [Tue, 14 Feb 2023 17:37:21 +0000 (20:37 +0300)]
mach: undef ENTRY2

This macro from Mach headers conflicts with how
sysdeps/x86_64/multiarch/strcmp-sse2.S expects it to be defined.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230214173722.428140-3-bugaevc@gmail.com>

20 months agohurd: i386 TLS tweaks
Sergey Bugaev [Tue, 14 Feb 2023 17:37:20 +0000 (20:37 +0300)]
hurd: i386 TLS tweaks

* Micro-optimize TLS access using GCC's native support for gs-based
  addressing when available;
* Just use THREAD_GETMEM and THREAD_SETMEM instead of more inline
  assembly;
* Sync tcbhead_t layout with NPTL, in particular update/fix __private_ss
  offset;
* Statically assert that the two offsets that are a part of ABI are what
  we expect them to be.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230214173722.428140-2-bugaevc@gmail.com>

20 months agostdio: Do not ignore posix_spawn error on popen (BZ #29016)
Adhemerval Zanella [Tue, 6 Dec 2022 16:28:40 +0000 (13:28 -0300)]
stdio: Do not ignore posix_spawn error on popen (BZ #29016)

To correctly return error in case of default shell is not present.

Checked on x86_64-linux-gnu.

20 months agoupdate auto-libm-test-out-hypot
Paul Zimmermann [Tue, 14 Feb 2023 10:24:59 +0000 (11:24 +0100)]
update auto-libm-test-out-hypot

This change was forgotten in commit cf7ffdd.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
20 months agoadded pair of inputs for hypotf in binary32
Paul Zimmermann [Sun, 12 Feb 2023 07:01:18 +0000 (08:01 +0100)]
added pair of inputs for hypotf in binary32

This pair yields an error of 1 ulp in binary32, whereas the current
maximal known error for hypotf on x86_64 is zero:

Checking hypot with glibc-2.37
hypot 0 -1 -0x1.003222p-20,-0x1.6a2d58p-32 [0.501] 0.500001 0.500000001392678
libm gives 0x1.003224p-20
mpfr gives 0x1.003222p-20

See https://sourceware.org/pipermail/libc-alpha/2023-February/145432.html
and https://sourceware.org/pipermail/libc-alpha/2023-February/145442.html
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
20 months agoNaming the parameter of dummy_sa_handler
Mahesh Bodapati [Mon, 13 Feb 2023 17:23:19 +0000 (11:23 -0600)]
Naming the parameter of dummy_sa_handler

ISO C does not support omitting parameter names in function definitions
before C2X,the compiler is giving an error with older versions of gcc and
this commit will resolve the test failure "error: parameter name omitted"

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
20 months agohurd: Fix tcflag_t and speed_t types on 64-bit
Sergey Bugaev [Sun, 12 Feb 2023 16:08:57 +0000 (19:08 +0300)]
hurd: Fix tcflag_t and speed_t types on 64-bit

These are supposed to stay 32-bit even on 64-bit systems. This matches
BSD and Linux, as well as how these types are already defined in
tioctl.defs

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
20 months agohtl: Remove ./sysdeps/htl/bits/types/struct___pthread_mutex.h
Samuel Thibault [Sun, 12 Feb 2023 16:28:32 +0000 (17:28 +0100)]
htl: Remove ./sysdeps/htl/bits/types/struct___pthread_mutex.h

This follows a99155555c21 ("htl: Remove unused files")

20 months agohurd, htl: Add some x86_64-specific code
Sergey Bugaev [Sun, 12 Feb 2023 11:10:42 +0000 (14:10 +0300)]
hurd, htl: Add some x86_64-specific code

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-12-bugaevc@gmail.com>

20 months agoFix typos in comments
Samuel Thibault [Sun, 12 Feb 2023 15:34:28 +0000 (16:34 +0100)]
Fix typos in comments

20 months agohtl: Generalize i386 pt-machdep.h to x86
Samuel Thibault [Sun, 12 Feb 2023 15:32:52 +0000 (16:32 +0100)]
htl: Generalize i386 pt-machdep.h to x86

20 months agohurd: Set up the basic tree for x86_64-gnu
Sergey Bugaev [Sun, 12 Feb 2023 11:10:41 +0000 (14:10 +0300)]
hurd: Set up the basic tree for x86_64-gnu

And move pt-setup.c to the generic x86 tree.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-11-bugaevc@gmail.com>

20 months agomach: Look for mach_i386.defs on x86_64 too
Sergey Bugaev [Sun, 12 Feb 2023 11:10:40 +0000 (14:10 +0300)]
mach: Look for mach_i386.defs on x86_64 too

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-10-bugaevc@gmail.com>

20 months agohtl: Fix semaphore reference
Sergey Bugaev [Sun, 12 Feb 2023 11:10:36 +0000 (14:10 +0300)]
htl: Fix semaphore reference

'sem' is the opaque 'sem_t', 'isem' is the actual 'struct new_sem'.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-6-bugaevc@gmail.com>

20 months agohurd: Fix xattr error value
Sergey Bugaev [Sun, 12 Feb 2023 11:10:35 +0000 (14:10 +0300)]
hurd: Fix xattr error value

This does not seem like it is supposed to return negative error codes.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-5-bugaevc@gmail.com>

20 months agomach, hurd: Cast through uintptr_t
Sergey Bugaev [Sun, 12 Feb 2023 11:10:34 +0000 (14:10 +0300)]
mach, hurd: Cast through uintptr_t

When casting between a pointer and an integer of a different size, GCC
emits a warning (which is escalated to a build failure by -Werror).
Indeed, if what you start with is a pointer, which you then cast to a
shorter integer and then back again, you're going to cut off some bits
of the pointer.

But if you start with an integer (such as mach_port_t), then cast it to
a longer pointer (void *), and then back to a shorter integer, you are
fine. To keep GCC happy, cast through an intermediary uintptr_t, which
is always the same size as a pointer.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-4-bugaevc@gmail.com>

20 months agohurd: Use mach_msg_type_number_t where appropriate
Sergey Bugaev [Sun, 12 Feb 2023 11:10:33 +0000 (14:10 +0300)]
hurd: Use mach_msg_type_number_t where appropriate

It has been decided that on x86_64, mach_msg_type_number_t stays 32-bit.
Therefore, it's not possible to use mach_msg_type_number_t
interchangeably with size_t, in particular this breaks when a pointer to
a variable is passed to a MIG routine.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-3-bugaevc@gmail.com>

20 months agohurd: Refactor readlinkat()
Sergey Bugaev [Sun, 12 Feb 2023 11:10:32 +0000 (14:10 +0300)]
hurd: Refactor readlinkat()

Make the code flow more linear using early returns where possible. This
makes it so much easier to reason about what runs on error / successful
code paths.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-2-bugaevc@gmail.com>

20 months agoUse __builtin_FILE instead of __FILE__ in assert in C++.
Paul Pluzhnikov [Fri, 10 Feb 2023 16:14:30 +0000 (16:14 +0000)]
Use __builtin_FILE instead of __FILE__ in assert in C++.

Likewise use __builtin_LINE instead of __LINE__.

When building C++, inline functions are required to have the exact same
sequence of tokens in every translation unit. But __FILE__ token, when
used in a header file, does not necessarily expand to the exact same
string literal, and that may cause compilation failure when C++ modules
are being used. (It would also cause unpredictable output on assertion
failure at runtime, but this rarely matters in practice.)

For example, given the following sources:

  // a.h
  #include <assert.h>
  inline void fn () { assert (0); }

  // a.cc
  #include "a.h"

  // b.cc
  #include "foo/../a.h"

preprocessing a.cc will yield a call to __assert_fail("0", "a.h", ...)
but b.cc will yield __assert_fail("0", "foo/../a.h", ...)

20 months agohurd: Fix unwinding over INTR_MSG_TRAP
Samuel Thibault [Thu, 9 Feb 2023 18:58:43 +0000 (19:58 +0100)]
hurd: Fix unwinding over INTR_MSG_TRAP

We used to use .cfi_adjust_cfa_offset around %esp manipulation
asm instructions to fix unwinding, but when building glibc with
-fno-omit-frame-pointer this is bogus since in that case %ebp is the CFA and
does not move.

Instead, let's force -fno-omit-frame-pointer when building intr-msg.c so
that %ebp can always be used and no .cfi_adjust_cfa_offset is needed.

20 months agopowerpc64: Add the clone3 wrapper
Adhemerval Zanella Netto [Fri, 3 Feb 2023 17:12:33 +0000 (14:12 -0300)]
powerpc64: 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);

The powerpc64 ABI requires an initial stackframe so the child can
store/restore the TOC.  It is create prior calling clone3 by
adjusting the stack size (since kernel will compute the stack as
stack plus size).

Checked on powerpc64-linux-gnu (power8, kernel 6.0) and
powerpc64le-linux-gnu (power9, kernel 4.18).
Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
20 months agostring: Disable stack protector in early static initialization
Adhemerval Zanella [Mon, 6 Feb 2023 18:07:44 +0000 (15:07 -0300)]
string: Disable stack protector in early static initialization

For powerpc, strncmp is used on _dl_string_platform issued by
__tcb_parse_hwcap_and_convert_at_platform.

Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
20 months agostring: Add libc_hidden_proto for memrchr
Adhemerval Zanella [Mon, 6 Feb 2023 18:05:56 +0000 (15:05 -0300)]
string: Add libc_hidden_proto for memrchr

Although static linker can optimize it to local call, it follows the
internal scheme to provide hidden proto and definitions.

Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
20 months agostring: Add libc_hidden_proto for strchrnul
Adhemerval Zanella [Mon, 6 Feb 2023 16:15:22 +0000 (13:15 -0300)]
string: Add libc_hidden_proto for strchrnul

Although static linker can optimize it to local call, it follows the
internal scheme to provide hidden proto and definitions.

Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
20 months agoelf: Smoke-test ldconfig -p against system /etc/ld.so.cache
Florian Weimer [Wed, 8 Feb 2023 17:11:04 +0000 (18:11 +0100)]
elf: Smoke-test ldconfig -p against system /etc/ld.so.cache

The test is sufficient to detect the ldconfig bug fixed in
commit 9fe6f6363886aae6b2b210cae3ed1f5921299083 ("elf: Fix 64 time_t
support for installed statically binaries").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
20 months agoNEWS: Document CVE-2023-25139.
Carlos O'Donell [Mon, 6 Feb 2023 15:36:32 +0000 (10:36 -0500)]
NEWS: Document CVE-2023-25139.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
20 months agoUse 64-bit time_t interfaces in strftime and strptime (bug 30053)
Andreas Schwab [Thu, 26 Jan 2023 13:25:05 +0000 (14:25 +0100)]
Use 64-bit time_t interfaces in strftime and strptime (bug 30053)

Both functions use time_t only internally, so the ABI is not affected.

20 months agoC-SKY: Strip hard float abi from hard float feature.
quxm [Wed, 25 Jan 2023 09:47:33 +0000 (17:47 +0800)]
C-SKY: Strip hard float abi from hard float feature.

The hard float abi and hard float are different,
  Hard float abi: Use float register to pass float type arguments.
  Hard float: Enable the hard float ISA feature.
So the with_fp_cond cannot represent these two features. When
-mfloat-abi=softfp, the float abi is soft and hard float is enabled.
So add 'with_hard_float_abi' in preconfigure and define 'CSKY_HARD_FLOAT_ABI'
if float abi is hard, and use 'CSKY_HARD_FLOAT_ABI' to determine
dynamic linker because it is what determines compatibility.
And with_fp_cond is still needed to tell glibc whether to enable
hard floating feature.
In addition, use AC_TRY_COMMAND to test gcc to ensure compatibility
between different versions of gcc. The original way has a problem
that __CSKY_HARD_FLOAT_FPU_SF__ means the target only has single
hard float-points ISA, so it's not defined in CPUs like ck810f.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
20 months agoS390: Influence hwcaps/stfle via GLIBC_TUNABLES.
Stefan Liebler [Thu, 2 Feb 2023 13:57:50 +0000 (14:57 +0100)]
S390: Influence hwcaps/stfle via GLIBC_TUNABLES.

This patch enables the option to influence hwcaps and stfle bits used
by the s390 specific ifunc-resolvers.  The currently x86-specific
tunable glibc.cpu.hwcaps is also used on s390x to achieve the task. In
addition the user can also set a CPU arch-level like z13 instead of
single HWCAP and STFLE features.

Note that the tunable only handles the features which are really used
in the IFUNC-resolvers.  All others are ignored as the values are only
used inside glibc.  Thus we can influence:
- HWCAP_S390_VXRS (z13)
- HWCAP_S390_VXRS_EXT (z14)
- HWCAP_S390_VXRS_EXT2 (z15)
- STFLE_MIE3 (z15)

The influenced hwcap/stfle-bits are stored in the s390-specific
cpu_features struct which also contains reserved fields for future
usage.

The ifunc-resolvers and users of stfle bits are adjusted to use the
information from cpu_features struct.

On 31bit, the ELF_MACHINE_IRELATIVE macro is now also defined.
Otherwise the new ifunc-resolvers segfaults as they depend on
the not yet processed_rtld_global_ro@GLIBC_PRIVATE relocation.

20 months agostring: Hook up the default implementation on test-strrchr
Adhemerval Zanella [Thu, 2 Feb 2023 16:57:20 +0000 (13:57 -0300)]
string: Hook up the default implementation on test-strrchr

And remove SIMPLE_STRRCHR, which is not used anywhere.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agostring: Hook up the default implementation on test-memrchr
Adhemerval Zanella [Tue, 17 Jan 2023 13:14:58 +0000 (10:14 -0300)]
string: Hook up the default implementation on test-memrchr

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agostring: Hook up the default implementation on test-memchr
Adhemerval Zanella [Tue, 17 Jan 2023 13:14:03 +0000 (10:14 -0300)]
string: Hook up the default implementation on test-memchr

And remove SIMPLE_MEMCHR, which is not used anywhere.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agostring: Hook up the default implementation on test-strcpy
Adhemerval Zanella [Tue, 31 Jan 2023 19:29:58 +0000 (16:29 -0300)]
string: Hook up the default implementation on test-strcpy

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agostring: Hook up the default implementation on test-stpcpy
Adhemerval Zanella [Tue, 31 Jan 2023 19:29:53 +0000 (16:29 -0300)]
string: Hook up the default implementation on test-stpcpy

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agostring: Hook up the default implementation on test-strncmp
Adhemerval Zanella [Fri, 20 Jan 2023 20:50:41 +0000 (17:50 -0300)]
string: Hook up the default implementation on test-strncmp

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agostring: Hook up the default implementation on test-strcmp
Adhemerval Zanella [Tue, 17 Jan 2023 13:13:35 +0000 (10:13 -0300)]
string: Hook up the default implementation on test-strcmp

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agostring: Hook up the default implementation on test-strchr
Adhemerval Zanella [Tue, 17 Jan 2023 13:12:40 +0000 (10:12 -0300)]
string: Hook up the default implementation on test-strchr

Also remove the simple_STRCHR, which can be easily replaced.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agostring: Hook up the default implementation on test-strnlen
Adhemerval Zanella [Tue, 17 Jan 2023 13:11:36 +0000 (10:11 -0300)]
string: Hook up the default implementation on test-strnlen

Also remove the SIMPLE_STRNLEN, which is not used anywhere.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agostring: Hook up the default implementation on test-strlen
Adhemerval Zanella [Tue, 17 Jan 2023 13:10:21 +0000 (10:10 -0300)]
string: Hook up the default implementation on test-strlen

Also remove the simple_STRLEN and builtin_strlen, which are not used
anywhere.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agoriscv: Add string-fza.h and string-fzi.h
Adhemerval Zanella [Wed, 1 Feb 2023 15:44:17 +0000 (12:44 -0300)]
riscv: Add string-fza.h and string-fzi.h

It uses the bitmanip extension to optimize index_fist and index_last
with clz/ctz (using generic implementation that routes to compiler
builtin) and orc.b to check null bytes.

Checked the string test on riscv64 user mode.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20 months agosh: Add string-fzb.h
Adhemerval Zanella [Tue, 10 Jan 2023 21:01:06 +0000 (18:01 -0300)]
sh: Add string-fzb.h

Use the SH cmp/str on has_{zero,eq,zero_eq}.

Checked on sh4-linux-gnu.

This page took 0.089918 seconds and 5 git commands to generate.