about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* S390: Add new s390 platform z16.Stefan Liebler2022-04-146-10/+47
| | | | | | | | | | | | | | The new IBM z16 is added to platform string array. The macro _DL_PLATFORMS_COUNT is incremented. _dl_hwcaps_subdir is extended by "z16" if HWCAP_S390_VXRS_PDE2 is set. HWCAP_S390_NNPA is not tested in _dl_hwcaps_subdirs_active as those instructions may be replaced or removed in future. tst-glibc-hwcaps.c is extended in order to test z16 via new marker5. A fatal glibc error is dumped if glibc was build with architecture level set for z16, but run on an older machine. (See dl-hwcap-check.h)
* Replace {u}int_fast{16|32} with {u}int32_tNoah Goldstein2022-04-132-2/+2
| | | | | | | | | On 32-bit machines this has no affect. On 64-bit machines {u}int_fast{16|32} are set as {u}int64_t which is often not ideal. Particularly x86_64 this change both saves code size and may save instruction cost. Full xcheck passes on x86_64.
* hurd: Define ELIBEXECSamuel Thibault2022-04-121-0/+2
| | | | So we can implement it in the exec server.
* Remove _dl_skip_args_internal declarationSzabolcs Nagy2022-04-121-5/+0
| | | | | | It does not seem to be used. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* manual: Avoid name collision in libm ULP table [BZ #28956]Tom Coldrick2022-04-112-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The 32-bit and 64-bit variants of RISC-V share the same name - "RISC-V" - when generating the libm error table for the info pages. This collision, and the way how the table is generated, mean that the values in the final table for "RISC-V" may be either for the 32- or 64-bit variant, with no indication as to which. As an additional side-effect, this makes the build non-reproducible, as the error table generated is dependent upon the host filesystem implementation. To solve this issue, the libm-test-ulps-name files for both variants have been modified to include their word size, so as to remove the collision and provide more accurate information in the table. An alternative proposed was to merge the two variants' ULP values into a single file, but this would mean that information about error values is lost, as the two variants are not identical. Some differences are considerable, notably the values for the exp() function are large. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* powerpc: Relocate stinfo->mainAlan Modra2022-04-102-2/+19
| | | | | | | | | | | | | | start_addresses in sysdeps/powerpc/powerpc64/start.S is historical baggage that should disappear. Until someone does that, relocating stinfo->main by hand is one solution to the fact that the field may be unrelocated at the time it is accessed. This is similar to what is done for dynamic tags via the D_PTR macro. stinfo->init and stinfo->fini are zero in both powerpc64/start.S and powerpc32/start.S, so make it a little more obvious they are unused by passing NULLs to LIBC_START_MAIN. The makefile change is needed to pick up elf/dl-static-tls.h from dl-machine.h. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* powerpc64: Set up thread register for _dl_relocate_static_pieAlan Modra2022-04-106-11/+33
| | | | | | | | | | | | | | | | | libgcc ifunc resolvers that access hwcap via a field in the tcb can't be called until the thread pointer is set up. Other ifunc resolvers might need access to at_platform. This patch sets up a fake thread pointer early to a copy of tcbhead_t. hwcapinfo.c already had local variables for hwcap and at_platform, replace them with an entire tcbhead_t. It's not that large and this way we easily ensure hwcap and at_platform are at the same relative offsets as they are in the real thread block. The patch also conditionally disables part of tst-tlsifunc-static, "bar address read from IFUNC resolver is incorrect". We can't get a proper address for a thread variable before glibc initialises tls. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* powerpc64: Use medium model toc accesses throughoutAlan Modra2022-04-106-15/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PowerPC64 linker edits medium model toc-indirect code to toc-pointer relative: addis r9,r2,tc_entry_for_var@toc@ha ld r9,tc_entry_for_var@toc@l(r9) becomes addis r9,r2,(var-.TOC.)@ha addi r9,r9,(var-.TOC.)@l when "var" is known to be local to the binary. This isn't done for small-model toc-indirect code, because "var" is almost guaranteed to be too far away from .TOC. for a 16-bit signed offset. And, because the analysis of which .toc entry can be removed becomes much more complicated in objects that mix code models, they aren't removed if any small-model toc sequence appears in an object file. Unfortunately, glibc's build of ld.so smashes the needed objects together in a ld -r linking stage. This means the GOT/TOC is left with a whole lot of relative relocations which is untidy, but in itself is not a serious problem. However, static-pie on powerpc64 bombs due to a segfault caused by one of the small-model accesses before _dl_relocate_static_pie. (The very first one in rcrt1.o passing start_addresses in r8 to __libc_start_main.) So this patch makes all the toc/got accesses in assembly medium code model, and a couple of functions hidden. By itself this is not enough to give us working static-pie, but it is useful in isolation to enable better linker optimisation. There's a serious problem in libgcc too. libgcc ifuncs access the AT_HWCAP words stored in the tcb with an offset from the thread pointer (r13), but r13 isn't set at the time _dl_relocate_static_pie. A followup patch will fix that. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* linux: Constify rfv variable in dl_vdso_vsymAlan Modra2022-04-101-1/+1
| | | | | | | | Compilers may decide to put the rfv variable in .data rather than on the stack. It's slightly better to put it in .data.rel.ro.local instead. Regardles of that, making it const may enable further optimisations. Found when examining relative relocations (GOT ones in particular) as part of enabling static-pie for PowerPC64.
* sparc64: Remove fcopysign{f} implementationAdhemerval Zanella2022-04-077-135/+6
| | | | | | The builtin from generic code generates similar compliant sequence. Checked on sparc64-linux-gnu.
* alpha: Remove fcopysign{f} implementationAdhemerval Zanella2022-04-072-60/+0
| | | | The generic code already uses builtins.
* math: Use builtin for ldbl-96 copysignAdhemerval Zanella2022-04-071-7/+3
| | | | | | | All architectures that uses it (x86, ia64, m68k) implement the builtin. Checked on x86_64-linux-gnu and ia64-linux-gnu.
* ia64: Remove fcopysign{f} implementationAdhemerval Zanella2022-04-073-39/+0
| | | | | | The builtin used by generic code generates similar code. Checked on ia64-linux-gnu.
* x86: Remove fcopysign{f} implementationAdhemerval Zanella2022-04-076-175/+0
| | | | | | The builtin used by generic code generates similar code. Checked on x86_64-linux-gnu and i686-linux-gnu.
* powerpc: Remove fcopysign{f} implementationAdhemerval Zanella2022-04-074-174/+0
| | | | | | The builtin and generic implementation from generic files are suffice. Checked on powerpc64-linux-gnu and powerpc-linux-gnu.
* benchtests: Only build libmvec benchmarks iff $(build-mathvec) is setAdhemerval Zanella2022-04-051-1/+1
| | | | Checked on x86_64-linux-gnu.
* linux: Fix __closefrom_fallback iterates until max int (BZ#28993)Adhemerval Zanella2022-04-051-5/+6
| | | | | | | | | | | | | | 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.
* Remove -z combreloc and HAVE_Z_COMBRELOCFangrui Song2022-04-0411-174/+28
| | | | | | | | | | | | | -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>
* sparc: Remove s_abs implementationsAdhemerval Zanella2022-04-046-74/+2
| | | | | | | 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.
* ia64: Remove fabs implementationsAdhemerval Zanella2022-04-042-164/+0
| | | | | | | | | | | | 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.
* x86: Remove fabs{f} implementationAdhemerval Zanella2022-04-044-74/+0
| | | | | For x86_64 is the same as the generic implementation, while for i686 the builtin generates the same code.
* alpha: Remove s_abs implementationsAdhemerval Zanella2022-04-042-55/+0
| | | | The generic implementation already uses builtins.
* x86: Small improvements for wcslenNoah Goldstein2022-03-281-45/+41
| | | | | | | | | | | | | | 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>
* x86: Small improvements for wcscpy-ssse3Noah Goldstein2022-03-281-97/+97
| | | | | | | | | | | | 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>
* Add HWCAP2_AFP, HWCAP2_RPRES from Linux 5.17 to AArch64 bits/hwcap.hJoseph Myers2022-03-281-0/+2
| | | | | Add the new HWCAP2_AFP and HWCAP2_RPRES constants from Linux 5.17. Tested with build-many-glibcs.py for aarch64-linux-gnu.
* x86: Remove AVX str{n}casecmpNoah Goldstein2022-03-256-197/+105
| | | | | | | | | | | | | | | | | 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>
* x86: Add EVEX optimized str{n}casecmpNoah Goldstein2022-03-256-40/+321
| | | | | | | geometric_mean(N=40) of all benchmarks EVEX / SSE42: .621 All string/memory tests pass. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* x86: Add AVX2 optimized str{n}casecmpNoah Goldstein2022-03-258-31/+331
| | | | | | | geometric_mean(N=40) of all benchmarks AVX2 / SSE42: .702 All string/memory tests pass. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* x86: Optimize str{n}casecmp TOLOWER logic in strcmp-sse42.SNoah Goldstein2022-03-251-48/+35
| | | | | | | | | | | | | 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>
* x86: Optimize str{n}casecmp TOLOWER logic in strcmp.SNoah Goldstein2022-03-251-35/+29
| | | | | | | | | | | | | 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>
* x86: Fix fallback for wcsncmp_avx2 in strcmp-avx2.S [BZ #28896]Noah Goldstein2022-03-252-1/+16
| | | | | | | | | | | | | | | | | | | | 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>
* x86: Remove strspn-sse2.S and use the generic implementationNoah Goldstein2022-03-252-116/+4
| | | | | | | | | 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>
* x86: Remove strpbrk-sse2.S and use the generic implementationNoah Goldstein2022-03-252-8/+4
| | | | | | | The generic implementation is faster (see strcspn commit). All string/memory tests pass. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* x86: Remove strcspn-sse2.S and use the generic implementationNoah Goldstein2022-03-252-123/+4
| | | | | | | | | 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>
* x86: Optimize strspn in strspn-c.cNoah Goldstein2022-03-251-47/+39
| | | | | | | | | | | | 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>
* x86: Optimize strcspn and strpbrk in strcspn-c.cNoah Goldstein2022-03-251-46/+37
| | | | | | | | | | | | 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>
* x86: Code cleanup in strchr-evex and comment justifying branchNoah Goldstein2022-03-251-66/+80
| | | | | | | | | | | 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>
* x86: Code cleanup in strchr-avx2 and comment justifying branchNoah Goldstein2022-03-251-97/+107
| | | | | | | | | | | 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>
* Update kernel version to 5.17 in tst-mman-consts.pyJoseph Myers2022-03-241-1/+1
| | | | | | | | 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.
* gmon: Remove unused sprofil.c functionsAdhemerval Zanella2022-03-231-12/+0
|
* Update syscall lists for Linux 5.17Joseph Myers2022-03-2327-2/+29
| | | | | | | | 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.
* Fix ununsed fstatat64_time64_statxAdhemerval Zanella2022-03-231-5/+5
| | | | It is only called for legacy ABIs.
* elf: Remove inline _dl_dprintfAdhemerval Zanella2022-03-231-11/+0
| | | | | | 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.
* configure.ac: fix bashisms in configure.acSam James2022-03-224-4/+4
| | | | | | | | | | | | | | | | | | | 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>
* getaddrinfo: Refactor code for readabilitySiddhesh Poyarekar2022-03-231-12/+33
| | | | | | | | 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>
* gai_init: Avoid jumping from if condition to its else counterpartSiddhesh Poyarekar2022-03-221-250/+248
| | | | | | | | | | | 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>
* gaiconf_init: Refactor some bits for readabilitySiddhesh Poyarekar2022-03-221-65/+84
| | | | | | | | 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>
* gethosts: Return EAI_MEMORY on allocation failureSiddhesh Poyarekar2022-03-221-2/+2
| | | | | | | | | 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>
* gaih_inet: Split result generation into its own functionSiddhesh Poyarekar2022-03-221-90/+86
| | | | | | | 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>
* gaih_inet: split loopback lookup into its own functionSiddhesh Poyarekar2022-03-221-65/+62
| | | | | | | | | | | | 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>