Commit graph

41842 commits

Author SHA1 Message Date
H.J. Lu
15ab68bf1a configure: Improve configure output for C++ Compiler
Change configure output for C++ Compiler from

...
checking -finput-charset=ascii in testing... -finput-charset=ascii
checking -finput-charset=ascii in testing... -finput-charset=ascii
...

to

...
checking -finput-charset=ascii in testing... -finput-charset=ascii
checking g++ -finput-charset=ascii in testing... -finput-charset=ascii
...

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 14:58:53 +08:00
H.J. Lu
33aeb88c5b getaddrinfo.c: Avoid uninitialized pointer access [BZ #32465]
Add valid_decimal_value to check valid decimal value in a string to
avoid uninitialized endp in add_prefixlist and gaiconf_init as reported
by Clang 19:

./getaddrinfo.c:1884:11: error: variable 'endp' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
 1884 |       && (cp == NULL
      |           ^~~~~~~~~~
./getaddrinfo.c:1887:11: note: uninitialized use occurs here
 1887 |       && *endp == '\0'
      |           ^~~~
./getaddrinfo.c:1884:11: note: remove the '||' if its condition is always false
 1884 |       && (cp == NULL
      |           ^~~~~~~~~~
 1885 |           || (bits = strtoul (cp, &endp, 10)) != ULONG_MAX
      |           ~~
./getaddrinfo.c:1875:13: note: initialize the variable 'endp' to silence this warning
 1875 |   char *endp;
      |             ^
      |              = NULL

This fixes BZ #32465.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 07:48:29 +08:00
gfleury
f646be6ff6 htl: move pthread_cond_timedwait, pthread_cond_clockwait, pthread_cond_wait into libc.
Message-ID: <20241219203727.669825-9-gfleury@disroot.org>
2024-12-22 23:37:30 +01:00
gfleury
ba8522542f htl: move __pthread_mutex_checklocked into libc.
move out __getpid from pt-mutex.h
and in pt-mutex-* include <unistd.h> where
__getpid was called

Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-8-gfleury@disroot.org>
2024-12-22 23:34:28 +01:00
gfleury
a369d567d2 htl: move __pthread_timedblock, __pthread_timedblock_intr, __pthread_block, __pthread_block_intr into libc.
Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-7-gfleury@disroot.org>
2024-12-22 23:34:28 +01:00
gfleury
f57a277c16 htl: move pthread_cond_signal into libc.
Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-6-gfleury@disroot.org>
2024-12-22 23:34:28 +01:00
gfleury
3089d23517 htl: move pthread_cond_broadcast into libc.
Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-5-gfleury@disroot.org>
2024-12-22 23:34:27 +01:00
gfleury
917a131ab9 htl: move pthread_cond_destroy into libc.
Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-4-gfleury@disroot.org>
2024-12-22 23:34:27 +01:00
gfleury
4ab765c6ba htl: move __pthread_wakeup into libc.
Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-3-gfleury@disroot.org>
2024-12-22 23:34:27 +01:00
gfleury
8735ea79ab htl: move pthread_cond_init into libc.
Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-2-gfleury@disroot.org>
2024-12-22 23:34:27 +01:00
Samuel Thibault
fd30525ead assert/test-assert-2.c: Include <unistd.h>
For _exit declaration.
2024-12-22 23:34:27 +01:00
H.J. Lu
9306aef356 stdio-common: Suppress Clang warnings on scanf13.c
Suppress Clang warnings on stdio-common/scanf13.c:

1. Before this commit:

scanf13.c:43:17: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
   43 |               "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4)
      |                    ~~~~^
scanf13.c:43:22: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
   43 |               "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4)
      |                         ~~~~^
scanf13.c:43:50: error: data argument not used by format string [-Werror,-Wformat-extra-args]
   43 |               "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~                ^
scanf13.c:145:27: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  145 |   if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2)
      |                     ~~~~~~^
scanf13.c:145:31: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  145 |   if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2)
      |                            ~~~^
scanf13.c:145:43: error: data argument not used by format string [-Werror,-Wformat-extra-args]
  145 |   if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2)
      |                    ~~~~~~~~~~~~~~         ^
scanf13.c:161:31: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  161 |   if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc",
      |                         ~~~~~~^
scanf13.c:161:42: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  161 |   if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc",
      |                                ~~~~~~~~~~^
scanf13.c:161:53: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  161 |   if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc",
      |                                           ~~~~~~~~~~^
scanf13.c:162:15: error: data argument not used by format string [-Werror,-Wformat-extra-args]
  161 |   if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc",
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  162 |               &lsp1, &lsp2, &lsp3, &lsp4) != 4)
      |                      ^
10 errors generated.

2. With DIAG_IGNORE_NEEDS_COMMENT_CLANG changes in stdio-common/scanf13.c:

scanf13.c:28:40: error: 'sscanf' may overflow; destination buffer in argument 4 has size 8, but the corresponding specifier may require size 11 [-Werror,-Wfortify-source]
   28 |               "A%ms%10ms%4m[bcd]%4mcB", &sp1, &sp2, &sp3, &sp4) != 4)
      |                                               ^
scanf13.c:94:34: error: 'sscanf' may overflow; destination buffer in argument 3 has size 8, but the corresponding specifier may require size 2049 [-Werror,-Wfortify-source]
   94 |   if (sscanf (buf, "%2048ms%mc", &sp3, &sp4) != 2)
      |                                  ^
scanf13.c:110:61: error: 'sscanf' may overflow; destination buffer in argument 4 has size 8, but the corresponding specifier may require size 1501 [-Werror,-Wfortify-source]
  110 |   if (sscanf (buf, "%4mc%1500m[dr/]%548m[abc/d]%3mc", &sp1, &sp2, &sp3, &sp4)
      |                                                             ^
scanf13.c:110:67: error: 'sscanf' may overflow; destination buffer in argument 5 has size 8, but the corresponding specifier may require size 549 [-Werror,-Wfortify-source]
  110 |   if (sscanf (buf, "%4mc%1500m[dr/]%548m[abc/d]%3mc", &sp1, &sp2, &sp3, &sp4)
      |                                                                   ^
4 errors generated.

Co-Authored-By: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 06:29:37 +08:00
H.J. Lu
31c47126f4 string: Suppress Clang warnings on tester.c
Add a configure check for -Wno-fortify-source to suppress Clang warnings
on string/tester.c, like:

tester.c:385:10: error: 'strncat' size argument is too large; destination buffer has size 50, but size argument is 99 [-Werror,-Wfortify-source]
  385 |   check (strncat (one, "lmn", 99) == one, 1);   /* Returned value. */

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 06:28:55 +08:00
H.J. Lu
cb74bafbb5 Add a reference to Clang /usr/include/tgmath.h dependency
The fake Clang /usr/include/tgmath.h dependency bug is:

https://github.com/llvm/llvm-project/issues/120891

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 06:28:55 +08:00
H.J. Lu
0813cb5847 Suppress Clang -Wimplicit-fallthrough warnings
Since Clang doesn't properly handle

/* FALLTHROUGH */

in elf/tst-align2.c nor

/* fall through */

in misc/tst-tsearch.c

tst-align2.c💯9: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
  100 |         case 'A':
      |         ^
tst-align2.c💯9: note: insert '__attribute__((fallthrough));' to silence this warning
  100 |         case 'A':
      |         ^
      |         __attribute__((fallthrough));
tst-align2.c💯9: note: insert 'break;' to avoid fall-through
  100 |         case 'A':
      |         ^
      |         break;

suppress them when compiled with Clang.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 06:28:55 +08:00
Adhemerval Zanella
309225af54 stdio: Suppress -Wformat only for gcc in tst-sprintf-errno.c
Since Clang doesn't support

DIAG_IGNORE_NEEDS_COMMENT (11, "-Wformat=");

and for unknown reasons, it doesn't warn the %#m specifier, suppress
-Wformat only for gcc in tst-sprintf-errno.c.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 06:28:55 +08:00
Adhemerval Zanella
a2b0ff98a0 include/sys/cdefs.h: Add __attribute_optimization_barrier__
Add __attribute_optimization_barrier__ to disable inlining and cloning on a
function.  For Clang, expand it to

__attribute__ ((optnone))

Otherwise, expand it to

__attribute__ ((noinline, clone))

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 06:28:55 +08:00
DJ Delorie
3fb895ac88 assert: Use __writev in assert.c [BZ #32492]
Replace writev with __writev in assert/assert.c.  This fixes [BZ #32492].

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2024-12-23 06:03:01 +08:00
H.J. Lu
b587e7d45c Fix build without stack protector [BZ #32494]
Without stack protector, inhibit_stack_protector is undefined during build:

In file included from <command-line>:
./../include/libc-symbols.h:665:3: error: expected ';' before '__typeof'
  665 |   __typeof (type_name) *name##_ifunc (__VA_ARGS__)
         \
      |   ^~~~~~~~
./../include/libc-symbols.h:676:3: note: in expansion of macro
'__ifunc_resolver'
  676 |   __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__)
      |   ^~~~~~~~~~~~~~~~
./../include/libc-symbols.h:703:3: note: in expansion of macro '__ifunc_args'
  703 |   __ifunc_args (type_name, name, expr, init, arg)
      |   ^~~~~~~~~~~~
./../include/libc-symbols.h:790:3: note: in expansion of macro '__ifunc'
  790 |   __ifunc (redirected_name, name, expr, void, INIT_ARCH)
      |   ^~~~~~~
../sysdeps/x86_64/multiarch/memchr.c:29:1: note: in expansion of macro
'libc_ifunc_redirected'
   29 | libc_ifunc_redirected (__redirect_memchr, memchr, IFUNC_SELECTOR ());
      | ^~~~~~~~~~~~~~~~~~~~~

1. Fix a typo in include/libc-symbols.h to define inhibit_stack_protector
for build.
2. Don't include <config.h> in include/libc-symbols.h since it has been
included in include/libc-misc.h.
3. Change #include "libc-misc.h" to #include <libc-misc.h> in
string/test-string.h.

This fixes BZ #32494.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 04:51:30 +08:00
Adhemerval Zanella
2271e0d2b6 Check if TEST_CC supports -Wno-restrict before using it
Check if TEST_CC supports -Wno-restrict before using it to avoid Clang
error:

error: unknown warning option '-Wno-restrict' [-Werror,-Wunknown-warning-option]

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-23 04:32:51 +08:00
John David Anglin
325db5ab7f hppa: Simplify handling of sanity check errors in clone.S.
This simplifies the handling of sanity check errors in clone.S.
Adjusted a couple of comments to reflect current code.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
2024-12-22 09:58:02 -05:00
John David Anglin
9bdb1487c5 hppa: add cacheflush() syscall wrapper
The hppa Linux kernel supports the cacheflush() syscall
since version 6.5. This adds the glibc syscall wrapper.

Signed-off-by: Helge Deller <deller@gmx.de>

---
v2: This patch was too late in release cycle for GLIBC_2.40,
    so update now to GLIBC_2.41 instead.
2024-12-22 09:51:54 -05:00
John David Anglin
4b37fb71e0 hppa: Update libm-test-ulps
Signed-off-by: John David Anglin <dave.anglin@bell.net>
2024-12-22 09:45:34 -05:00
Samuel Thibault
faa0c883f6 hurd: make mprotect translate KERN_PROTECTION_FAILURE to EACCESS
Suggested-by: Sergey Bugaev <bugaevc@gmail.com>
2024-12-22 11:40:24 +01:00
H.J. Lu
39a3b5c8f6 Compile tst-deadline.c with -Wno-ignored-attributes for Clang
Since tst-deadline.c is an internal test, compile tst-deadline.c with
-Wno-ignored-attributes for Clang to silence -Werror,-Wunknown-attributes
errors.  Also suppress -Wmaybe-uninitialized only for GCC in net-internal.h.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:49:22 +08:00
Adhemerval Zanella
5b9bc1a172 malloc: Only enable -Waggressive-loop-optimizations suppression for gcc
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:47:52 +08:00
H.J. Lu
b5bdef46cc Suppress -Wmaybe-uninitialized only for GCC
Clang doesn't support -Wmaybe-uninitialized.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:46:56 +08:00
H.J. Lu
daf47b66df Suppress Clang -Wgnu-folding-constant warnings
Suppress Clang -Wgnu-folding-constant warnings, like

tst-freopen.c:44:13: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
   44 |   char temp[strlen (test) + 1];
      |             ^~~~~~~~~~~~~~~~~

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:45:56 +08:00
Adhemerval Zanella
601b3d5db2 stdio: Suppress clang warnings for tst-vprintf-width-i18n.c
Clang issues the following warning:

  tst-vfprintf-width-i18n.c:51:34: error: invalid conversion specifier '1'
  [-Werror,-Wformat-invalid-specifier]
    TEST_COMPARE (sprintf (buf, "%I16d", 12345), 16);
                                 ~~^

since it does not how to handle %I.
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:45:24 +08:00
Adhemerval Zanella
f6cf084155 stdio: Fix clang warnings on tests
clang does not support 'I' specifier and handles it as a 'length
modifier'.
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:43:11 +08:00
Adhemerval Zanella
03962d17c9 math: Fix clang warnings for math/test-tgmath-ret.c
clang warns that since the global variables are only used to function
calls (without being actually used), they are not needed and will
not be emitted.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:40:33 +08:00
Adhemerval Zanella
27a4b6421f Suppress Clang warning on adding an integer to a string
Suppress Clang warning on adding an integer to a string, like:

tst-iconv-sticky-input-error.c:125:42: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
  125 |                 expected_output = "ABXY" + skip;
      |                                   ~~~~~~~^~~~~~
tst-iconv-sticky-input-error.c:125:42: note: use array indexing to silence this warning
  125 |                 expected_output = "ABXY" + skip;
      |                                          ^
      |                                   &      [     ]

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:35:33 +08:00
Adhemerval Zanella
77c1128bd3 stdio: Suppress %Z format for clang
clang does not handle %Z on print, and just suppressing
-Wformat-invalid-specifier might trigger another warning for extra
arguments (since %Z is ignored).  So suppress -Wformat-extra-args
as well.

For tst-fphex.c a heavy hammer is used since the printf is more
complex and clang throws a more generic warning.
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:29:28 +08:00
Adhemerval Zanella
69c181f2b3 stdio: Suppress clang warnings for tst-unlockedio.c
Suppress the following -Wgnu-folding-constant and -Wliteral-conversion
warnings from Clang:

  tst-unlockedio.c:35:12: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
   35 |   char buf[strlen (blah) + 1];
      |            ^~~~~~~~~~~~~~~~~

  tst-unlockedio.c:63:36: error: implicit conversion from 'double' to
  'size_t' (aka 'unsigned long') changes value from -0 to 0
  [-Werror,-Wliteral-conversion]
        || fwrite_unlocked (blah, 0, -0.0, fp) != 0
           ~~~~~~~~~~~~~~~           ^~~~
  tst-unlockedio.c:61:33: error: implicit conversion from 'double' to
  'size_t' (aka 'unsigned long') changes value from 0.25 to 0
  [-Werror,-Wliteral-conversion]
        || fwrite_unlocked (--cp, 0.25, 16, fp) != 0
           ~~~~~~~~~~~~~~~        ^~~~
  tst-unlockedio.c:59:37: error: implicit conversion from 'double' to
  'size_t' (aka 'unsigned long') changes value from 0.25 to 0
  [-Werror,-Wliteral-conversion]
        || fwrite_unlocked (cp++, 16, 0.25, fp) != 0
           ~~~~~~~~~~~~~~~            ^~~~
  tst-unlockedio.c:116:34: error: implicit conversion from 'double' to
  'size_t' (aka 'unsigned long') changes value from -0 to 0
  [-Werror,-Wliteral-conversion]
        || fread_unlocked (buf, 0, -0.0, fp) != 0
           ~~~~~~~~~~~~~~          ^~~~
  tst-unlockedio.c:114:32: error: implicit conversion from 'double' to
  'size_t' (aka 'unsigned long') changes value from 0.25 to 0
  [-Werror,-Wliteral-conversion]
        || fread_unlocked (--wp, 0.25, 16, fp) != 0
           ~~~~~~~~~~~~~~        ^~~~
  tst-unlockedio.c:112:36: error: implicit conversion from 'double' to
  'size_t' (aka 'unsigned long') changes value from 0.25 to 0
  [-Werror,-Wliteral-conversion]
        || fread_unlocked (wp++, 16, 0.25, fp) != 0
           ~~~~~~~~~~~~~~            ^~~~

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:27:35 +08:00
Adhemerval Zanella
cdcd551d82 localedata: Fix clang warnings on tests
clang does not support 'I' specifier and handles it as a 'length
modifier'.
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:26:19 +08:00
Adhemerval Zanella
46a813466e elf: Suppress clang warning on tst-unique4
clang warns that the instantiation of the variable is required,
but no definition is available.  They are implemented on
tst-unique4lib.so.

Checked on x86_64-linux-gnu.
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:24:16 +08:00
H.J. Lu
8d25b9f2c8 elf: Enable tst-dlopen-nodelete-reloc if TEST_CXX supports STB_GNU_UNIQUE
tst-dlopen-nodelete-reloc requires STB_GNU_UNIQUE support so that NODELETE
is propagated by do_lookup_unique.  Enable it only if TEST_CXX supports
STB_GNU_UNIQUE,

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 17:20:15 +08:00
H.J. Lu
bce70034b1 elf: Check PDE load address with non-empty text section
Check PDE load address with non-empty text section:

.globl _start
_start:
.globl __start
	.byte 0

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 16:16:45 +08:00
Fangrui Song
d773aff467 x86: Define __HAVE_FLOAT128 for Clang and use __builtin_*f128 code path
Clang supports __builtin_fabsf128 (despite not supporting _Float128) but
it does not support __builtin_fabsq.  Fallback to back to
`typedef __float128 _Float128;` it clang is used.

Originally developed by Fangrui Song <maskray@google.com>.
Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 16:07:11 +08:00
Adhemerval Zanella
b2556550a0 Add clang specific warning suppression macros
Four new macros are added:

  * DIAG_{PUSH,POP}_NEEDS_COMMENT_CLANG are similar to
    DIAG_{PUSH,POP}_NEEDS_COMMENT, but enable clang specific pragmas to
    handle warnings for options only supported by clang.

  * DIAG_IGNORE_NEEDS_COMMENT_{CLANG,GCC} are similar to
    DIAG_IGNORE_NEEDS_COMMENT, but enable the warning suppression only
    for the referenced compiler.

Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 13:29:20 +08:00
Adhemerval Zanella
6412d8cc46 x86: Use inhibit_stack_protector on tst-ifunc-isa.h
Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 13:19:12 +08:00
H.J. Lu
03feea74dc elf: Compile test modules with -fsemantic-interposition
Compiler may default to -fno-semantic-interposition. But some elf test
modules must be compiled with -fsemantic-interposition to function properly.
Add a TEST_CC check for -fsemantic-interposition and use it on elf test
modules.  This fixed

FAIL: elf/tst-dlclose-lazy
FAIL: elf/tst-pie1
FAIL: elf/tst-plt-rewrite1
FAIL: elf/unload4

when Clang 19 is used to test glibc.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 13:15:43 +08:00
Adhemerval Zanella
d085db5b57 tst-printf-bz18872.sh: stdio: Use __attribute__ ((optnone)) for Clang
Use

__attribute__ ((optnone))

instead of

__attribute__ ((optimize ("-O0")))

to disable optimization for Clang.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 13:08:51 +08:00
Adhemerval Zanella
a69a0bb619 Handle pragma GCC optimize for clang
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 13:07:27 +08:00
Adhemerval Zanella
799e686c88 dirent: Remove variable length array structure for tst-getdents64.c
Clang emits the following warnings:

  ../sysdeps/unix/sysv/linux/tst-getdents64.c:111:18: error: fields must
  have a constant size: 'variable length array in structure' extension
  will never be supported
              char buffer[buffer_size];
                   ^

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 13:06:02 +08:00
H.J. Lu
494eb254c3 Add include/libc-misc.h
Add include/libc-misc.h to provide miscellaneous definitions for both
glibc build and test:

1. Move inhibit_stack_protector to libc-misc.h and add Clang support.
2. Add test_inhibit_stack_protector for glibc testing.
3. Move inhibit_loop_to_libcall to libc-misc.h.
4. Add test_cc_inhibit_loop_to_libcall to handle TEST_CC != CC and
replace inhibit_loop_to_libcall with test_cc_inhibit_loop_to_libcall
in glibc tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-Authored-By: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 13:03:46 +08:00
H.J. Lu
56cdc529fb Add test-config-cflags-float-store for -ffloat-store
Clang doesn't support -ffloat-store:

clang: error: optimization flag '-ffloat-store' is not supported [-Werror,-Wignored-optimization-argument]

Define test-config-cflags-float-store for -ffloat-store and use it in
math/Makefile for testing.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 13:02:30 +08:00
Adhemerval Zanella
90edd56c01 localedata: Use hexadecimal character escape on tests
Instead of latin1 ones.

Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 13:01:08 +08:00
H.J. Lu
e5a5229868 tst-atomic.c: Mark as UNSUPPORTED when compiled with Clang
Since Clang can't remove the dead statement and issues an error:

tst-atomic.c:463:7: error: unsupported inline asm: input with type 'int64_t' (aka 'long') matching output with type 'typeof (*&mem)' (aka 'int')
  463 |   if (catomic_exchange_and_add (&mem, 11) != 2
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/x86/atomic-machine.h:213:3: note: expanded from macro 'catomic_exchange_and_add'
  213 |   __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, __arch_c,    \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  214 |                                 mem, value)
      |                                 ~~~~~~~~~~~
../sysdeps/x86/atomic-machine.h:199:12: note: expanded from macro '__arch_exchange_and_add_body'
  198 |                          : "=r" (__result), "=m" (*mem)                       \
      |                                  ~~~~~~~~
  199 |                          : "0" ((int64_t) cast_to_integer (__addval)),     \
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tst-atomic.c:487:7: error: unsupported inline asm: input with type 'int64_t' (aka 'long') matching output with type 'typeof (*(&mem))' (aka 'int')
  487 |   if (catomic_increment_val (&mem) != 3)
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/atomic.h:313:38: note: expanded from macro 'catomic_increment_val'
  313 | # define catomic_increment_val(mem) (catomic_exchange_and_add ((mem), 1) + 1)
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/x86/atomic-machine.h:213:3: note: expanded from macro 'catomic_exchange_and_add'
  213 |   __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, __arch_c,    \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  214 |                                 mem, value)
      |                                 ~~~~~~~~~~~
../sysdeps/x86/atomic-machine.h:199:12: note: expanded from macro '__arch_exchange_and_add_body'
  198 |                          : "=r" (__result), "=m" (*mem)                       \
      |                                  ~~~~~~~~
  199 |                          : "0" ((int64_t) cast_to_integer (__addval)),     \
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tst-atomic.c:501:7: error: unsupported inline asm: input with type 'int64_t' (aka 'long') matching output with type 'typeof (*(&mem))' (aka 'int')
  501 |   if (catomic_decrement_val (&mem) != 15)
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/atomic.h:340:38: note: expanded from macro 'catomic_decrement_val'
  340 | # define catomic_decrement_val(mem) (catomic_exchange_and_add ((mem), -1) - 1)
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/x86/atomic-machine.h:213:3: note: expanded from macro 'catomic_exchange_and_add'
  213 |   __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, __arch_c,    \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  214 |                                 mem, value)
      |                                 ~~~~~~~~~~~
../sysdeps/x86/atomic-machine.h:199:12: note: expanded from macro '__arch_exchange_and_add_body'
  198 |                          : "=r" (__result), "=m" (*mem)                       \
      |                                  ~~~~~~~~
  199 |                          : "0" ((int64_t) cast_to_integer (__addval)),     \
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

mark tst-atomic.c as UNSUPPORTED when compiled with Clang.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 12:56:49 +08:00
H.J. Lu
d9d30f6cb5 Enable execstack tests only if compiler supports trampoline
Since trampoline is required to test execstack, enable execstack tests
only if compiler supports trampoline.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-22 12:55:50 +08:00