about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* configure: Use -Wno-ignored-attributes if compiler warns about multiple aliasesAdhemerval Zanella2022-11-0123-30/+148
| | | | | | | | | clang emits an warning when a double alias redirection is used, to warn the the original symbol will be used even when weak definition is overridden. However, this is a common pattern for weak_alias, where multiple alias are set to same symbol. Reviewed-by: Fangrui Song <maskray@google.com>
* Disable use of -fsignaling-nans if compiler does not support itAdhemerval Zanella2022-11-0116-31/+86
| | | | Reviewed-by: Fangrui Song <maskray@google.com>
* intl: Fix clang -Wunused-but-set-variable on plural.cAdhemerval Zanella2022-11-011-1/+2
| | | | | | | | | | | | | | | | | | Clang warns that '__gettextnerrs' set but not used: intl/plural.c:1034:9: error: variable '__gettextnerrs' set but not used [-Werror,-Wunused-but-set-variable] int yynerrs = 0; ^ Clang 15 (https://reviews.llvm.org/D122271) -Wunused-but-set-variable gives a warning while GCC doesn't. The -Wunused-but-set-variable is available in GCC 4.6, lower than the minimum required version 6.2. Since the file is auto-generated, suppress the warning with a compiler flag. Reviewed-by: Fangrui Song <maskray@google.com>
* Apply asm redirection in not-cancel before first useAdhemerval Zanella2022-11-011-15/+15
| | | | | | | It is avoid a build failure on clang where it can not redeclare function attribute after its first use. Reviewed-by: Fangrui Song <maskray@google.com>
* malloc: Use uintptr_t for pointer alignmentCarlos Eduardo Seo2022-11-011-3/+3
| | | | | | Avoid integer casts that assume unsigned long can represent pointers. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Use uintptr_t in fts for pointer alignmentSzabolcs Nagy2022-11-011-1/+2
| | | | | | The code assumed unsigned long can represent pointers. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Fix build with GCC 13 _FloatN, _FloatNx built-in functionsJoseph Myers2022-10-318-12/+753
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 13 has added more _FloatN and _FloatNx versions of existing <math.h> and <complex.h> built-in functions, for use in libstdc++-v3. This breaks the glibc build because of how those functions are defined as aliases to functions with the same ABI but different types. Add appropriate -fno-builtin-* options for compiling relevant files, as already done for the case of long double functions aliasing double ones and based on the list of files used there. I fixed some mistakes in that list of double files that I noticed while implementing this fix, but there may well be more such (harmless) cases, in this list or the new one (files that don't actually exist or don't define the named functions as aliases so don't need the options). I did try to exclude cases where glibc doesn't define certain functions for _FloatN or _FloatNx types at all from the new uses of -fno-builtin-* options. As with the options for double files (see the commit message for commit 49348beafe9ba150c9bd48595b3f372299bddbb0, "Fix build with GCC 10 when long double = double."), it's deliberate that the options are used even if GCC currently doesn't have a built-in version of a given functions, so providing some level of future-proofing against more such built-in functions being added in future. Tested with build-many-glibcs.py for aarch64-linux-gnu powerpc-linux-gnu powerpc64le-linux-gnu x86_64-linux-gnu (compilers and glibcs builds) with GCC mainline.
* elf: Build tst-relr-mod[34]a.so with $(LDFLAGS-rpath-ORIGIN)H.J. Lu2022-10-311-2/+2
| | | | | | | | | | When --enable-hardcoded-path-in-tests is used only with DT_RUNPATH, elf/tst-relr3 and elf/tst-relr4 failed to run. Their dependency libraries, tst-relr-mod3a.so and tst-relr-mod4a.so, are failed to load since DT_RUNPATH on executable doesn't apply to them. Build tst-relr-mod3a.so and tst-relr-mod4a.so with $(LDFLAGS-rpath-ORIGIN) to add DT_RUNPATH for their dependency libraries. Reviewed-by: Fangrui Song <maskray@google.com>
* x86-64: Improve evex512 version of strlen functionsSunil K Pandey2022-10-301-34/+57
| | | | | | | | | | | This patch improves following functionality - Replace VPCMP with VPCMPEQ. - Replace page cross check logic with sall. - Remove extra lea from align_more. - Remove uncondition loop jump. - Use bsf to check max length in first vector. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
* Correctly determine libc.so 'OUTPUT_FORMAT' when cross-compiling.Ludovic Courtès2022-10-283-5/+94
| | | | | | | | | | | | | | | | | | Commit 87d583c6e8cd0e49f64da76636ebeec033298b4d replaces the sed script with an "objdump -f" invocation to determine the 'OUTPUT_FORMAT' bit of the libc.so linker script. However, when cross-compiling, for example from x86_64-linux-gnu to aarch64-linux-gnu, "objdump -f" would report the wrong format ("elf64-little"). Conversely, "aarch64-linux-gnu-objdump -f" reports "elf64-littleaarch64" as expected. This patch changes 'configure.ac' to use AC_CHECK_TOOL rather than '$CC -print-prog-name=objdump' to determine the value of the OBJDUMP variable. That way, OBJDUMP is set to TRIPLET-objdump when cross-compiling for TRIPLET. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* Remove unused scratch_buffer_dupfreeSzabolcs Nagy2022-10-285-79/+0
| | | | | | | | | | | | Turns out scratch_buffer_dupfree internal API was unused since commit ef0700004bf0dccf493a5e8e21f71d9e7972ea9f stdlib: Simplify buffer management in canonicalize And the related test in malloc/tst-scratch_buffer had issues so it's better to remove it completely. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Fix elf/tst-dlmopen-twice not to exhaust static TLSSzabolcs Nagy2022-10-281-2/+2
| | | | | | | By default glibc only allocates enough static TLS for 4 link namespaces including the initial one. So only use 3 dlmopens in the test. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Use uintptr_t in string/tester for pointer alignmentSzabolcs Nagy2022-10-281-6/+7
| | | | | | The code assumed unsigned long can represent pointers. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* stdlib/strfrom: Add copysign to fix NAN issue on riscv (BZ #29501)Letu Ren2022-10-283-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the specification of ISO/IEC TS 18661-1:2014, The strfromd, strfromf, and strfroml functions are equivalent to snprintf(s, n, format, fp) (7.21.6.5), except the format string contains only the character %, an optional precision that does not contain an asterisk *, and one of the conversion specifiers a, A, e, E, f, F, g, or G, which applies to the type (double, float, or long double) indicated by the function suffix (rather than by a length modifier). Use of these functions with any other 20 format string results in undefined behavior. strfromf will convert the arguement with type float to double first. According to the latest version of IEEE754 which is published in 2019, Conversion of a quiet NaN from a narrower format to a wider format in the same radix, and then back to the same narrower format, should not change the quiet NaN payload in any way except to make it canonical. When either an input or result is a NaN, this standard does not interpret the sign of a NaN. However, operations on bit strings—copy, negate, abs, copySign—specify the sign bit of a NaN result, sometimes based upon the sign bit of a NaN operand. The logical predicates totalOrder and isSignMinus are also affected by the sign bit of a NaN operand. For all other operations, this standard does not specify the sign bit of a NaN result, even when there is only one input NaN, or when the NaN is produced from an invalid operation. converting NAN or -NAN with type float to double doesn't need to keep the signbit. As a result, this test case isn't mandatory. The problem is that according to RISC-V ISA manual in chapter 11.3 of riscv-isa-20191213, Except when otherwise stated, if the result of a floating-point operation is NaN, it is the canonical NaN. The canonical NaN has a positive sign and all significand bits clear except the MSB, a.k.a. the quiet bit. For single-precision floating-point, this corresponds to the pattern 0x7fc00000. which means that conversion -NAN from float to double won't keep the signbit. Since glibc ought to be consistent here between types and architectures, this patch adds copysign to fix this problem if the string is NAN. This patch adds two different functions under sysdeps directory to work around the issue. This patch has been tested on x86_64 and riscv64. Resolves: BZ #29501 v2: Change from macros to different inline functions. v3: Add unlikely check to isnan. v4: Fix wrong commit message header. v5: Fix style: add space before parentheses. v6: Add copyright. Signed-off-by: Letu Ren <fantasquex@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Fix resource/bug-ulimit1 testSzabolcs Nagy2022-10-281-1/+1
| | | | | | | ulimit is a variadic function and the second argument must have type long (or unsigned long). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Fix missing NUL terminator in stdio-common/scanf13 testSzabolcs Nagy2022-10-281-0/+1
| | | | | | | | sscanf is only defined on nul terminated string input, but '\0' was missing in this test which caused _IO_str_init_static_internal to read OOB on the stack when computing the bounds of the string. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Fix off-by-one OOB read in elf/tst-tls20Szabolcs Nagy2022-10-281-2/+2
| | | | | | The int mods[nmods] array on the stack was overread by one. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* elf: Fix alloca size in _dl_debug_vdprintfSzabolcs Nagy2022-10-281-2/+5
| | | | | | | | | | | | | The alloca size did not consider the optional width parameter for padding which could cause buffer underflow. The width is currently used e.g. by _dl_map_object_from_fd which passes 2 * sizeof(void *) which can be larger than the alloca buffer size on targets where sizeof(void *) >= 2 * sizeof(unsigned long). Even if large width is not used on existing targets it is better to fix the formatting code to avoid surprises. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* malloc: Use uintptr_t in alloc_bufferSzabolcs Nagy2022-10-282-8/+8
| | | | | | | The values represnt pointers and not sizes. The members of struct alloc_buffer are already uintptr_t. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Fix invalid pointer dereference in wcpcpy_chkSzabolcs Nagy2022-10-281-2/+1
| | | | | | | The src pointer is const and points to a different object, so accessing dest via src is invalid. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Fix invalid pointer dereference in wcscpy_chkSzabolcs Nagy2022-10-281-27/+7
| | | | | | | The src pointer is const and points to a different object, so accessing dest via src is invalid. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* aarch64: Fix the extension header write in getcontext and swapcontextSzabolcs Nagy2022-10-282-4/+4
| | | | | | The extension header is two 32bit words and in the last header both should be 0. There is plenty space in the __reserved area, but it's better not to write more than we mean to.
* aarch64: Don't build wordcopySzabolcs Nagy2022-10-281-0/+0
| | | | | | | Use an empty wordcopy.c to avoid building the generic one. It does not seem to be used anywhere. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* scripts: Use bool in tunables initializerSzabolcs Nagy2022-10-281-1/+1
| | | | | | | The initializer for a tunable_t set the bool initialized flag to NULL. This causes a build failure when pointer to bool conversion warns. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* longlong.h: update from GCC for LoongArch clz/ctz supportXi Ruoyao2022-10-281-0/+12
| | | | | Update longlong.h to GCC r13-3269. Keep our local change (prefer https for gnu.org URL).
* elf: Introduce to _dl_call_finiFlorian Weimer2022-10-275-78/+61
| | | | | | | | | | This consolidates the destructor invocations from _dl_fini and dlclose. Remove the micro-optimization that avoids calling _dl_call_fini if they are no destructors (as dlclose is quite expensive anyway). The debug log message is now printed unconditionally. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ld.so: Export tls_init_tp_called as __rtld_tls_init_tp_calledFlorian Weimer2022-10-272-5/+8
| | | | | | | This allows the rest of dynamic loader to check whether the TCB has been set up (and THREAD_GETMEM and THREAD_SETMEM will work). Reviewed-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
* scripts/localplt.awk: Handle DT_JMPREL with empty PLT (for C-SKY)Florian Weimer2022-10-271-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On csky-linux-gnuabiv2, binutils 2.33 produces a DT_JMPREL entry for the dynamic loader if it does not contain any PLT relocations: Dynamic section at offset 0x1df48 contains 19 entries: Tag Type Name/Value 0x0000000e (SONAME) Library soname: [ld-linux-cskyv2-hf.so.1] 0x00000004 (HASH) 0xd4 0x6ffffef5 (GNU_HASH) 0x1a8 0x00000005 (STRTAB) 0x4ac 0x00000006 (SYMTAB) 0x28c 0x0000000a (STRSZ) 527 (bytes) 0x0000000b (SYMENT) 16 (bytes) 0x00000003 (PLTGOT) 0x1f000 0x00000002 (PLTRELSZ) 0 (bytes) 0x00000014 (PLTREL) RELA 0x00000017 (JMPREL) 0xaa4 0x00000007 (RELA) 0x75c 0x00000008 (RELASZ) 840 (bytes) 0x00000009 (RELAENT) 12 (bytes) 0x6ffffffc (VERDEF) 0x700 0x6ffffffd (VERDEFNUM) 3 0x6ffffff0 (VERSYM) 0x6bc 0x6ffffff9 (RELACOUNT) 68 0x00000000 (NULL) 0x0 This confuses the script: Unexpected output from check-localplt: …/elf/ld.so.jmprel: *** DT_JMPREL does not match any section's address This commit changes the script to record the DT_PLTRELSZ value and reject DT_JMPREL values not a section boundary only if DT_PLTRELSZ is present with a non-zero value. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Remove lingering libSegfault Makefile entriesAdhemerval Zanella2022-10-261-2/+2
| | | | The library was removed by 65ccd641ba.
* aarch64: Use memcpy_simd as the default memcpyWilco Dijkstra2022-10-266-370/+81
| | | | | | Since __memcpy_simd is the fastest memcpy on almost all cores, replace the generic memcpy with it. If SVE is available, a SVE memcpy will be used by default (including for Neoverse N2).
* aarch64: Cleanup memset ifuncWilco Dijkstra2022-10-262-17/+26
| | | | | Cleanup memset ifunc selectors. The A64FX memset relies on a ZVA size of 256, so add an explicit check.
* elf: Reinstate on DL_DEBUG_BINDINGS _dl_lookup_symbol_xAdhemerval Zanella2022-10-261-0/+17
| | | | | | | The prelink removal done by 6628c742b2c16e wrongly removed the debug support. Checked on x86_64-linux-gnu.
* x86_64: Implement evex512 version of strchrnul, strchr and wcschrSunil K Pandey2022-10-256-0/+322
| | | | | | | | | | | | | | | | | | | | | | | | | This patch implements following evex512 version of string functions. evex512 version takes up to 30% less cycle as compared to evex, depending on length and alignment. - strchrnul function using 512 bit vectors. - strchr function using 512 bit vectors. - wcschr function using 512 bit vectors. Code size data: strchrnul-evex.o 599 byte strchrnul-evex512.o 569 byte (-5%) strchr-evex.o 639 byte strchr-evex512.o 595 byte (-7%) wcschr-evex.o 644 byte wcschr-evex512.o 607 byte (-6%) Placeholder function, not used by any processor at the moment. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
* linux: Fix generic struct_stat for 64 bit time (BZ# 29657)Adhemerval Zanella2022-10-256-74/+622
| | | | | | | | | | | | | | | | | The generic Linux struct_stat misses the conditionals to use bits/struct_stat_time64_helper.h in the __USE_TIME_BITS64 for architecture that uses __TIMESIZE == 32 (currently csky and nios2). Since newer ports should not support 32 bit time_t, the generic implementation should be used as default. For arm, hppa, and sh a copy of default struct_stat is added, while for csky and nios a new one based on generic is used, along with conditionals to use bits/struct_stat_time64_helper.h. The default struct_stat is also replaced with the generic one. Checked on aarch64-linux-gnu and arm-linux-gnueabihf.
* manual: Add missing % in int conversion listJakub Wilk2022-10-251-1/+1
| | | | Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
* Avoid undefined behaviour in ibm128 implementation of llroundl (BZ #29488)Aurelien Jarno2022-10-241-12/+9
| | | | | | | | Detecting an overflow edge case depended on signed overflow of a long long. Replace the additions and the overflow checks by __builtin_add_overflow(). Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* Remove all assembly optimizations for htonl and htonsAdhemerval Zanella2022-10-245-175/+0
| | | | | | | | | | The builtin bswap is already used if optimziation is enabled for GCC 4.8+, so glibc symbols will be used in a very limited scenarios. Also, gcc generated code is quite similar to all but ia64 and i386 htons. Checked on alpha, i686, and ia64.
* Remove htonl.S for i386/x86_64Cristian Rodríguez2022-10-242-68/+0
| | | | | | | Generic implementation on top of __bswap_32 always expands inline to either bswap or movbe depending on -march=*. Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
* Fix BZ #29463 in the ibm128 implementation of y1l tooMichael Hudson-Doyle2022-10-241-0/+3
| | | | | | | | | Avoid moving code across SET_RESTORE_ROUNDL in order to fix [BZ #29463]. Tested-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* Add ADDRB from Linux 6.0 to bits/termios-c_cflag.hJoseph Myers2022-10-243-0/+12
| | | | | | | | | | | | Linux 6.0 adds a constant ADDRB, a termios c_cflag bit, to its include/uapi/asm-generic/termbits-common.h. Add it accordingly to glibc's bits/termios-c_cflag.h headers. As other constants in these headers are generally in octal, I converted the value to octal to match. As ADDRB isn't in a POSIX-reserved namespace, I made it conditional on __USE_MISC. Tested for x86_64.
* x86: Use `testb` for FSRM check in memmove-vec-unaligned-ermsNoah Goldstein2022-10-201-0/+4
| | | | | | | `testb` saves a bit of code size is the imm-operand can be encoded 1-bytes. Tested on x86-64.
* x86: Use `testb` for case-locale check in str{n}casecmp-sse42Noah Goldstein2022-10-201-2/+2
| | | | | | | `testb` saves a bit of code size is the imm-operand can be encoded 1-bytes. Tested on x86-64.
* x86: Use `testb` for case-locale check in str{n}casecmp-sse2Noah Goldstein2022-10-201-2/+2
| | | | | | | `testb` saves a bit of code size is the imm-operand can be encoded 1-bytes. Tested on x86-64.
* x86: Use `testb` for case-locale check in str{n}casecmp-avx2Noah Goldstein2022-10-201-1/+1
| | | | | | | `testb` saves a bit of code size is the imm-operand can be encoded 1-bytes. Tested on x86-64.
* x86: Add support for VEC_SIZE == 64 in strcmp-evex.S implNoah Goldstein2022-10-201-246/+438
| | | | | | | | | | | | | | | Unused at the moment, but evex512 strcmp, strncmp, strcasecmp{l}, and strncasecmp{l} functions can be added by including strcmp-evex.S with "x86-evex512-vecs.h" defined. In addition save code size a bit in a few places. 1. tzcnt ... -> bsf ... 2. vpcmp{b|d} $0 ... -> vpcmpeq{b|d} This saves a touch of code size but has minimal net affect. Full check passes on x86-64.
* x86: Remove AVX512-BVMI2 instruction from strrchr-evex.SNoah Goldstein2022-10-201-40/+29
| | | | | | | | | | | | | | | | commit b412213eee0afa3b51dfe92b736dfc7c981309f5 Author: Noah Goldstein <goldstein.w.n@gmail.com> Date: Tue Oct 18 17:44:07 2022 -0700 x86: Optimize strrchr-evex.S and implement with VMM headers Added `vpcompress{b|d}` to the page-cross logic with is an AVX512-VBMI2 instruction. This is not supported on SKX. Since the page-cross logic is relatively cold and the benefit is minimal revert the page-cross case back to the old logic which is supported on SKX. Tested on x86-64.
* sysdeps: arm: Fix preconfigure script for ARMv8/v9 targets [BZ #29698]Felix Riemann2022-10-202-2/+2
| | | | | | | | | | | | | | | | | | | | The ARM preconfigure script tries to detect the capabilities of the target platform by checking the compiler's predefined architecture macros. However, if the compiler is tuning for AArch32 on ARMv8/v9 this step fails: checking for sysdeps preconfigure fragments... aarch64 alpha arc arm WARNING: arm/preconfigure: Did not find ARM architecture type; using default This is because preconfigure.ac doesn't escape the square brackets in the glob for matching compilers targeting ARMv8. Adding another pair of brackets to escape the first pair fixes this: checking for sysdeps preconfigure fragments... aarch64 alpha arc arm Found compiler is configured for something newer than v7 - using v7 Signed-off-by: Felix Riemann <felix.riemann@sma.de> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nis: Fix nis_print_directoryAdhemerval Zanella Netto2022-10-201-31/+28
| | | | | | | | Remove implicit conversion from enumeration type 'zotypes' to different type 'nstype'. Checked on x86_64-linux-gnu. Reviewed-by: Arjun Shankar <arjun@redhat.com>
* linux: Avoid shifting a negative signed on POSIX timer interfaceAdhemerval Zanella2022-10-205-10/+28
| | | | | | | | | | The current macros uses pid as signed value, which triggers a compiler warning for process and thread timers. Replace MAKE_PROCESS_CPUCLOCK with static inline function that expects the pid as unsigned. These are similar to what Linux does internally. Checked on x86_64-linux-gnu. Reviewed-by: Arjun Shankar <arjun@redhat.com>
* Bench: Improve benchtests for memchr, strchr, strnlen, strrchrNoah Goldstein2022-10-195-45/+137
| | | | | | 1. Add more complete coverage in the medium size range. 2. In strnlen remove the `1 << i` which was UB (`i` could go beyond 32/64)