]> sourceware.org Git - glibc.git/log
glibc.git
2 years agomath: Use builtin for ldbl-96 copysign
Adhemerval Zanella [Thu, 7 Apr 2022 17:39:59 +0000 (14:39 -0300)]
math: Use builtin for ldbl-96 copysign

All architectures that uses it (x86, ia64, m68k) implement the
builtin.

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

2 years agoia64: Remove fcopysign{f} implementation
Adhemerval Zanella [Tue, 5 Apr 2022 12:46:31 +0000 (09:46 -0300)]
ia64: Remove fcopysign{f} implementation

The builtin used by generic code generates similar code.

Checked on ia64-linux-gnu.

2 years agox86: Remove fcopysign{f} implementation
Adhemerval Zanella [Tue, 5 Apr 2022 12:04:36 +0000 (09:04 -0300)]
x86: Remove fcopysign{f} implementation

The builtin used by generic code generates similar code.

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

2 years agopowerpc: Remove fcopysign{f} implementation
Adhemerval Zanella [Tue, 5 Apr 2022 13:12:03 +0000 (10:12 -0300)]
powerpc: Remove fcopysign{f} implementation

The builtin and generic implementation from generic files are suffice.

Checked on powerpc64-linux-gnu and powerpc-linux-gnu.

2 years agoAdd rif_MA locale [BZ #27781]
Ilyahoo Proshel [Tue, 5 Apr 2022 11:23:16 +0000 (13:23 +0200)]
Add rif_MA locale [BZ #27781]

Resolves: BZ #27781

2 years agotests/string: Drop simple/stupid/builtin tests
Siddhesh Poyarekar [Wed, 6 Apr 2022 15:23:24 +0000 (20:53 +0530)]
tests/string: Drop simple/stupid/builtin tests

In most cases the simple/stupid/builtin functions were in there to
benchmark optimized implementations against.  Only in some cases the
functions are used to check expected results.

Remove these tests from IMPL() and only keep them in wherever they're
used for a specific purpose, e.g. to generate expected results.

This improves timing of `make subdirs=string` by over a minute and a
half (over 15%) on a Whiskey Lake laptop.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Noah Goldstein <libc-alpha@sourceware.org>
2 years agotest-memcpy: Actually reverse source and destination
Siddhesh Poyarekar [Wed, 6 Apr 2022 07:15:39 +0000 (12:45 +0530)]
test-memcpy: Actually reverse source and destination

Looks like an oversight in memcpy tests resulted in s2 and s1 not being
swapped for the second iteration of the memcpy test.  Fix it.  Also fix
a formatting nit.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agobenchtests: Only build libmvec benchmarks iff $(build-mathvec) is set
Adhemerval Zanella [Mon, 4 Apr 2022 12:34:14 +0000 (09:34 -0300)]
benchtests: Only build libmvec benchmarks iff $(build-mathvec) is set

Checked on x86_64-linux-gnu.

2 years agolinux: Fix __closefrom_fallback iterates until max int (BZ#28993)
Adhemerval Zanella [Wed, 23 Mar 2022 20:40:01 +0000 (17:40 -0300)]
linux: Fix __closefrom_fallback iterates until max int (BZ#28993)

The __closefrom_fallback tries to get a available file descriptor
if the initial open ("/proc/self/fd/", ...) fails.  It assumes the
failure would be only if procfs is not mount (ENOENT), however if
the the proc file is not accessible (due some other kernel filtering
such apparmor) it will iterate over a potentially large file set
issuing close calls.

It should only try the close fallback if open returns EMFILE,
ENFILE, or ENOMEM.

Checked on x86_64-linux-gnu.

2 years agoRemove -z combreloc and HAVE_Z_COMBRELOC
Fangrui Song [Tue, 5 Apr 2022 00:19:07 +0000 (17:19 -0700)]
Remove -z combreloc and HAVE_Z_COMBRELOC

-z combreloc has been the default regadless of the architecture since
binutils commit f4d733664aabd7bd78c82895e030ec9779a92809 (2002). The
configure check added in commit fdde83499a05 (2001) has long been
unneeded.

We can therefore treat HAVE_Z_COMBRELOC as always 1 and delete dead code
paths in dl-machine.h files (many were copied from commit a711b01d34ca
and ee0cb67ec238).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agosparc: Remove s_abs implementations
Adhemerval Zanella [Fri, 1 Apr 2022 13:18:19 +0000 (10:18 -0300)]
sparc: Remove s_abs implementations

For sparc64 is the same as the generic implementation, while for
sparc32 the builtin generates the same code.

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

2 years agoia64: Remove fabs implementations
Adhemerval Zanella [Fri, 1 Apr 2022 12:53:39 +0000 (09:53 -0300)]
ia64: Remove fabs implementations

The generic implementation fixes 5 fabs tests on ia64-linux-gnu:

  math/test-double-fabs
  math/test-float-fabs
  math/test-float32-fabs
  math/test-float32x-fabs
  math/test-float64-fabs

Checked on ia64-linux-gnu.

2 years agox86: Remove fabs{f} implementation
Adhemerval Zanella [Fri, 1 Apr 2022 12:52:14 +0000 (09:52 -0300)]
x86: Remove fabs{f} implementation

For x86_64 is the same as the generic implementation, while for i686
the builtin generates the same code.

2 years agoalpha: Remove s_abs implementations
Adhemerval Zanella [Fri, 1 Apr 2022 12:51:06 +0000 (09:51 -0300)]
alpha: Remove s_abs implementations

The generic implementation already uses builtins.

2 years agoAllow for unpriviledged nested containers
DJ Delorie [Tue, 29 Mar 2022 03:53:33 +0000 (23:53 -0400)]
Allow for unpriviledged nested containers

If the build itself is run in a container, we may not be able to
fully set up a nested container for test-container testing.
Notably is the mounting of /proc, since it's critical that it
be mounted from within the same PID namespace as its users, and
thus cannot be bind mounted from outside the container like other
mounts.

This patch defaults to using the parent's PID namespace instead of
creating a new one, as this is more likely to be allowed.

If the test needs an isolated PID namespace, it should add the "pidns"
command to its init script.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 years agoIncrease the test timeout of some string tests
Szabolcs Nagy [Tue, 29 Mar 2022 08:50:23 +0000 (09:50 +0100)]
Increase the test timeout of some string tests

Recent changes in test-strncasecmp and test-strncmp pushed the run time
of the tests above the 4 minute limit specified in test-string.h on an
arm tester machine.

2 years agorealpath: Bring back GNU extension on ENOENT and EACCES [BZ #28996]
Siddhesh Poyarekar [Thu, 31 Mar 2022 16:30:58 +0000 (22:00 +0530)]
realpath: Bring back GNU extension on ENOENT and EACCES [BZ #28996]

The GNU extension for realpath states that if the path resolution fails
with ENOENT or EACCES and the resolved buffer is non-NULL, it will
contain part of the path that failed resolution.

commit 949ad78a189194048df8a253bb31d1d11d919044 broke this when it
omitted the copy on failure.  Bring it back partially to continue
supporting this GNU extension.

Resolves: BZ #28996

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
2 years agostdlib: Fix tst-getrandom memcmp call
Adhemerval Zanella [Thu, 24 Mar 2022 18:17:12 +0000 (15:17 -0300)]
stdlib: Fix tst-getrandom memcmp call

The idea is to check if the up sizeof (buf) are equal, not only
the first byte.

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

2 years agostdlib: Fix tst-rand48.c printf types
Adhemerval Zanella [Thu, 24 Mar 2022 18:22:55 +0000 (15:22 -0300)]
stdlib: Fix tst-rand48.c printf types

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

2 years agoelf: Remove unused functions from tst-audit25(a,b)
Adhemerval Zanella [Fri, 25 Mar 2022 11:53:42 +0000 (08:53 -0300)]
elf: Remove unused functions from tst-audit25(a,b)

2 years agonptl: Use libc-diag.h with tst-thread-setspecific
Adhemerval Zanella [Fri, 25 Mar 2022 12:01:48 +0000 (09:01 -0300)]
nptl: Use libc-diag.h with tst-thread-setspecific

And also use libsupport.

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

2 years agocrypt: Remove unused variable on cert test
Adhemerval Zanella [Fri, 25 Mar 2022 14:13:37 +0000 (11:13 -0300)]
crypt: Remove unused variable on cert test

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

2 years agoelf: Remove unused variables in tests
Adhemerval Zanella [Fri, 25 Mar 2022 14:16:26 +0000 (11:16 -0300)]
elf: Remove unused variables in tests

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

2 years agoelf: Fix wrong fscanf usage on tst-pldd
Adhemerval Zanella [Fri, 25 Mar 2022 14:16:49 +0000 (11:16 -0300)]
elf: Fix wrong fscanf usage on tst-pldd

To take in consideration the extra '\0'.

Checked on x86_64-linux-gnu.

2 years agoposix: Remove unused variable on tst-_Fork.c
Adhemerval Zanella [Fri, 25 Mar 2022 14:25:22 +0000 (11:25 -0300)]
posix: Remove unused variable on tst-_Fork.c

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

2 years agoresolv: Initialize loop variable on tst-resolv-trailing
Adhemerval Zanella [Fri, 25 Mar 2022 14:26:26 +0000 (11:26 -0300)]
resolv: Initialize loop variable on tst-resolv-trailing

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

2 years agolocale: Remove set but unused variable on ld-collate.c
Adhemerval Zanella [Fri, 25 Mar 2022 16:57:38 +0000 (13:57 -0300)]
locale: Remove set but unused variable on ld-collate.c

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

2 years agolocaledate: Fix printf type on tst_mbrtowc
Adhemerval Zanella [Mon, 28 Mar 2022 17:55:52 +0000 (14:55 -0300)]
localedate: Fix printf type on tst_mbrtowc

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

2 years agolocaledata: Remove unused variables in tests
Adhemerval Zanella [Mon, 28 Mar 2022 17:40:55 +0000 (14:40 -0300)]
localedata: Remove unused variables in tests

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

2 years agox86: Small improvements for wcslen
Noah Goldstein [Fri, 25 Mar 2022 22:13:33 +0000 (17:13 -0500)]
x86: Small improvements for wcslen

Just a few QOL changes.
    1. Prefer `add` > `lea` as it has high execution units it can run
       on.
    2. Don't break macro-fusion between `test` and `jcc`
    3. Reduce code size by removing gratuitous padding bytes (-90
       bytes).

geometric_mean(N=20) of all benchmarks New / Original: 0.959

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Small improvements for wcscpy-ssse3
Noah Goldstein [Fri, 25 Mar 2022 22:13:32 +0000 (17:13 -0500)]
x86: Small improvements for wcscpy-ssse3

Just a few small QOL changes.
    1. Prefer `add` > `lea` as it has high execution units it can run
       on.
    2. Don't break macro-fusion between `test` and `jcc`

geometric_mean(N=20) of all benchmarks New / Original: 0.973

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agodebug: Improve fdelt_chk error message
Cristian Rodríguez [Sun, 13 Mar 2022 18:40:24 +0000 (18:40 +0000)]
debug: Improve fdelt_chk error message

It is not a "buffer overflow detected" but an out of range
bit on fd_set

Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agoAdd HWCAP2_AFP, HWCAP2_RPRES from Linux 5.17 to AArch64 bits/hwcap.h
Joseph Myers [Mon, 28 Mar 2022 13:16:48 +0000 (13:16 +0000)]
Add HWCAP2_AFP, HWCAP2_RPRES from Linux 5.17 to AArch64 bits/hwcap.h

Add the new HWCAP2_AFP and HWCAP2_RPRES constants from Linux 5.17.
Tested with build-many-glibcs.py for aarch64-linux-gnu.

2 years agox86: Remove AVX str{n}casecmp
Noah Goldstein [Wed, 23 Mar 2022 21:57:46 +0000 (16:57 -0500)]
x86: Remove AVX str{n}casecmp

The rational is:

1. SSE42 has nearly identical logic so any benefit is minimal (3.4%
   regression on Tigerlake using SSE42 versus AVX across the
   benchtest suite).
2. AVX2 version covers the majority of targets that previously
   prefered it.
3. The targets where AVX would still be best (SnB and IVB) are
   becoming outdated.

All in all the saving the code size is worth it.

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Add EVEX optimized str{n}casecmp
Noah Goldstein [Thu, 24 Mar 2022 23:56:13 +0000 (18:56 -0500)]
x86: Add EVEX optimized str{n}casecmp

geometric_mean(N=40) of all benchmarks EVEX / SSE42: .621

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Add AVX2 optimized str{n}casecmp
Noah Goldstein [Thu, 24 Mar 2022 23:56:12 +0000 (18:56 -0500)]
x86: Add AVX2 optimized str{n}casecmp

geometric_mean(N=40) of all benchmarks AVX2 / SSE42: .702

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agostring: Expand page cross test cases in test-strncmp.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:40 +0000 (16:57 -0500)]
string: Expand page cross test cases in test-strncmp.c

Test cases for when both `s1` and `s2` are near the end of a page
where previously missing.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agostring: Expand page cross test cases in test-strcmp.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:39 +0000 (16:57 -0500)]
string: Expand page cross test cases in test-strcmp.c

Test cases for when both `s1` and `s2` are near the end of a page
where previously missing.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Optimize str{n}casecmp TOLOWER logic in strcmp-sse42.S
Noah Goldstein [Wed, 23 Mar 2022 21:57:38 +0000 (16:57 -0500)]
x86: Optimize str{n}casecmp TOLOWER logic in strcmp-sse42.S

Slightly faster method of doing TOLOWER that saves an
instruction.

Also replace the hard coded 5-byte no with .p2align 4. On builds with
CET enabled this misaligned entry to strcasecmp.

geometric_mean(N=40) of all benchmarks New / Original: .920

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Optimize str{n}casecmp TOLOWER logic in strcmp.S
Noah Goldstein [Wed, 23 Mar 2022 21:57:36 +0000 (16:57 -0500)]
x86: Optimize str{n}casecmp TOLOWER logic in strcmp.S

Slightly faster method of doing TOLOWER that saves an
instruction.

Also replace the hard coded 5-byte no with .p2align 4. On builds with
CET enabled this misaligned entry to strcasecmp.

geometric_mean(N=40) of all benchmarks New / Original: .894

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agostring: Expand page cross tests in test-strncasecmp.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:34 +0000 (16:57 -0500)]
string: Expand page cross tests in test-strncasecmp.c

Add more robust tests that cover all the page cross edge cases.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agostring: Expand page cross tests in test-strcasecmp.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:33 +0000 (16:57 -0500)]
string: Expand page cross tests in test-strcasecmp.c

Add more robust tests that cover all the page cross edge cases.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agobenchtests: Use json-lib in bench-strncasecmp.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:32 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strncasecmp.c

Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agobenchtests: Use json-lib in bench-strcasecmp.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:31 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strcasecmp.c

Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Fix fallback for wcsncmp_avx2 in strcmp-avx2.S [BZ #28896]
Noah Goldstein [Thu, 24 Mar 2022 20:50:33 +0000 (15:50 -0500)]
x86: Fix fallback for wcsncmp_avx2 in strcmp-avx2.S [BZ #28896]

Overflow case for __wcsncmp_avx2_rtm should be __wcscmp_avx2_rtm not
__wcscmp_avx2.

commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Sun Jan 9 16:02:21 2022 -0600

    x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]

Set the wrong fallback function for `__wcsncmp_avx2_rtm`. It was set
to fallback on to `__wcscmp_avx2` instead of `__wcscmp_avx2_rtm` which
can cause spurious aborts.

This change will need to be backported.

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Remove strspn-sse2.S and use the generic implementation
Noah Goldstein [Wed, 23 Mar 2022 21:57:29 +0000 (16:57 -0500)]
x86: Remove strspn-sse2.S and use the generic implementation

The generic implementation is faster.

geometric_mean(N=20) of all benchmarks New / Original: .710

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Remove strpbrk-sse2.S and use the generic implementation
Noah Goldstein [Wed, 23 Mar 2022 21:57:27 +0000 (16:57 -0500)]
x86: Remove strpbrk-sse2.S and use the generic implementation

The generic implementation is faster (see strcspn commit).

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Remove strcspn-sse2.S and use the generic implementation
Noah Goldstein [Wed, 23 Mar 2022 21:57:26 +0000 (16:57 -0500)]
x86: Remove strcspn-sse2.S and use the generic implementation

The generic implementation is faster.

geometric_mean(N=20) of all benchmarks New / Original: .678

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Optimize strspn in strspn-c.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:24 +0000 (16:57 -0500)]
x86: Optimize strspn in strspn-c.c

Use _mm_cmpeq_epi8 and _mm_movemask_epi8 to get strlen instead of
_mm_cmpistri. Also change offset to unsigned to avoid unnecessary
sign extensions.

geometric_mean(N=20) of all benchmarks that dont fallback on
sse2; New / Original: .901

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Optimize strcspn and strpbrk in strcspn-c.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:22 +0000 (16:57 -0500)]
x86: Optimize strcspn and strpbrk in strcspn-c.c

Use _mm_cmpeq_epi8 and _mm_movemask_epi8 to get strlen instead of
_mm_cmpistri. Also change offset to unsigned to avoid unnecessary
sign extensions.

geometric_mean(N=20) of all benchmarks that dont fallback on
sse2/strlen; New / Original: .928

All string/memory tests pass.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agobenchtests: Use json-lib in bench-strspn.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:20 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strspn.c

Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agobenchtests: Use json-lib in bench-strpbrk.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:19 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strpbrk.c

Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Code cleanup in strchr-evex and comment justifying branch
Noah Goldstein [Wed, 23 Mar 2022 21:57:18 +0000 (16:57 -0500)]
x86: Code cleanup in strchr-evex and comment justifying branch

Small code cleanup for size: -81 bytes.

Add comment justifying using a branch to do NULL/non-null return.

All string/memory tests pass and no regressions in benchtests.

geometric_mean(N=20) of all benchmarks New / Original: .985
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agox86: Code cleanup in strchr-avx2 and comment justifying branch
Noah Goldstein [Wed, 23 Mar 2022 21:57:16 +0000 (16:57 -0500)]
x86: Code cleanup in strchr-avx2 and comment justifying branch

Small code cleanup for size: -53 bytes.

Add comment justifying using a branch to do NULL/non-null return.

All string/memory tests pass and no regressions in benchtests.

geometric_mean(N=20) of all benchmarks Original / New: 1.00
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agobenchtests: Add random benchmark in bench-strchr.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:14 +0000 (16:57 -0500)]
benchtests: Add random benchmark in bench-strchr.c

Add benchmark that randomizes whether return should be NULL or pointer
to CHAR. The rationale is on many architectures there is a choice
between a predicate execution option (i.e cmovcc on x86) or a branch.

On x86 the results for cmovcc vs branch are something along the lines
of the following:

perc-zero, Br On Result, Time Br / Time cmov
     0.10,            1,              ,0.983
     0.10,            0,              ,1.246
     0.25,            1,              ,1.035
     0.25,            0,              ,1.49
     0.33,            1,              ,1.016
     0.33,            0,              ,1.579
     0.50,            1,              ,1.228
     0.50,            0,              ,1.739
     0.66,            1,              ,1.039
     0.66,            0,              ,1.764
     0.75,            1,              ,0.996
     0.75,            0,              ,1.642
     0.90,            1,              ,1.071
     0.90,            0,              ,1.409
     1.00,            1,              ,0.937
     1.00,            0,              ,0.999
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agobenchtests: Use json-lib in bench-strchr.c
Noah Goldstein [Wed, 23 Mar 2022 21:57:13 +0000 (16:57 -0500)]
benchtests: Use json-lib in bench-strchr.c

Just QOL change to make parsing the output of the benchtests more
consistent.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 years agoUpdate kernel version to 5.17 in tst-mman-consts.py
Joseph Myers [Thu, 24 Mar 2022 15:35:27 +0000 (15:35 +0000)]
Update kernel version to 5.17 in tst-mman-consts.py

This patch updates the kernel version in the test tst-mman-consts.py
to 5.17.  (There are no new MAP_* constants covered by this test in
5.17 that need any other header changes.)

Tested with build-many-glibcs.py.

2 years agoiconvdata: Fix enum type on UTF-7
Adhemerval Zanella [Tue, 22 Mar 2022 18:54:38 +0000 (15:54 -0300)]
iconvdata: Fix enum type on UTF-7

Checked on x86_64-linux-gnu.

2 years agonscd: Remove unused variable
Adhemerval Zanella [Thu, 10 Mar 2022 20:16:56 +0000 (17:16 -0300)]
nscd: Remove unused variable

2 years agosupport: Fix support_process_state_wait path size calculation
Adhemerval Zanella [Thu, 10 Mar 2022 19:49:08 +0000 (16:49 -0300)]
support: Fix support_process_state_wait path size calculation

Use INT_STRLEN_BOUND to proper get the maximum pid_t size.  Also
fix the wrong calculation (the 3 should multiply the sizeof (pid_t)).

Checked on x86_64-linux-gnu.

2 years agosupport: Remove unused extract_8 function
Adhemerval Zanella [Thu, 10 Mar 2022 19:45:58 +0000 (16:45 -0300)]
support: Remove unused extract_8 function

2 years agolocale: Remove ununsed wctype_table_get function
Adhemerval Zanella [Thu, 10 Mar 2022 12:51:20 +0000 (09:51 -0300)]
locale: Remove ununsed wctype_table_get function

2 years agogmon: Remove unused sprofil.c functions
Adhemerval Zanella [Thu, 10 Mar 2022 11:08:37 +0000 (08:08 -0300)]
gmon: Remove unused sprofil.c functions

2 years agoUpdate syscall lists for Linux 5.17
Joseph Myers [Wed, 23 Mar 2022 17:11:56 +0000 (17:11 +0000)]
Update syscall lists for Linux 5.17

Linux 5.17 has one new syscall, set_mempolicy_home_node.  Update
syscall-names.list and regenerate the arch-syscall.h headers with
build-many-glibcs.py update-syscalls.

Tested with build-many-glibcs.py.

2 years agoFix ununsed fstatat64_time64_statx
Adhemerval Zanella [Wed, 9 Mar 2022 21:35:39 +0000 (18:35 -0300)]
Fix ununsed fstatat64_time64_statx

It is only called for legacy ABIs.

2 years agomalloc: Fix duplicate inline for do_set_mxfast
Adhemerval Zanella [Wed, 9 Mar 2022 20:24:00 +0000 (17:24 -0300)]
malloc: Fix duplicate inline for do_set_mxfast

2 years agoelf: Remove inline _dl_dprintf
Adhemerval Zanella [Mon, 7 Mar 2022 13:43:41 +0000 (10:43 -0300)]
elf: Remove inline _dl_dprintf

It is not used on rtld and ldsodef interfaces are meant to be used
solely on loader.  It also removes the only usage of gcc extension
__builtin_va_arg_pack.

2 years agoconfigure.ac: fix bashisms in configure.ac
Sam James [Tue, 22 Mar 2022 17:33:09 +0000 (17:33 +0000)]
configure.ac: fix bashisms in configure.ac

configure scripts need to be runnable with a POSIX-compliant /bin/sh.

On many (but not all!) systems, /bin/sh is provided by Bash, so errors
like this aren't spotted. Notably Debian defaults to /bin/sh provided
by dash which doesn't tolerate such bashisms as '=='.

This retains compatibility with bash.

Fixes configure warnings/errors like:
```
checking if compiler warns about alias for function with incompatible types... yes
/var/tmp/portage/sys-libs/glibc-2.34-r10/work/glibc-2.34/configure: 4209: test: xyes: unexpected operator
```

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Sam James <sam@gentoo.org>
2 years agogetaddrinfo: Refactor code for readability
Siddhesh Poyarekar [Tue, 22 Mar 2022 17:10:05 +0000 (22:40 +0530)]
getaddrinfo: Refactor code for readability

The close_retry goto jump is confusing and clumsy to read, so refactor
the code a bit to make it easier to follow.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agoUse Linux 5.17 in build-many-glibcs.py
Joseph Myers [Tue, 22 Mar 2022 18:01:16 +0000 (18:01 +0000)]
Use Linux 5.17 in build-many-glibcs.py

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

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

2 years agoresolv: Fix unaligned accesses to fields in HEADER struct
John David Anglin [Tue, 22 Mar 2022 17:35:54 +0000 (17:35 +0000)]
resolv: Fix unaligned accesses to fields in HEADER struct

The structure HEADER is normally aligned to a word boundary but
sometimes it needs to be accessed when aligned on a byte boundary.
This change defines a new typedef, UHEADER, with alignment 1.
It is used to ensure the fields are accessed with byte loads and
stores when necessary.

V4: Change to res_mkquery.c deleted.  Small whitespace fix.

V5: Move UHEADER typedef to resolv/resolv-internal.h.  Replace all
HEADER usage with UHEADER in resolv/res_send.c.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agogai_init: Avoid jumping from if condition to its else counterpart
Siddhesh Poyarekar [Tue, 3 Aug 2021 15:59:23 +0000 (21:29 +0530)]
gai_init: Avoid jumping from if condition to its else counterpart

Clean up another antipattern where code flows from an if condition to
its else counterpart with a goto.

Most of the change in this patch is whitespace-only; a `git diff -b`
ought to show the actual logic changes.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaiconf_init: Refactor some bits for readability
Siddhesh Poyarekar [Tue, 27 Jul 2021 17:19:53 +0000 (22:49 +0530)]
gaiconf_init: Refactor some bits for readability

Split out line processing for `label`, `precedence` and `scopev4` into
separate functions instead of the gotos.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogethosts: Return EAI_MEMORY on allocation failure
Siddhesh Poyarekar [Wed, 2 Mar 2022 06:15:29 +0000 (11:45 +0530)]
gethosts: Return EAI_MEMORY on allocation failure

All other cases of failures due to lack of memory return EAI_MEMORY, so
it seems wrong to return EAI_SYSTEM here.  The only reason
convert_hostent_to_gaih_addrtuple could fail is on calloc failure.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaih_inet: Split result generation into its own function
Siddhesh Poyarekar [Mon, 7 Mar 2022 15:08:31 +0000 (20:38 +0530)]
gaih_inet: Split result generation into its own function

Simplify the loop a wee bit and clean up variable names too.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaih_inet: split loopback lookup into its own function
Siddhesh Poyarekar [Mon, 7 Mar 2022 14:54:37 +0000 (20:24 +0530)]
gaih_inet: split loopback lookup into its own function

Flatten the condition nesting and replace the alloca for RET.AT/ATR with
a single array LOCAL_AT[2].  This gets rid of alloca and alloca
accounting.

`git diff -b` is probably the best way to view this change since much of
the diff is whitespace changes.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaih_inet: make gethosts into a function
Siddhesh Poyarekar [Mon, 7 Mar 2022 14:18:48 +0000 (19:48 +0530)]
gaih_inet: make gethosts into a function

The macro is quite a pain to debug, so make gethosts into a function to
make it easier to maintain.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaih_inet: separate nss lookup loop into its own function
Siddhesh Poyarekar [Mon, 7 Mar 2022 10:26:22 +0000 (15:56 +0530)]
gaih_inet: separate nss lookup loop into its own function

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaih_inet: Split nscd lookup code into its own function.
Siddhesh Poyarekar [Mon, 7 Mar 2022 10:23:45 +0000 (15:53 +0530)]
gaih_inet: Split nscd lookup code into its own function.

Add a new member got_ipv6 to indicate if the results have an IPv6
result and use it instead of the local got_ipv6.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaih_inet: Split simple gethostbyname into its own function
Siddhesh Poyarekar [Fri, 4 Mar 2022 09:27:12 +0000 (14:57 +0530)]
gaih_inet: Split simple gethostbyname into its own function

Add a free_at flag in gaih_result to indicate if res.at needs to be
freed by the caller.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaih_inet: make numeric lookup a separate routine
Siddhesh Poyarekar [Mon, 7 Mar 2022 08:38:51 +0000 (14:08 +0530)]
gaih_inet: make numeric lookup a separate routine

Introduce the gaih_result structure and general paradigm for cleanups
that follow to process the lookup request and return a result.  A lookup
function (like text_to_binary_address), should return an integer error
code and set members of gaih_result based on what it finds.  If the
function does not have a result and no errors have occurred during the
lookup, it should return 0 and res.at should be set to NULL, allowing a
subsequent function to do the lookup until we run out of options.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaih_inet: Simplify service resolution
Siddhesh Poyarekar [Thu, 10 Feb 2022 07:57:11 +0000 (13:27 +0530)]
gaih_inet: Simplify service resolution

Refactor the code to split out the service resolution code into a
separate function.  Allocate the service tuples array just once to the
size of the typeproto array, thus avoiding the unnecessary pointer
chasing and stack allocations.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogetaddrinfo: Fix leak with AI_ALL [BZ #28852]
Siddhesh Poyarekar [Thu, 3 Mar 2022 17:37:42 +0000 (23:07 +0530)]
getaddrinfo: Fix leak with AI_ALL [BZ #28852]

Use realloc in convert_hostent_to_gaih_addrtuple and fix up pointers in
the result list so that a single block is maintained for
hostbyname3_r/hostbyname2_r and freed in gaih_inet.  This result is
never merged with any other results, since the hosts database does not
permit merging.

Resolves BZ #28852.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agogaih_inet: Simplify canon name resolution
Siddhesh Poyarekar [Mon, 7 Mar 2022 16:47:36 +0000 (22:17 +0530)]
gaih_inet: Simplify canon name resolution

Simplify logic for allocation of canon to remove the canonbuf variable;
canon now always points to an allocated block.  Also pull the canon name
set into a separate function.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agoSimplify allocations and fix merge and continue actions [BZ #28931]
Siddhesh Poyarekar [Thu, 17 Mar 2022 06:14:34 +0000 (11:44 +0530)]
Simplify allocations and fix merge and continue actions [BZ #28931]

Allocations for address tuples is currently a bit confusing because of
the pointer chasing through PAT, making it hard to observe the sequence
in which allocations have been made.  Narrow scope of the pointer
chasing through PAT so that it is only used where necessary.

This also tightens actions behaviour with the hosts database in
getaddrinfo to comply with the manual text.  The "continue" action
discards previous results and the "merge" action results in an immedate
lookup failure.  Consequently, chaining of allocations across modules is
no longer necessary, thus opening up cleanup opportunities.

A test has been added that checks some combinations to ensure that they
work correctly.

Resolves: BZ #28931

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 years agoiconv: Add UTF-7-IMAP variant in utf-7.c
Max Gautier [Mon, 21 Mar 2022 12:25:05 +0000 (09:25 -0300)]
iconv: Add UTF-7-IMAP variant in utf-7.c

UTF-7-IMAP differs from UTF-7 in the followings ways (see RFC 3501[1]
for reference) :

- The shift character is '&' instead of '+'
- There is no "optional direct characters" and the "direct characters"
  set is different
- There is no implicit shift back to US-ASCII from BASE64, all BASE64
  sequences MUST be terminated with '-'

[1]: https://datatracker.ietf.org/doc/html/rfc3501#section-5.1.3

Signed-off-by: Max Gautier <mg@max.gautier.name>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoiconv: make utf-7.c able to use variants
Max Gautier [Mon, 21 Mar 2022 12:12:05 +0000 (09:12 -0300)]
iconv: make utf-7.c able to use variants

Add infrastructure in utf-7.c to handle variants. The approach comes from
iso646.c
The variant is defined at gconv_init time and is passed as a
supplementary variable.

Signed-off-by: Max Gautier <mg@max.gautier.name>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoiconv: Better mapping to RFC for UTF-7
Max Gautier [Sun, 20 Mar 2022 16:41:05 +0000 (17:41 +0100)]
iconv: Better mapping to RFC for UTF-7

- Direct use of characters instead of arcane arrays
- isxbase64 is not the Modified BASE64 alphabet, but the characters who
  needs to trigger an explicit shift back to US-ASCII. Make that clearer

Signed-off-by: Max Gautier <mg@max.gautier.name>
Reviewed-by: Adhemerval Zanellla <adhemerval.zanella@linaro.org>
2 years agoiconv: Always encode "optional direct" UTF-7 characters
Max Gautier [Thu, 9 Dec 2021 09:31:49 +0000 (10:31 +0100)]
iconv: Always encode "optional direct" UTF-7 characters

Signed-off-by: Max Gautier <mg@max.gautier.name>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agostdio-common: Add wide stream coverage to tst-vfprintf-user-type
Florian Weimer [Fri, 18 Mar 2022 20:27:54 +0000 (21:27 +0100)]
stdio-common: Add wide stream coverage to tst-vfprintf-user-type

And use TEST_COMPARE_STRING for the narrow tests.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agolibio: Flush-only _IO_str_overflow must not return EOF (bug 28949)
Florian Weimer [Fri, 18 Mar 2022 20:27:54 +0000 (21:27 +0100)]
libio: Flush-only _IO_str_overflow must not return EOF (bug 28949)

In general, _IO_str_overflow returns the character passed as an argument
on success.  However, if flush-only operation is requested by passing
EOF, returning EOF looks like an error, and the caller cannot tell
whether the operation was successful or not.

_IO_wstr_overflow had the same bug regarding WEOF.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agolibio: Convert tst_swprintf to the test framework
Florian Weimer [Fri, 18 Mar 2022 20:27:54 +0000 (21:27 +0100)]
libio: Convert tst_swprintf to the test framework

And increase test coverage slightly.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agoscripts/dso-ordering-test.py: Fix C&P error in * callrefs processing
Florian Weimer [Fri, 18 Mar 2022 17:18:35 +0000 (18:18 +0100)]
scripts/dso-ordering-test.py: Fix C&P error in * callrefs processing

The elf/dso-sort-tests-src subdirectory is not changed by this commit,
so it seems that the cut-and-paste error was not material.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 years agostdio-common: Generate ja_JP.EUC-JP locale
Florian Weimer [Thu, 17 Mar 2022 09:49:07 +0000 (10:49 +0100)]
stdio-common: Generate ja_JP.EUC-JP locale

It is needed by tst-swprintf.

2 years agostdio-common: Re-flow and sort Makefile variables
Florian Weimer [Thu, 17 Mar 2022 09:49:07 +0000 (10:49 +0100)]
stdio-common: Re-flow and sort Makefile variables

2 years agonss: Sort tests and tests-container and put one test per line
Siddhesh Poyarekar [Thu, 17 Mar 2022 05:46:57 +0000 (11:16 +0530)]
nss: Sort tests and tests-container and put one test per line

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2 years agobenchtests: Use "=" instead of ":=" [BZ #28970]
H.J. Lu [Wed, 16 Mar 2022 15:43:48 +0000 (08:43 -0700)]
benchtests: Use "=" instead of ":=" [BZ #28970]

Use "=" instead of ":=" to allow sysdeps Makefiles to add more benches
to bench and benchset.  This fixes BZ #28970.
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2 years agohppa: Use END instead of PSEUDO_END in swapcontext.S
John David Anglin [Tue, 15 Mar 2022 23:04:39 +0000 (23:04 +0000)]
hppa: Use END instead of PSEUDO_END in swapcontext.S

2 years agohppa: Implement swapcontext in assembler (bug 28960)
John David Anglin [Tue, 15 Mar 2022 15:12:03 +0000 (15:12 +0000)]
hppa: Implement swapcontext in assembler (bug 28960)

When swapcontext.c is compiled without -g, the following error occurs:
Error: CFI instruction used without previous .cfi_startproc

Fix by converting swapcontext routine to assembler.

2 years agoassociate a deallocator for iconv_open
Steve Grubb [Fri, 11 Mar 2022 22:04:46 +0000 (17:04 -0500)]
associate a deallocator for iconv_open

This patch associates iconv_close as a deallocator for iconv_open. This
required moving the iconv_close declaration above iconv_open.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This page took 0.073913 seconds and 5 git commands to generate.