]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
3 months agostdlib: Avoid strlen plt with clang-20 azanella/clang
Adhemerval Zanella [Mon, 7 Apr 2025 20:32:08 +0000 (17:32 -0300)] 
stdlib: Avoid strlen plt with clang-20

3 months agobench-malloc-thread: Add libm for powf
Adhemerval Zanella [Tue, 6 Feb 2024 19:52:45 +0000 (16:52 -0300)] 
bench-malloc-thread: Add libm for powf

The bench-malloc-thread.c:63 does use powf and compiler might not
optimzie it away.

3 months agobenchtests: Remove clang warnings
Adhemerval Zanella [Tue, 6 Feb 2024 19:52:17 +0000 (16:52 -0300)] 
benchtests: Remove clang warnings

clangs warns of the implicit cast of RAND_MAX to float:

  error: implicit conversion from 'int' to 'float' changes value from
  2147483647 to 2147483648 [-Werror,-Wimplicit-const-int-float-conversion]

So make it explicit.

3 months agobenchtests: Use __f128 on ilogbf128-inputs constants
Adhemerval Zanella [Tue, 6 Feb 2024 19:51:45 +0000 (16:51 -0300)] 
benchtests: Use __f128 on ilogbf128-inputs constants

The f128 is not a valid floating constant suffix on clang.

3 months agobenchtests: Add attribute_optimize
Adhemerval Zanella [Tue, 6 Feb 2024 19:51:25 +0000 (16:51 -0300)] 
benchtests: Add attribute_optimize

Similar to tst-printf-bz18872.sh, add the attribute_optimize to avoid
build failures with compilers that do not support "GCC optimize" pragma.

3 months agoaarch64: Fix gcs linker flags
Adhemerval Zanella [Mon, 24 Mar 2025 18:49:18 +0000 (15:49 -0300)] 
aarch64: Fix gcs linker flags

clang does not work by using whitespace for defining the -z option:

$ make test t=misc/tst-gcs-disabled
[...]
clang: error: no such file or directory: 'gcs=always'

Use the usual comma separate way.

3 months agoHandle abort call for -fexceptions call
Adhemerval Zanella [Fri, 1 Apr 2022 17:17:07 +0000 (14:17 -0300)] 
Handle abort call for -fexceptions call

clang might generate an abort call when cleanup functions (set by
__attribute__ ((cleanup)) calls functions not marked as nothrow.
We can mitigate by marking some internal functions as __THROW,
but it is not possible for functions that issue used-provided
callbacks (for instance pthread_once).

3 months agox86_64: Fix mark-plt configure test
Adhemerval Zanella [Fri, 9 Feb 2024 16:36:22 +0000 (13:36 -0300)] 
x86_64: Fix mark-plt configure test

The configure check might ignore if compiler driver warns that the
option is no support, so force fatal warnings.

If fixes the elf/tst-plt-rewrite regressions when ld.lld is used.

3 months agomath: Fix potential underflow on ldbl-128 erfl
Adhemerval Zanella [Tue, 30 Jan 2024 13:45:14 +0000 (13:45 +0000)] 
math: Fix potential underflow on ldbl-128 erfl

The multiplication is only required if the branch is taken, and the
compiler might not optimize it away.

If fixes the following issues when testcase is built with clang:

FAIL: math/test-ldouble-erf
Failure: erf (-0x4p-16384): Exception "Underflow" set
Failure: erf (0x1p-10000): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set
Failure: erf (0x3.8b7f12369ded552p-16384): Exception "Underflow" set
Failure: erf (0x4p-16384): Exception "Underflow" set
Failure: erf_downward (-0x4p-16384): Exception "Underflow" set
Failure: erf_downward (0x1p-10000): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set
Failure: erf_downward (0x3.8b7f12369ded552p-16384): Exception "Underflow" set
Failure: erf_downward (0x4p-16384): Exception "Underflow" set
Failure: erf_towardzero (-0x4p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x1p-10000): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set
Failure: erf_towardzero (0x3.8b7f12369ded552p-16384): Exception "Underflow" set
Failure: erf_towardzero (0x4p-16384): Exception "Underflow" set
Failure: erf_upward (-0x4p-16384): Exception "Underflow" set
Failure: erf_upward (0x1p-10000): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded54f38760a41abb84p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded54f38760a41abb88p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded54f4p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded54f8p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded5518p-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded551cp-16384): Exception "Underflow" set
Failure: erf_upward (0x3.8b7f12369ded552p-16384): Exception "Underflow" set
Failure: erf_upward (0x4p-16384): Exception "Underflow" set

Checked on aarch64-linux-gnu with gcc and clang.

3 months agoelf: Fix -fsemantic-interposition for clang-20
Adhemerval Zanella [Fri, 26 Aug 2022 12:24:25 +0000 (09:24 -0300)] 
elf: Fix -fsemantic-interposition for clang-20

clang-20 defaults to -Wunused-command-line-argument, which makes the
option check fails because of ununsed '-c' option.

3 months agostdio: Fix tst-vfprintf-user-type on clang
Adhemerval Zanella [Sat, 2 Apr 2022 02:51:04 +0000 (23:51 -0300)] 
stdio: Fix tst-vfprintf-user-type on clang

The pointer alias comparison will be optimized away by the compiler,
and gcc and clang will evaluate differently (clang evaluates as
false, while gcc as true).

3 months agox86: Do not use __builtin_isinf_sign on clang
Adhemerval Zanella [Fri, 1 Apr 2022 20:03:34 +0000 (17:03 -0300)] 
x86: Do not use __builtin_isinf_sign on clang

clang does not handle pseudo normal numbers,

It fixes the regression on test-ldouble-isinf when built with clang:

Failure: isinf (pseudo_zero): Exception "Invalid operation" set
Failure: isinf (pseudo_inf): Exception "Invalid operation" set
Failure: isinf (pseudo_qnan): Exception "Invalid operation" set
Failure: isinf (pseudo_snan): Exception "Invalid operation" set
Failure: isinf (pseudo_unnormal): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_zero): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_inf): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_qnan): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_snan): Exception "Invalid operation" set
Failure: isinf_downward (pseudo_unnormal): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_zero): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_inf): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_qnan): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_snan): Exception "Invalid operation" set
Failure: isinf_towardzero (pseudo_unnormal): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_zero): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_inf): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_qnan): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_snan): Exception "Invalid operation" set
Failure: isinf_upward (pseudo_unnormal): Exception "Invalid operation" set

3 months agox86: Do not use __builtin_fpclassify on clang
Adhemerval Zanella [Fri, 1 Apr 2022 19:54:55 +0000 (16:54 -0300)] 
x86: Do not use __builtin_fpclassify on clang

clang does not handle pseudo normal numbers, so disable the fpclassify
and isnormal builtin optimization if clang is used.  This only affect
x86, so add a new header, fp-builtin-denormal.h, which defines whether
the architecture required to disable the optimization through a new
glibc define (__FP_BUILTIN_DENORMAL).

It fixes the regression on test-ldouble-fpclassify and test-float64x-fpclassify
when built with clang:

Failure: fpclassify (pseudo_zero): Exception "Invalid operation" set
Failure: fpclassify (pseudo_inf): Exception "Invalid operation" set
Failure: fpclassify (pseudo_qnan): Exception "Invalid operation" set
Failure: fpclassify (pseudo_snan): Exception "Invalid operation" set
Failure: fpclassify (pseudo_unnormal): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_zero): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_inf): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_qnan): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_snan): Exception "Invalid operation" set
Failure: fpclassify_downward (pseudo_unnormal): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_zero): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_inf): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_qnan): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_snan): Exception "Invalid operation" set
Failure: fpclassify_towardzero (pseudo_unnormal): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_zero): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_inf): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_qnan): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_snan): Exception "Invalid operation" set
Failure: fpclassify_upward (pseudo_unnormal): Exception "Invalid operation" set

3 months agomath: Fix isgreater* and isless* for clang
Adhemerval Zanella [Fri, 1 Apr 2022 19:35:32 +0000 (16:35 -0300)] 
math: Fix isgreater* and isless* for clang

clang does not check for unordered numbers with builtins for
_Float128 type.

It fixes multiple issues with math tests, such as:

Failure: fmax (0, qNaN): Exception "Invalid operation" set
Failure: fmax (0, -qNaN): Exception "Invalid operation" set
Failure: fmax (-0, qNaN): Exception "Invalid operation" set
Failure: fmax (-0, -qNaN): Exception "Invalid operation" set
Failure: fmax (9, qNaN): Exception "Invalid operation" set
Failure: fmax (9, -qNaN): Exception "Invalid operation" set
Failure: fmax (-9, qNaN): Exception "Invalid operation" set
Failure: fmax (-9, -qNaN): Exception "Invalid operation" set

3 months agomath: Handle fabsf128 intra PLT for !__USE_EXTERN_INLINES
Adhemerval Zanella [Tue, 2 Aug 2022 18:42:14 +0000 (15:42 -0300)] 
math: Handle fabsf128 intra PLT for !__USE_EXTERN_INLINES

If compiler does not support __USE_EXTERN_INLINES we need to route
fabsf128 call to an internal symbol.

3 months agoExtend malloc function hiding to tst-memaling-2 and tst-reallocarray (BZ #32366)
Adhemerval Zanella [Wed, 2 Apr 2025 15:51:51 +0000 (12:51 -0300)] 
Extend malloc function hiding to tst-memaling-2 and tst-reallocarray (BZ #32366)

Add "tst-malloc-aux.h" on tst-memalign-2.c and extend the mechanism
to handle reallocarray as well (clang-20 also optimize-out
reallocarray).

3 months agoEnable --enable-fortify-source with clang
Adhemerval Zanella [Thu, 8 Feb 2024 13:56:30 +0000 (10:56 -0300)] 
Enable --enable-fortify-source with clang

clang generates internal calls for some _chk symbol, so add internal
aliases for them, and stub some with rtld-stubbed-symbols to avoid
ld.so linker issues.

3 months agoconfigure: remove overly restrictive check for clang
Fangrui Song [Sun, 26 Sep 2021 05:03:08 +0000 (22:03 -0700)] 
configure: remove overly restrictive check for clang

3 months agoriscv: Suppress clang -Wignored-attributes for feupdateenv
Adhemerval Zanella [Tue, 8 Apr 2025 13:31:29 +0000 (10:31 -0300)] 
riscv: Suppress clang -Wignored-attributes for feupdateenv

clang warns that the alias will be always resolve to
__GI___feupdateenv even if weak definition of __GI_feupdateenv
is overridden, which is really the intention.

3 months agostring: Suppress clang -Wignored-attributes on strlen
Adhemerval Zanella [Tue, 8 Apr 2025 13:27:13 +0000 (10:27 -0300)] 
string: Suppress clang  -Wignored-attributes on strlen

clang warns that the alias will be always resolve to __strlen
even if weak definition of __GI_strlen is overridden, which is
really the intention.

3 months agoriscv: Do not use cfi_label when building with clang
Adhemerval Zanella [Thu, 28 Sep 2023 17:17:54 +0000 (14:17 -0300)] 
riscv: Do not use cfi_label when building with clang

The .cfi_label is a gas extension not supported by clang.  From a
ziglang discussion [1], it seems that it is not really required.

[1] https://github.com/ziglang/zig/issues/3340

3 months agoelf: Fix localplt issue with clang
Adhemerval Zanella [Tue, 25 Mar 2025 14:08:44 +0000 (11:08 -0300)] 
elf: Fix localplt issue with clang

Recent clang version optimizes some loops contructions to strlen [1],
so adds the symbol on symbol-hacks.h to call the internal __GI_strlen.

[1] https://github.com/llvm/llvm-project/pull/132572/commits/facd7dfc80d655fe49baf4bf27e144a4c890a149

3 months agoelf: Fix tunable handing with clang
Adhemerval Zanella [Tue, 25 Mar 2025 13:51:38 +0000 (10:51 -0300)] 
elf: Fix tunable handing with clang

Recent clang version optimizes some loops contructions to strlen [1],
which might generate function calls when self-relocation is not
already done (on tunable parsing).  Use an out-of-line function
with __attribute_optimization_barrier__ to avoid this.

[1] https://github.com/llvm/llvm-project/pull/132572/commits/facd7dfc80d655fe49baf4bf27e144a4c890a149

3 months agoAdjust stdint for clang-20
Adhemerval Zanella [Tue, 25 Mar 2025 12:03:21 +0000 (09:03 -0300)] 
Adjust stdint for clang-20

clang 20 adds both __INT64_C and __UINT64_C as builtins, but different
than gcc it does not undef them in its stdint wrapper.

3 months agoCheck if linker sets --no-undefined-version by default
Adhemerval Zanella [Mon, 24 Mar 2025 18:04:04 +0000 (15:04 -0300)] 
Check if linker sets --no-undefined-version by default

Recent lld version default to --no-undefined-version, which triggers
errors when building multiple libraries.  For ld.so it fails with:

ld.lld: error: version script assignment of 'GLIBC_2.4' to symbol '__stack_chk_guard' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '__nptl_set_robust_list_avail' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '__pointer_chk_guard' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '_dl_starting_up' failed: symbol not defined

While for libc.so:

ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_clearerr' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fgetc' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fileno' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_freopen' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fscanf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fseek' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_peekc_unlocked' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stderr_' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stdin_' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stdout_' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_pclose' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_perror' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_rewind' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_scanf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_setbuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_setlinebuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_wdefault_setbuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_wfile_setbuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '__ctype32_tolower' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '__ctype32_toupper' failed: symbol not defined
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)

The way version script is created with multiple missing symbols is
to simplify the build for multiple ABIs with different symbol
symbols.  For instance, __stack_chk_guard is defined by default to
avoid the need of each ABI to add this symbol on its own version
script depending of which stack protector ABI it uses.

The libc.so warnings does show unused symbol being defined (like
_IO_clearerr), which might trigger potential errors depending of
how symbol are exported.  However, since we do have teh ABI checks
for missing and extra symbol the linker extra checks are not really
required.  So disable them for now.

3 months agoSupress unused command arguments warning with clang
Adhemerval Zanella [Tue, 25 Mar 2025 12:05:36 +0000 (09:05 -0300)] 
Supress unused command arguments warning with clang

clang 20 triggers an error for the unused '-c' argument used to create
errlist-data-aux-shared.S, errlist-data-aux.S, siglist-aux-shared.S,
and siglist-aux.S.

3 months agoBuild glibc with -ftrapping-math
Adhemerval Zanella [Thu, 15 Feb 2024 11:58:46 +0000 (08:58 -0300)] 
Build glibc with -ftrapping-math

GCC enables it by default, clang in the other hand sets -fno-trapping-math.
This is required to fix some math and stdlib tests that explicit raises
floating point exceptions:

math/test-double-canonicalize.out
testing double (without inline functions)
Failure: canonicalize (max_value): Exception "Overflow" set
Failure: canonicalize (max_value): Exception "Inexact" set
Failure: canonicalize (-max_value): Exception "Overflow" set
Failure: canonicalize (-max_value): Exception "Inexact" set
Failure: canonicalize_downward (max_value): Exception "Overflow" set
Failure: canonicalize_downward (max_value): Exception "Inexact" set
Failure: canonicalize_downward (-max_value): Exception "Overflow" set
Failure: canonicalize_downward (-max_value): Exception "Inexact" set
Failure: canonicalize_towardzero (max_value): Exception "Overflow" set
Failure: canonicalize_towardzero (max_value): Exception "Inexact" set
Failure: canonicalize_towardzero (-max_value): Exception "Overflow" set
Failure: canonicalize_towardzero (-max_value): Exception "Inexact" set
Failure: canonicalize_upward (max_value): Exception "Overflow" set
Failure: canonicalize_upward (max_value): Exception "Inexact" set
Failure: canonicalize_upward (-max_value): Exception "Overflow" set
Failure: canonicalize_upward (-max_value): Exception "Inexact" set

test-float-catanh.out
testing float (without inline functions)
Failure: Real part of: catanh (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set

3 months agoAdd fall-through between switch labels annotations
Adhemerval Zanella [Tue, 18 Mar 2025 16:55:58 +0000 (13:55 -0300)] 
Add fall-through between switch labels annotations

The clang default to warning for missing fall-through and it does
not support all comment-like annotation that gcc does.  Use a
proper attribute instead.

3 months agolinux: Fix function point cast on vDSO handling
Adhemerval Zanella [Tue, 18 Mar 2025 16:54:39 +0000 (13:54 -0300)] 
linux: Fix function point cast on vDSO handling

There is no need to cast to avoid, both pointer already have the
expected type.

It fixes the clang -Wpointer-type-mismatch error:

../sysdeps/unix/sysv/linux/gettimeofday.c:43:6: error: pointer type mismatch ('int (*)(struct timeval *, void *)' and 'void *') [-Werror,-Wpointer-type-mismatch]
   41 | libc_ifunc (__gettimeofday,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |             GLRO(dl_vdso_gettimeofday) != NULL
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |             ? VDSO_IFUNC_RET (GLRO(dl_vdso_gettimeofday))
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   44 |             : (void*) __gettimeofday_syscall)
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:789:53: note: expanded from macro 'libc_ifunc'
  789 | #define libc_ifunc(name, expr) __ifunc (name, name, expr, void, INIT_ARCH)
      |                                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:705:34: note: expanded from macro '__ifunc'
  705 |   __ifunc_args (type_name, name, expr, init, arg)
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
./../include/libc-symbols.h:677:38: note: expanded from macro '__ifunc_args'
  677 |   __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__);  \
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:667:33: note: expanded from macro '__ifunc_resolver'
  667 |     __typeof (type_name) *res = expr;                                   \
      |                                 ^~~~

3 months agoelf: Only defines _dl_tls_allocate_active for SHARED
Adhemerval Zanella [Tue, 18 Mar 2025 16:51:53 +0000 (13:51 -0300)] 
elf: Only defines _dl_tls_allocate_active for SHARED

clang issues:

dl-tls.c:108:1: error: unused function '_dl_tls_allocate_active' [-Werror,-Wunused-function]
  108 | _dl_tls_allocate_active (void)
      | ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

3 months agoelf: Suppress unused function clang warning for __ifunc_resolver
Adhemerval Zanella [Tue, 18 Mar 2025 16:52:34 +0000 (13:52 -0300)] 
elf: Suppress unused function clang warning for __ifunc_resolver

The __ifunc_resolver macro expands to:

   extern __typeof (__redirect_name) name __attribute__ ((ifunc ("iname_ifunc")));
   static __typeof (__redirect_name) *name_ifunc (void) { [...] };

And although NAME_IFUNC is and alias for NAME, clang still emits
an 'unused function 'name_ifunc' [-Werror,-Wunused-function]'
warning.  The static is used to avoid name pollution on static
linkage.

3 months agoFix -Wno-ignored-attributes configure check
Adhemerval Zanella [Tue, 18 Mar 2025 16:51:43 +0000 (13:51 -0300)] 
Fix -Wno-ignored-attributes configure check

3 months agoaarch64: Use NO_MATH_REDIRECT on pow_advsimd.c
Adhemerval Zanella [Wed, 2 Oct 2024 19:13:26 +0000 (19:13 +0000)] 
aarch64: Use NO_MATH_REDIRECT on pow_advsimd.c

clang does not optimize the fma calls, instead issuing __fma.

3 months agox86: Use __always_inline on ifunc auxiliary functions
Adhemerval Zanella [Thu, 4 Aug 2022 12:41:29 +0000 (09:41 -0300)] 
x86: Use __always_inline on ifunc auxiliary functions

clang does correctly propagate the no_stack_protector attribute for
inline function used in ifunc selectors.  For instance, the exp function
is expanded as:

  static inline void *
  ieee754_exp_ifunc_selector (void)
  {
    [...]
  }

  extern __typeof (__redirect_ieee754_exp) __ieee754_exp
    __attribute__ ((ifunc ("__ieee754_exp" "_ifunc")));

  static __attribute__((no_stack_protector)) __typeof (__redirect_ieee754_exp) *i
  __ieee754_exp_ifunc (void)
  {
    __typeof (__redirect_ieee754_exp) *res = ieee754_exp_ifunc_selector ();
    return res;
  };

The ifunc selection ended being compiled with -fstack-protector, and
with debug function set to the ifunc selector
(ieee754_exp_ifunc_selector) auxiliary function instead of the
selector itself.

The ifunc selector are called early, before TCB is setup, which
causes SIGSEGV for statically linked binaries.

To fix it use __always_inline instead of inline.  It should not change
code generation on gcc and it fixes the code generation issue on
clang.  It also fixes function debug information.

3 months agox86: Fix strstr ifunc on clang
Adhemerval Zanella [Tue, 1 Apr 2025 19:22:42 +0000 (16:22 -0300)] 
x86: Fix strstr ifunc on clang

clang triggers multiple issue on how ifunc macro are used:

  ../sysdeps/x86_64/multiarch/strstr.c:38:54: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
     38 | extern __typeof (__redirect_strstr) __strstr_generic attribute_hidden;
        |                                                      ^
  ./../include/libc-symbols.h:356:43: note: expanded from macro 'attribute_hidden'
    356 | # define attribute_hidden __attribute__ ((visibility ("hidden")))
        |                                           ^
  ../string/strstr.c:76:1: note: previous definition is here
     76 | STRSTR (const char *haystack, const char *needle)
        | ^
  ../sysdeps/x86_64/multiarch/strstr.c:27:16: note: expanded from macro 'STRSTR'
     27 | #define STRSTR __strstr_generic
        |                ^
  ../sysdeps/x86_64/multiarch/strstr.c:65:43: error: redefinition of '__libc_strstr'
     65 | libc_ifunc_redirected (__redirect_strstr, __libc_strstr, IFUNC_SELECTOR ());
        |                                           ^

And

  ../sysdeps/x86_64/multiarch/strstr.c:65:43: error: redefinition of '__libc_strstr'
     65 | libc_ifunc_redirected (__redirect_strstr, __libc_strstr, IFUNC_SELECTOR ());
        |                                           ^
  ../sysdeps/x86_64/multiarch/strstr.c:59:13: note: previous definition is here
     59 | libc_ifunc (__libc_strstr,
        |             ^

Refactor to use a auxiliary function like other selection (for instance,
x86_64/multiarch/strcmp.c).

3 months agox86: math: Avoid the use of __libgcc_cmp_return__ for __gcc_CMPtype
Adhemerval Zanella [Thu, 10 Mar 2022 17:41:31 +0000 (14:41 -0300)] 
x86: math: Avoid the use of __libgcc_cmp_return__ for __gcc_CMPtype

clang does not support '__attribute__ ((mode (__libgcc_cmp_return__)))',
so use a more close related type instead fo the default 'int'.

3 months agox86: Use -msse2avx iff compiler supports it
Adhemerval Zanella [Thu, 10 Mar 2022 18:05:51 +0000 (15:05 -0300)] 
x86: Use -msse2avx iff compiler supports it

clang-19 does support it, but it should be gated as an option to
assemble (either with -Wa or -Xassembler).  So add a test for -Wa
as well if -msse2avx is not supported.

3 months agosupport: Handle clang support/dtotimespec.c on dtotimespec
Adhemerval Zanella [Mon, 20 Mar 2023 19:20:48 +0000 (16:20 -0300)] 
support: Handle clang support/dtotimespec.c on dtotimespec

clang issues:

dtotimespec.c:31:25: error: implicit conversion from 'time_t' (aka
'long') to 'double' changes value from 9223372036854775807 to
9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
  else if (sec >= 1.0 + TYPE_MAXIMUM (time_t))
                      ~ ^~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:57:4: note: expanded from macro 'TYPE_MAXIMUM'
  ((t) (! TYPE_SIGNED (t)
\
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So explicit cast it to double.

3 months agostdio: Fix -Wtautological-constant-out-of-range-compare on clang
Adhemerval Zanella [Tue, 3 Jan 2023 17:35:09 +0000 (14:35 -0300)] 
stdio: Fix -Wtautological-constant-out-of-range-compare on clang

clang emits an error while building vfprintf-internal for default
case:

error: result of comparison of constant 255 with expression of type
'char' is always true
[-Werror,-Wtautological-constant-out-of-range-compare]
          if (spec <= UCHAR_MAX

The test is indeed not required for default non-wide build.

3 months agomath: Suppress more aliases builtin type conflicts
Adhemerval Zanella [Tue, 26 Jul 2022 13:35:10 +0000 (10:35 -0300)] 
math: Suppress more aliases builtin type conflicts

3 months agosupport: Use CHAR_MAX as maximum value
Adhemerval Zanella [Tue, 15 Mar 2022 21:01:57 +0000 (18:01 -0300)] 
support: Use CHAR_MAX as maximum value

On ABIs with defined 'char' was unsigned type, clang fails to build
support_process_state.c with:

  support_process_state.c:70:21: error: result of comparison of constant  -1 with expression of type 'char' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
     70 |       if (cur_state == -1)
        |           ~~~~~~~~~ ^  ~~
  1 error generated.

3 months agoposix: Defined _POSIX_VDISABLE as integer literal
Adhemerval Zanella [Tue, 15 Mar 2022 21:09:10 +0000 (18:09 -0300)] 
posix: Defined _POSIX_VDISABLE as integer literal

The constant should be used with c_cc, which for all supported ABIs
is defined as unsigned char.  By using it as literar char constant,
clang triggers an error when compared with signal literal o ABIs that
define 'char' as unsigned.

On aarch64, clang shows:

  ../sysdeps/posix/fpathconf.c:118:21: error: right side of operator
  converted from negative value to unsigned: -1 to 18446744073709551615
  [-Werror]
  #if _POSIX_VDISABLE == -1
    ~~~~~~~~~~~~~~~ ^  ~~

3 months agostring: Use asm alias instead of symbol redirections for stpcpy and mempcpy
Adhemerval Zanella [Tue, 15 Mar 2022 11:41:43 +0000 (08:41 -0300)] 
string: Use asm alias instead of symbol redirections for stpcpy and mempcpy

Commit 939da411433 added symbols redirections to handle ISO C
namespace, however clang do not support to redeclare the function
prototype.

This patch replaces the symbol redirections by direct asm aliases, as
done to handle libcall generation done by compiler on some loop
optimizations.

Checked on all affected ABIs.

3 months agomath: Use -fexcess-precision=standard iff compiler supports it
Adhemerval Zanella [Thu, 10 Mar 2022 20:22:41 +0000 (17:22 -0300)] 
math: Use -fexcess-precision=standard iff compiler supports it

3 months agoUse $(config-cflags-wno-ignored-attributes) on some files
Adhemerval Zanella [Fri, 11 Mar 2022 13:40:44 +0000 (10:40 -0300)] 
Use $(config-cflags-wno-ignored-attributes) on some files

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.  Howerver, this is a common pattern for weak_alias, where
multiple alias are set to same symbol.

3 months agomath: Suppress clang -Wincompatible-library-redeclaration on s_llround
Adhemerval Zanella [Wed, 24 Aug 2022 15:41:39 +0000 (12:41 -0300)] 
math: Suppress clang -Wincompatible-library-redeclaration on s_llround

Clang issues:

  ../sysdeps/ieee754/dbl-64/s_llround.c:83:30: error: incompatible
  redeclaration of library function 'lround'
  [-Werror,-Wincompatible-library-redeclaration]
  libm_alias_double (__lround, lround)
                               ^
  ../sysdeps/ieee754/dbl-64/s_llround.c:83:30: note: 'lround' is a builtin
  with type 'long (double)'

3 months agomath: use fabs on __ieee754_lgamma_r
Adhemerval Zanella [Thu, 10 Mar 2022 17:21:43 +0000 (14:21 -0300)] 
math: use fabs on __ieee754_lgamma_r

3 months agomath: Suppress clang warning on math_check_force_underflow
Adhemerval Zanella [Thu, 10 Mar 2022 16:53:13 +0000 (13:53 -0300)] 
math: Suppress clang warning on math_check_force_underflow

clang warns:

  ../sysdeps/x86/fpu/powl_helper.c:233:3: error: absolute value function
  '__builtin_fabsf' given an argument of type 'typeof (res)' (aka 'long
  double') but has parameter of type 'float' which may cause truncation of
  value [-Werror,-Wabsolute-value]
    math_check_force_underflow (res);
    ^
  ./math-underflow.h:45:11: note: expanded from macro
  'math_check_force_underflow'
        if (fabs_tg (force_underflow_tmp)                         \
            ^
  ./math-underflow.h:27:20: note: expanded from macro 'fabs_tg'
  #define fabs_tg(x) __MATH_TG ((x), (__typeof (x)) __builtin_fabs, (x))
                     ^
  ../math/math.h:899:16: note: expanded from macro '__MATH_TG'
                 float: FUNC ## f ARGS,           \
                        ^
  <scratch space>:73:1: note: expanded from here
  __builtin_fabsf
  ^

3 months agocatgets: Remove catgets/config.h
Adhemerval Zanella [Thu, 10 Mar 2022 13:52:14 +0000 (10:52 -0300)] 
catgets: Remove catgets/config.h

It simplifies the code a bit and avoid the clang warning:

  ./config.h:12:2: error: #include_next in file found relative to primary
  source file or found by absolute path; will search from start of include
  path [-Werror,-Winclude-next-absolute-path]
  #include_next <config.h>
   ^

3 months agoiconvdata: Remove use of GNU old-style field designator extension
Adhemerval Zanella [Thu, 10 Mar 2022 13:24:53 +0000 (10:24 -0300)] 
iconvdata: Remove use of GNU old-style field designator extension

Use the C99 syntax instead.

3 months agoiconvdata: Suppress clang warning on locale definitions
Adhemerval Zanella [Thu, 10 Mar 2022 13:01:09 +0000 (10:01 -0300)] 
iconvdata: Suppress clang warning on locale definitions

clang issues an warning adding '{unsigned} int' to a string does not
append to the string, however it is exactly what code means here.

3 months agolocale: Fix implicit conversion on collate_finish
Adhemerval Zanella [Thu, 10 Mar 2022 12:54:02 +0000 (09:54 -0300)] 
locale: Fix implicit conversion on collate_finish

Clang issues:

programs/ld-collate.c:1824:55: error: implicit conversion from 'unsigned
long' to 'unsigned int' changes value from 18446744073709551615 to
4294967295 [-Werror,-Wconstant-conversion]
  collate->undefined.used_in_level = need_undefined ? ~0ul : 0;
                                   ~                  ^~~~

3 months agoelf: Suppress clang -Wstring-plus-int on rtld.c
Adhemerval Zanella [Thu, 10 Mar 2022 12:48:32 +0000 (09:48 -0300)] 
elf: Suppress clang -Wstring-plus-int on rtld.c

clang issues an warning adding 'const unsigned char' to a string
does not append to the string, however it is exactly what code
means here.

3 months agoelf: Supress clang -Wsometimes-uninitialized on _dl_debug_initialize
Adhemerval Zanella [Wed, 24 Aug 2022 15:25:05 +0000 (12:25 -0300)] 
elf: Supress clang -Wsometimes-uninitialized on _dl_debug_initialize

clang issues an warning where variable 'r' is used uninitialized
whenever 'if' condition is false.  The _dl_debug_initialize is called
for static case always with LM_ID_BASE (csu/libc-start.c and
elf/dl-reloc-static-pie.c) and DL_NSS will be always larger than 1
for shared case.

3 months agosunrpc: Suppress clang warning on struct cmessage
Adhemerval Zanella [Thu, 10 Mar 2022 17:08:06 +0000 (14:08 -0300)] 
sunrpc: Suppress clang warning on struct cmessage

clang complains if a flexible array member (struct cmsghdr) is not a
the end of the struct (since it is a GNU extension).  The __msgread
explicit expects that 'struct ucred' is after the 'cmsg', so suppress
the warning.

3 months agosunrpc: Remove extra parenthesis on comparison
Adhemerval Zanella [Thu, 10 Mar 2022 11:34:01 +0000 (08:34 -0300)] 
sunrpc: Remove extra parenthesis on comparison

clang issues a 'equality comparison with extraneous parentheses
[-Werror,-Wparentheses-equality]' in this.  Instead of suppress
the warning, just use the more usual comparison style.

3 months agonss: Suppress nss_module.c warning on clang
Adhemerval Zanella [Thu, 10 Mar 2022 11:31:06 +0000 (08:31 -0300)] 
nss: Suppress nss_module.c warning on clang

clang issues an warning adding 'unsigned long' to a string does not
append to the string, however it is exactly what code means here.

3 months agoargp: Expand argp_usage, _option_is_short, and _option_is_end
Adhemerval Zanella [Thu, 21 Jul 2022 17:12:01 +0000 (14:12 -0300)] 
argp: Expand argp_usage, _option_is_short, and _option_is_end

The argp code uses some clever macro redefine to avoid need to
duplicate the optimized static inline implementations for
argp_usage, _option_is_short, and _option_is_end.  This however
leads to some build issues with clang, since some function
prototypes are redefined to add the hidden attribute with
libc_hidden_proto.

To avoid extensive changes on internal headers, just expand the
function implementations and avoid the macro redefine tricks.

3 months agomisc: Suppress clang warnings on syslog
Adhemerval Zanella [Fri, 29 Apr 2022 13:50:13 +0000 (10:50 -0300)] 
misc: Suppress clang warnings on syslog

clang complains that adding a 'int_t' to a string does not append
to it, but the idea is to print the pid conditionally.

3 months agoposix: Suppress -Wignored-attributes when building with clang
Adhemerval Zanella [Wed, 24 Aug 2022 15:13:27 +0000 (12:13 -0300)] 
posix: Suppress -Wignored-attributes when building with clang

clang warns that alias will be always resolve to _GI___confstr even
if weak definition of __GI_confstr is overridden, which is really the
intention.

3 months agonptl: Fix Wincompatible-pointer-types on clang
Adhemerval Zanella [Wed, 9 Mar 2022 19:17:43 +0000 (16:17 -0300)] 
nptl: Fix Wincompatible-pointer-types on clang

Clang issues:

error: incompatible pointer types passing 'struct pthread **' to
parameter of type 'void **' [-Werror,-Wincompatible-pointer-types]

3 months agoSuppress -Wmaybe-uninitialized only for gcc
Adhemerval Zanella [Wed, 9 Mar 2022 18:51:50 +0000 (15:51 -0300)] 
Suppress -Wmaybe-uninitialized only for gcc

The warning is not supported by clang.

3 months agoconfigure: Use -Wno-maybe-uninitialized iff compiler supports it
Adhemerval Zanella [Thu, 10 Mar 2022 19:40:29 +0000 (16:40 -0300)] 
configure: Use -Wno-maybe-uninitialized iff compiler supports it

clang does not support the flag.

3 months agoDisable __USE_EXTERN_INLINES for clang
Adhemerval Zanella [Fri, 8 Oct 2021 01:16:04 +0000 (18:16 -0700)] 
Disable __USE_EXTERN_INLINES for clang

clang does not allow to redefine attributes after function declaration.
Although it work for external usage, its breaks the build for internal
symbol that glibc provides as optimization (for instance bsearch
with stdlib-bsearch.h or __cmsg_nxthdr).

Disable such optimization for clang while building glibc.

3 months agostdlib: longlong.h: Do no use asm input cast for clang
Adhemerval Zanella [Wed, 13 Sep 2023 21:02:57 +0000 (18:02 -0300)] 
stdlib: longlong.h: Do no use asm input cast for clang

 clang by default rejects the input casts with:

  error: invalid use of a cast in a inline asm context requiring an
  lvalue: remove the cast or build with -fheinous-gnu-extensions

And even with -fheinous-gnu-extensions clang still throws an warning
and also states that this option might be removed in the future.
For gcc the cast are still useful [1] as type-checking.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581722.html

3 months agostdlib: Remove -Wmaybe-uninitialized supression on setenv.c
Adhemerval Zanella [Wed, 13 Sep 2023 19:55:27 +0000 (16:55 -0300)] 
stdlib: Remove -Wmaybe-uninitialized supression on setenv.c

It is not required on current supported gcc.

3 months agoelf: Extend glibc.rtld.execstack tunable to force executable stack (BZ 32653)
Adhemerval Zanella [Thu, 13 Feb 2025 17:02:38 +0000 (14:02 -0300)] 
elf: Extend glibc.rtld.execstack tunable to force executable stack (BZ 32653)

From the bug report [1], multiple programs still require to dlopen
shared libraries with either missing PT_GNU_STACK or with the executable
bit set.  Although, in some cases, it seems to be a hard-craft assembly
source without the required .note.GNU-stack marking (so the static linker
is forced to set the stack executable if the ABI requires it), other
cases seem that the library uses trampolines [2].

Unfortunately, READ_IMPLIES_EXEC is not an option since on some ABIs
(x86_64), the kernel clears the bit, making it unsupported.  To avoid
reinstating the broken code that changes stack permission on dlopen
(0ca8785a28), this patch extends the glibc.rtld.execstack tunable to
allow an option to force an executable stack at the program startup.

The tunable is a security issue because it defeats the PT_GNU_STACK
hardening.  It has the slight advantage of making it explicit by the
caller, and, as for other tunables, this is disabled for setuid binaries.
A tunable also allows us to eventually remove it, but from previous
experiences, it would require some time.

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

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=32653
[2] https://github.com/conda-forge/ctng-compiler-activation-feedstock/issues/143
Reviewed-by: Sam James <sam@gentoo.org>
3 months agostdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs
Lenard Mollenkopf [Tue, 8 Apr 2025 12:16:54 +0000 (14:16 +0200)] 
stdlib: Implement C2Y uabs, ulabs, ullabs and uimaxabs

C2Y adds unsigned versions of the abs functions (see C2Y draft N3467 and
proposal N3349).

Tested for x86_64.

Signed-off-by: Lenard Mollenkopf <glibc@lenardmollenkopf.de>
3 months agostdio-common: In tst-setvbuf2, close helper thread descriptor only if opened
Florian Weimer [Tue, 8 Apr 2025 08:39:44 +0000 (10:39 +0200)] 
stdio-common: In tst-setvbuf2, close helper thread descriptor only if opened

The helper thread may get canceled before the open system
call succeds.  Then ThreadData.fd remains zero, and eventually
the xclose call in end_reader_thread fails because descriptor 0
is not open.

Instead, initialize the fd member to -1 (not a valid descriptor)
and close the descriptor only if valid.  Do this in a new end_thread
helper routine.

Also add more error checking to close operations.

Fixes commit 95b780c1d0549678c0a244c6e2112ec97edf0839 ("stdio: Add
more setvbuf tests").

3 months agoRemove duplicates from binaries-shared-tests when creating make rules
Andreas Schwab [Mon, 7 Apr 2025 08:41:38 +0000 (10:41 +0200)] 
Remove duplicates from binaries-shared-tests when creating make rules

This avoids a warning from make because binaries-shared-tests contains
both $(tests-container) and $(tests-internal).

3 months agox86: Optimize xstate size calculation
Sunil K Pandey [Thu, 3 Apr 2025 20:00:45 +0000 (13:00 -0700)] 
x86: Optimize xstate size calculation

Scan xstate IDs up to the maximum supported xstate ID.  Remove the
separate AMX xstate calculation.  Instead, exclude the AMX space from
the start of TILECFG to the end of TILEDATA in xsave_state_size.

Completed validation on SKL/SKX/SPR/SDE and compared xsave state size
with "ld.so --list-diagnostics" option, no regression.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
3 months agoNEWS: update for GCC 12.1 requirement [BZ #32539]
Sam James [Wed, 2 Apr 2025 17:49:42 +0000 (18:49 +0100)] 
NEWS: update for GCC 12.1 requirement [BZ #32539]

Since 27b96e069aad17cefea9437542180bff448ac3a0, the minimum GCC required
to build glibc is GCC 12.1.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 months agostdio: fix hurd link for tst-setvbuf2
DJ Delorie [Wed, 2 Apr 2025 18:54:03 +0000 (14:54 -0400)] 
stdio: fix hurd link for tst-setvbuf2

3 months agostdlib: Fix qsort memory leak if callback throws (BZ 32058)
Adhemerval Zanella [Thu, 27 Mar 2025 15:30:48 +0000 (12:30 -0300)] 
stdlib: Fix qsort memory leak if callback throws (BZ 32058)

If the input buffer exceeds the stack auxiliary buffer, qsort will
malloc a temporary one to call mergesort.  Since C++ standard does
allow the callback comparison function to throw [1], the glibc
implementation can potentially leak memory.

The fixes uses a pthread_cleanup_combined_push and
pthread_cleanup_combined_pop, so it can work with and without
exception enables.  The qsort code path that calls malloc now
requires some extra setup and a call to __pthread_cleanup_push
anmd __pthread_cleanup_pop (which should be ok since they just
setup some buffer state).

Checked on x86_64-linux-gnu.

[1] https://timsong-cpp.github.io/cppwp/n4950/alg.c.library#4

Reviewed-by: DJ Delorie <dj@redhat.com>
3 months agosysdeps: powerpc: restore -mlong-double-128 check
Sam James [Tue, 1 Apr 2025 20:56:52 +0000 (21:56 +0100)] 
sysdeps: powerpc: restore -mlong-double-128 check

We mistakenly dropped the check in 27b96e069aad17cefea9437542180bff448ac3a0;
there's some other checks which we *can* drop, but let's worry about that
later.

Fixes the build on ppc64le where GCC is configured with --with-long-double-format=ieee.

Reviewed-by: Andreas Schwab <schwab@suse.de>
3 months agostdio: Add more setvbuf tests
DJ Delorie [Fri, 14 Mar 2025 20:08:35 +0000 (16:08 -0400)] 
stdio: Add more setvbuf tests

3 months agoadd ptmx support to test-container
DJ Delorie [Fri, 14 Mar 2025 20:08:12 +0000 (16:08 -0400)] 
add ptmx support to test-container

3 months agoUpdate syscall lists for Linux 6.14
Joseph Myers [Tue, 1 Apr 2025 12:44:26 +0000 (12:44 +0000)] 
Update syscall lists for Linux 6.14

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

Tested with build-many-glibcs.py.

3 months agox86: Link tst-gnu2-tls2-x86-noxsave{,c,xsavec} with libpthread
Florian Weimer [Mon, 31 Mar 2025 19:33:18 +0000 (21:33 +0200)] 
x86: Link tst-gnu2-tls2-x86-noxsave{,c,xsavec} with libpthread

This fixes a test build failure on Hurd.

Fixes commit 145097dff170507fe73190e8e41194f5b5f7e6bf ("x86: Use separate
variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)").

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 months agoelf: Fix tst-origin build when toolchain defaults to --as-needed (BZ 32823)
John David Anglin [Mon, 31 Mar 2025 16:48:32 +0000 (13:48 -0300)] 
elf: Fix tst-origin build when toolchain defaults to --as-needed (BZ 32823)

Checked on aarch64-linux-gnu.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 months agoRaise the minimum GCC version to 12.1 [BZ #32539]
H.J. Lu [Wed, 12 Feb 2025 04:53:09 +0000 (12:53 +0800)] 
Raise the minimum GCC version to 12.1 [BZ #32539]

For all Linux distros with glibc 2.40 which I can find, GCC 14.2 is used
to compile glibc 2.40:

OS                    GCC      URL
AOSC                  14.2.0   https://aosc.io/
Arch Linux            14.2.0   https://archlinux.org/
ArchPOWER             14.2.0   https://archlinuxpower.org/
Artix                 14.2.0   https://artixlinux.org/
Debian                14.2.0   https://www.debian.org/
Devuan                14.2.0   https://www.devuan.org/
Exherbo               14.2.0   https://www.exherbolinux.org/
Fedora                14.2.1   https://fedoraproject.org/
Gentoo                14.2.1   https://gentoo.org/
Kali Linux            14.2.0   https://www.kali.org/
KaOS                  14.2.0   https://kaosx.us/
LiGurOS               14.2.0   https://liguros.gitlab.io/
Mageia                14.2.0   https://www.mageia.org/en/
Manjaro               14.2.0   https://manjaro.org/
NixOS                 14.2.0   https://nixos.org/
openmamba             14.2.0   https://openmamba.org/
OpenMandriva          14.2.0   https://openmandriva.org/
openSUSE              14.2.0   https://www.opensuse.org/
Parabola              14.2.0   https://www.parabola.nu/
PLD Linux             14.2.0   https://pld-linux.org/
PureOS                14.2.0   https://pureos.net/
Raspbian              14.2.0   http://raspbian.org/
Slackware             14.2.0   http://www.slackware.com/
Solus                 14.2.0   https://getsol.us/
T2 SDE                14.2.0   http://t2sde.org/
Ubuntu                14.2.0   https://www.ubuntu.com/
Wikidata              14.2.0   https://wikidata.org/

Support older versions of GCC to build glibc 2.42:

1. Need to work around bugs in older versions of GCC.
2. Can't use the new features in newer versions of GCC, which may be
required for new features, like _Float16 which requires GCC 12.1 or
above, in glibc,

The main benefit of supporting older versions of GCC is easier backport
of bug fixes to the older releases of glibc, which can be mitigated by
avoiding incompatible features in newer versions of GCC for critical bug
fixes.  Require GCC 12.1 or newer to build.  Remove GCC version check for
PowerPC and s390x.

TEST_CC and TEST_CXX can be used to test the glibc build with the older
versions of GCC.

For glibc developers who are using Linux OSes which don't come with GCC
12.1 or newer, they should build and install GCC 12.1 or newer to work
on glibc.

This fixes BZ #32539.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
4 months agoFix typo in comment
YLK [Mon, 24 Mar 2025 14:04:21 +0000 (22:04 +0800)] 
Fix typo in comment

4 months agomanual: tidy the longopt.c example
Samuel Zeter [Tue, 25 Mar 2025 08:00:33 +0000 (18:00 +1000)] 
manual: tidy the longopt.c example

- Change longopt.c's backticks to single quotes
- puts() does not use format specifiers

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 months agomanual: Document functions adopted by POSIX.1-2024.
Collin Funk [Thu, 27 Mar 2025 06:36:30 +0000 (23:36 -0700)] 
manual: Document functions adopted by POSIX.1-2024.

Here is a patch updating the documentation to mention GNU and BSD
extensions that were adopted by POSIX.1-2024.

* manual/llio.texi (Memory-mapped I/O): Add that MAP_ANON and
MAP_ANONYMOUS were added by POSIX.1-2024.
* manual/memory.texi (Changing Block Size): Mention that reallocarray
was added by POSIX.1-2024.
* manual/message.texi (Message Translation): Adjust wording to match
standardization.
(Translation with gettext): Mention the gettext family of functions were
added by POSIX.1-2024.
* manual/pattern.texi (Wildcard Matching): Mention that FNM_CASEFOLD was
added by POSIX.1-2024.
* manual/process.texi (Creating a Process): Mention that _Fork and
WCOREDUMP were added by POSIX.1-2024.
* manual/signal.texi (Miscellaneous Signals): Mention that SIGWINCH was
added by POSIX-1.2024.
* manual/startup.texi (Environment Access): Mention that secure_getenv
was added by POSIX.1-2024.
* manual/string.texi (Truncating Strings): Mention that strlcpy,
strlcat, wcslcpy, and wslcat were added by POSIX-1.2024.
(Search Functions): Document that memmem was added by POSIX-1.2024.
* manual/terminal.texi (Allocation): Mention that ptsname_r was added by
POSIX-1.2024.
* manual/threads.texi (Waiting with Explicit Clocks): Move node under
POSIX Threads.  Mention pthread_cond_clockwait,
pthread_rwlock_clockrdlock, and pthread_rwlock_clockwrlock were added by
POSIX-1.2024.
(Joining Threads): New node under Non-POSIX Extensions.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
4 months agoaarch64: Fix _dl_tlsdesc_dynamic unwind for pac-ret (BZ 32612)
Adhemerval Zanella [Fri, 28 Mar 2025 17:27:45 +0000 (14:27 -0300)] 
aarch64: Fix _dl_tlsdesc_dynamic unwind for pac-ret (BZ 32612)

When libgcc is built with pac-ret, it requires to autenticate the
unwinding frame based on CFI information.  The _dl_tlsdesc_dynamic
uses a custom calling convention, where it is responsible to save
and restore all registers it might use (even volatile).

The pac-ret support added by 1be3d6eb823d8b952fa54b7bbc90cbecb8981380
was added only on the slow-path, but the fast path also adds DWARF
Register Rule Instruction (cfi_adjust_cfa_offset) since it requires
to save/restore some auxiliary register.  It seems that this is not
fully supported neither by libgcc nor AArch64 ABI [1].

Instead, move paciasp/autiasp to function prologue/epilogue to be
used on both fast and slow paths.

I also corrected the _dl_tlsdesc_dynamic comment description, it was
copied from i386 implementation without any adjustment.

Checked on aarch64-linux-gnu with a toolchain built with
--enable-standard-branch-protection on a system with pac-ret
support.

[1]  https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#id1

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
4 months agox86: Use separate variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)
Florian Weimer [Fri, 28 Mar 2025 08:26:59 +0000 (09:26 +0100)] 
x86: Use separate variable for TLSDESC XSAVE/XSAVEC state size (bug 32810)

Previously, the initialization code reused the xsave_state_full_size
member of struct cpu_features for the TLSDESC state size.  However,
the tunable processing code assumes that this member has the
original XSAVE (non-compact) state size, so that it can use its
value if XSAVEC is disabled via tunable.

This change uses a separate variable and not a struct member because
the value is only needed in ld.so and the static libc, but not in
libc.so.  As a result, struct cpu_features layout does not change,
helping a future backport of this change.

Fixes commit 9b7091415af47082664717210ac49d51551456ab ("x86-64:
Update _dl_tlsdesc_dynamic to preserve AMX registers").

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agox86: Skip XSAVE state size reset if ISA level requires XSAVE
Florian Weimer [Fri, 28 Mar 2025 08:26:06 +0000 (09:26 +0100)] 
x86: Skip XSAVE state size reset if ISA level requires XSAVE

If we have to use XSAVE or XSAVEC trampolines, do not adjust the size
information they need.  Technically, it is an operator error to try to
run with -XSAVE,-XSAVEC on such builds, but this change here disables
some unnecessary code with higher ISA levels and simplifies testing.

Related to commit befe2d3c4dec8be2cdd01a47132e47bdb7020922
("x86-64: Don't use SSE resolvers for ISA level 3 or above").

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 months agomalloc: Improve performance of __libc_malloc
Wilco Dijkstra [Thu, 20 Mar 2025 20:04:14 +0000 (20:04 +0000)] 
malloc: Improve performance of __libc_malloc

Improve performance of __libc_malloc by splitting it into 2 parts: first handle
the tcache fastpath, then do the rest in a separate tailcalled function.
This results in significant performance gains since __libc_malloc doesn't need
to setup a frame and we delay tcache initialization and setting of errno until
later.

On Neoverse V2, bench-malloc-simple improves by 6.7% overall (up to 8.5% for
ST case) and bench-malloc-thread improves by 20.3% for 1 thread and 14.4% for
32 threads.

Reviewed-by: DJ Delorie <dj@redhat.com>
4 months agostdio-common: Reject real data w/o exponent digits in scanf [BZ #12701]
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:53 +0000 (12:35 +0000)] 
stdio-common: Reject real data w/o exponent digits in scanf [BZ #12701]

Reject invalid formatted scanf real input data the exponent part of
which is comprised of an exponent introducing character, optionally
followed by a sign, and with no actual digits following.  Such data is a
prefix of, but not a matching input sequence and it is required by ISO C
to cause a matching failure.

Currently a matching success is instead incorrectly produced along with
the conversion result according to the input significand read and the
exponent of zero, with the significand and the exponent part wholly
consumed from input.

Correct an invalid `tstscanf.c' test accordingly that expects a matching
success for input data provided in the ISO C standard as an example for
a matching failure.

Enable input data that causes test failures without this fix in place.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agostdio-common: Reject significand prefixes in scanf [BZ #12701]
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:53 +0000 (12:35 +0000)] 
stdio-common: Reject significand prefixes in scanf [BZ #12701]

Reject invalid formatted scanf real input data that is comprised of a
hexadecimal prefix, optionally preceded by a sign, and with no actual
digits following owing to the field width restriction in effect.  Such
data is a prefix of, but not a matching input sequence and it is
required by ISO C to cause a matching failure.

Currently a matching success is instead incorrectly produced along with
the conversion result of zero, with the prefix wholly consumed from
input.  Where the end of input is marked by the end-of-file condition
rather than the field width restriction in effect a matching failure is
already correctly produced.

Enable input data that causes test failures without this fix in place.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agostdio-common: Reject integer prefixes in scanf [BZ #12701]
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:53 +0000 (12:35 +0000)] 
stdio-common: Reject integer prefixes in scanf [BZ #12701]

Reject invalid formatted scanf integer input data that is comprised of a
binary or hexadecimal prefix, optionally preceded by a sign, and with no
actual digits following.  Such data is a prefix of, but not a matching
input sequence and it is required by ISO C to cause a matching failure.

Currently a matching success is instead incorrectly produced along with
the conversion result of zero, with the prefix wholly consumed from
input.

Enable input data that causes test failures without this fix in place.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agostdio-common: Also reject exp char w/o significand in i18n scanf [BZ #13988]
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:53 +0000 (12:35 +0000)] 
stdio-common: Also reject exp char w/o significand in i18n scanf [BZ #13988]

Fix the handling of real 'scanf' input such as "+.e" as per BZ #13988
for the i18n case as well, complementing commit 6ecec3b616ae ("Don't
accept exp char without preceding digits in scanf float parsing"), where
the 'e' character is incorrectly consumed from input.  Add a test case
matching stdio-common/bug26.c, with bits from localedata/tst-sscanf.c.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agostdio-common: Add tests for formatted vsscanf input specifiers
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:53 +0000 (12:35 +0000)] 
stdio-common: Add tests for formatted vsscanf input specifiers

Wire vsscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agostdio-common: Add tests for formatted vfscanf input specifiers
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:53 +0000 (12:35 +0000)] 
stdio-common: Add tests for formatted vfscanf input specifiers

Wire vfscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agostdio-common: Add tests for formatted vscanf input specifiers
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:52 +0000 (12:35 +0000)] 
stdio-common: Add tests for formatted vscanf input specifiers

Wire vscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agostdio-common: Add tests for formatted sscanf input specifiers
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:52 +0000 (12:35 +0000)] 
stdio-common: Add tests for formatted sscanf input specifiers

Wire sscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agostdio-common: Add tests for formatted fscanf input specifiers
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:52 +0000 (12:35 +0000)] 
stdio-common: Add tests for formatted fscanf input specifiers

Wire fscanf into test infrastructure for formatted scanf input
specifiers.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agostdio-common: Add scanf long double data for Intel/Motorola 80-bit format
Maciej W. Rozycki [Fri, 28 Mar 2025 12:35:52 +0000 (12:35 +0000)] 
stdio-common: Add scanf long double data for Intel/Motorola 80-bit format

Add Makefile infrastructure, a format-specific test skeleton providing a
data comparison implementation that ignores bits of data representation
in memory that do not participate in holding floating-point data, and
`long double' real input data for targets using the Intel/Motorola
80-bit format.

Keep input data disabled and referring to BZ #12701 for entries that are
are currently incorrectly accepted as valid data, such as '0e', '0e+',
'0x', '0x8p', '0x0p-', etc.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
4 months agoImplement C23 pown
Joseph Myers [Thu, 27 Mar 2025 10:44:44 +0000 (10:44 +0000)] 
Implement C23 pown

C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the pown functions, which are like pow but with an
integer exponent.  That exponent has type long long int in C23; it was
intmax_t in TS 18661-4, and as with other interfaces changed after
their initial appearance in the TS, I don't think we need to support
the original version of the interface.  The test inputs are based on
the subset of test inputs for pow that use integer exponents that fit
in long long.

As the first such template implementation that saves and restores the
rounding mode internally (to avoid possible issues with directed
rounding and intermediate overflows or underflows in the wrong
rounding mode), support also needed to be added for using
SET_RESTORE_ROUND* in such template function implementations.  This
required math-type-macros-float128.h to include <fenv_private.h>, so
it can tell whether SET_RESTORE_ROUNDF128 is defined.  In turn, the
include order with <fenv_private.h> included before <math_private.h>
broke loongarch builds, showing up that
sysdeps/loongarch/math_private.h is really a fenv_private.h file
(maybe implemented internally before the consistent split of those
headers in 2018?) and needed to be renamed to fenv_private.h to avoid
errors with duplicate macro definitions if <math_private.h> is
included after <fenv_private.h>.

The underlying implementation uses __ieee754_pow functions (called
more than once in some cases, where the exponent does not fit in the
floating type).  I expect a custom implementation for a given format,
that only handles integer exponents but handles larger exponents
directly, could be faster and more accurate in some cases.

I encourage searching for worst cases for ulps error for these
implementations (necessarily non-exhaustively, given the size of the
input space).

Tested for x86_64 and x86, and with build-many-glibcs.py.

4 months agosupport: Use unwinder in links-dso-program-c only with libgcc_s
Florian Weimer [Wed, 26 Mar 2025 16:46:40 +0000 (17:46 +0100)] 
support: Use unwinder in links-dso-program-c only with libgcc_s

Do not build links-dso-program-c with exception (unwinding) support
if libgcc_s is not available.  In this case, the unwinder may be
part of libgcc.a or libgcc_eh.a, depending on how GCC was built.
If the unwinder is in libgcc_eh.a only, linking links-dso-program-c
failed before this change.  After this change, the exception
handling landing pad is only generated if libgcc_s available,
avoiding an undefined _Unwind_Resume (or equivalent) symbol
reference in the non-libgcc_s case.

Fixes commit ffd36cc27407003a6f9efcb9c16370e3435c5b1d ("support: Use
unwinder in links-dso-program-c only with libgcc_s") and
commit 5dfbc3c43ecc1bcfc760a032c91bb002660051bc ("support: Link
links-dso-program-c with libgcc_s only if available").