[PATCH 00/39] Compile glibc tests with Clang

H.J. Lu hjl.tools@gmail.com
Sun Dec 22 00:04:23 GMT 2024


This patch set, some of patches are from azanella/clang branch with and
without modifications, allows compiling glibc tests with Clang.  Some
tests are disabled for Clang:

1. Tests require glibc <tgmath.h>.
2. Tests require C23 support.
3. Tests require libmvec ABI support.
4. Tests require trampoline.
5. Tests require STB_GNU_UNIQUE.
6. X86-64 tests require -mfpmath=387.

The goal is to compile glibc tests without any compile-time errors using
Clang 19.  It isn't a goal to compile glibc tests without any run-time
errors using Clang 19.  The current known Clang failures are:

FAIL: conform/ISO11/inttypes.h/conform
FAIL: conform/ISO11/stdint.h/conform
FAIL: conform/ISO11/tgmath.h/conform
FAIL: conform/ISO99/inttypes.h/conform
FAIL: conform/ISO99/stdint.h/conform
FAIL: conform/ISO99/tgmath.h/conform
FAIL: conform/POSIX2008/inttypes.h/conform
FAIL: conform/POSIX2008/stdint.h/conform
FAIL: conform/POSIX2008/tgmath.h/conform
FAIL: conform/XOPEN2K/inttypes.h/conform
FAIL: conform/XOPEN2K/stdint.h/conform
FAIL: conform/XOPEN2K/tgmath.h/conform
FAIL: conform/XOPEN2K8/inttypes.h/conform
FAIL: conform/XOPEN2K8/stdint.h/conform
FAIL: conform/XOPEN2K8/tgmath.h/conform
FAIL: elf/ifuncmain1static
FAIL: elf/ifuncmain4
FAIL: elf/ifuncmain4static
FAIL: elf/ifuncmain6pie
FAIL: elf/ifuncmain7
FAIL: elf/ifuncmain7pic
FAIL: elf/ifuncmain7picstatic
FAIL: elf/ifuncmain7pie
FAIL: elf/ifuncmain7static
FAIL: math/test-float128-isgreater
FAIL: math/test-float128-isgreaterequal
FAIL: math/test-float128-isless
FAIL: math/test-float128-islessequal
FAIL: math/test-float64x-fpclassify
FAIL: math/test-ldouble-fpclassify
FAIL: math/test-tgmath
FAIL: math/test-tgmath2
FAIL: stdio-common/tst-vfprintf-user-type

Adhemerval Zanella (22):
  conform: Use -dD instead of -dN on compiler invocation
  localedata: Use hexadecimal character escape on tests
  dirent: Remove variable lenght array structure for tst-getdents64.c
  Handle pragma GCC optimize for clang
  tst-printf-bz18872.sh: stdio: Use __attribute__ ((optnone)) for Clang
  And defines to __attribute__ (__noclone__) iff compiler supports it.
  x86: Use inhibit_stack_protector on tst-ifunc-isa.h
  debug: Avoid clang optimize away required function on tst-ssp1.c
  Add clang specific warnings suppress macros
  elf: Suppress clang warning on tst-unique4
  localedata: Fix clang warnings on tests
  stdio: Suppress clang warnings for tst-unlockedio.c
  stdio: Suppress %Z format for clang
  Check if TEST_CC supports -Wno-restrict before using it
  Suppress Clang warning on adding an integer to a string
  math: Fix clang warnings for math/test-tgmath-ret.c
  stdio: Disable clang warning on scanf13 test
  string: Suppress clang -Wfortify-source warning on tester.c
  stdio: Fix clang warnings on tests
  stdio: Suppress -Wformat only for gcc for tst-sprintf-errno.c
  stdio: Suppress clang warnings for tst-vprintf-width-i18n.c
  malloc: Only enable -Waggressive-loop-optimizations suppression for
    gcc

Fangrui Song (1):
  x86: Define __HAVE_FLOAT128 for Clang and use __builtin_*f128 code
    path

H.J. Lu (16):
  Use -finput-charset=ascii only if supported
  Check Clang 12 for __builtin_complex
  Don't redefine INFINITY nor NAN
  Remove Clang /usr/include/tgmath.h dependency
  x86-64: Disable libmvec ABI test for Clang
  x86: Include test-flt-eval-method-387 if -mfpmath=387 works
  Enable execstack tests only if compiler supports trampoline
  tst-atomic.c: Mark as UNSUPPORTED when compiled with Clang
  Add test-config-cflags-float-store for -ffloat-store
  Add include/libc-misc.h
  elf: Compile test modules with -fsemantic-interposition
  elf: Enable tst-dlopen-nodelete-reloc if TEST_CXX supports
    STB_GNU_UNIQUE
  Suppress Clang -Wgnu-folding-constant warnings
  Suppress -Wmaybe-uninitialized only for GCC
  Suppress Clang -Wimplicit-fallthrough warnings
  Compile tst-deadline.c with -Wno-ignored-attributes for Clang

 Makefile                                      |   6 +-
 Makerules                                     |   6 +-
 Rules                                         |   6 +-
 aclocal.m4                                    |  29 ++
 benchtests/bench-hash-funcs-kernel.h          |   4 +-
 benchtests/bench-hash-funcs.c                 |   2 +-
 benchtests/bench-strchr.c                     |   4 +-
 config.h.in                                   |  11 +-
 configure                                     | 383 +++++++++++++++++-
 configure.ac                                  | 147 ++++++-
 conform/conformtest.py                        |   6 +-
 debug/tst-backtrace.h                         |   2 +-
 debug/tst-ssp-1.c                             |   6 +-
 dirent/tst-readdir-long.c                     |   4 +
 dirent/tst-rewinddir.c                        |   4 +
 elf/Makefile                                  |  46 ++-
 elf/tst-align2.c                              |   4 +
 elf/tst-p_alignmod-base.c                     |   2 +-
 elf/tst-unique4.cc                            |   6 +
 elf/tst-unique4lib.cc                         |   2 +-
 gmon/tst-gmon.c                               |   8 +-
 gmon/tst-mcount-overflow.c                    |  10 +-
 iconv/tst-iconv-sticky-input-error.c          |   4 +
 include/libc-diag.h                           |  22 +
 include/libc-misc.h                           |  67 +++
 include/libc-symbols.h                        |  21 +-
 inet/Makefile                                 |   4 +
 inet/net-internal.h                           |   2 +-
 libio/Makefile                                |   6 +-
 libio/tst-bz24051.c                           |   6 +-
 libio/tst-bz24153.c                           |   6 +-
 libio/tst-freopen.c                           |   4 +
 libio/tst-mmap-setvbuf.c                      |   4 +
 localedata/bug-iconv-trans.c                  |   2 +-
 localedata/tests-mbwc/dat_mbrtowc.c           |  12 +-
 localedata/tests-mbwc/dat_mbsrtowcs.c         |  12 +-
 localedata/tests-mbwc/dat_strcoll.c           |  13 +-
 localedata/tests-mbwc/dat_swscanf.c           |   2 +-
 localedata/tests-mbwc/dat_wcrtomb.c           |   4 +-
 localedata/tests-mbwc/dat_wcsrtombs.c         |  10 +-
 localedata/tests-mbwc/dat_wcstombs.c          |  10 +-
 localedata/tests-mbwc/dat_wctomb.c            |   4 +-
 localedata/tst-trans.c                        |   8 +-
 localedata/tst-xlocale1.c                     |   4 +-
 localedata/tst-xlocale2.c                     |   2 +-
 malloc/tst-dynarray.c                         |   4 +-
 malloc/tst-malloc-thread-exit.c               |   2 +-
 malloc/tst-malloc-thread-fail.c               |   2 +-
 malloc/tst-mallocstate.c                      |   2 +-
 math/Makefile                                 |   6 +-
 math/complex.h                                |   3 +-
 math/math.h                                   |  20 +-
 math/test-tgmath-ret.c                        |   6 +
 misc/sys/cdefs.h                              |   7 +
 misc/tst-atomic.c                             |  10 +
 misc/tst-syscalls.c                           |  14 +-
 misc/tst-tsearch.c                            |   4 +
 nptl/Makefile                                 |   9 +-
 nptl/tst-minstack-throw.cc                    |   8 +-
 nptl/tst-thread-exit-clobber.cc               |  12 +-
 nptl/tst-thread-setspecific.c                 |   2 +-
 nptl/tst-thread_local1.cc                     |  12 +-
 posix/bug-regex24.c                           |   4 +
 scripts/check-installed-headers.sh            |   3 +-
 stdio-common/bug1.c                           |  11 +
 stdio-common/bug5.c                           |   6 +
 stdio-common/scanf13.c                        |  15 +
 stdio-common/test_rdwr.c                      |   7 +
 stdio-common/tst-fphex.c                      |   5 +
 stdio-common/tst-printf-bz18872.sh            |   4 +
 stdio-common/tst-scanf-to_inpunct.c           |   5 +
 stdio-common/tst-sprintf-errno.c              |   2 +-
 stdio-common/tst-unlockedio.c                 |   7 +
 stdio-common/tst-vfprintf-width-i18n.c        |   8 +
 stdio-common/tstgetln.c                       |   6 +
 stdlib/tst-makecontext-align.c                |  20 +-
 stdlib/tst-quick_exit.cc                      |   2 +-
 stdlib/tst-setcontext10.c                     |   6 +-
 stdlib/tst-setcontext11.c                     |   2 +-
 stdlib/tst-setcontext5.c                      |   4 +-
 stdlib/tst-setcontext8.c                      |   2 +-
 stdlib/tst-setcontext9.c                      |   2 +-
 stdlib/tst-swapcontext1.c                     |   8 +-
 stdlib/tst-swapcontext2.c                     |   8 +-
 stdlib/tst-thread-quick_exit.cc               |   2 +-
 string/test-memmove.c                         |   2 +-
 string/test-memset.c                          |   2 +-
 string/test-string.h                          |  11 +-
 string/tester.c                               |  26 ++
 string/tst-xbzero-opt.c                       |   3 +-
 sysdeps/generic/tst-stack-align.h             |   2 +-
 sysdeps/unix/sysv/linux/tst-getdents64.c      |  18 +-
 .../sysv/linux/x86_64/tst-cet-property-2.c    |   2 +-
 .../sysv/linux/x86_64/tst-cet-setcontext-1.c  |   2 +-
 .../unix/sysv/linux/x86_64/tst-cet-vfork-1.c  |   2 +-
 .../sysv/linux/x86_64/tst-gnu2-tls2-amx.c     |   2 +-
 sysdeps/x86/bits/floatn.h                     |  24 +-
 sysdeps/x86/configure                         |  34 ++
 sysdeps/x86/configure.ac                      |  10 +
 sysdeps/x86/fpu/Makefile                      |   4 +-
 sysdeps/x86/tst-ifunc-isa.h                   |   5 +-
 sysdeps/x86/tst-ldbl-nonnormal-printf.c       |   2 +-
 sysdeps/x86/tst-memchr-rtm.c                  |   4 +-
 sysdeps/x86/tst-memcmp-rtm.c                  |   4 +-
 sysdeps/x86/tst-memmove-rtm.c                 |   4 +-
 sysdeps/x86/tst-memrchr-rtm.c                 |   4 +-
 sysdeps/x86/tst-memset-rtm.c                  |   4 +-
 sysdeps/x86/tst-strchr-rtm.c                  |   4 +-
 sysdeps/x86/tst-strcmp-rtm.c                  |   4 +-
 sysdeps/x86/tst-strcpy-rtm.c                  |   4 +-
 sysdeps/x86/tst-strlen-rtm.c                  |   4 +-
 sysdeps/x86/tst-strncmp-rtm.c                 |   8 +-
 sysdeps/x86/tst-strrchr-rtm.c                 |   4 +-
 sysdeps/x86_64/Makefile                       |   3 +
 sysdeps/x86_64/fpu/Makefile                   |   3 +
 sysdeps/x86_64/tst-rsi-strlen.c               |   2 +-
 116 files changed, 1131 insertions(+), 265 deletions(-)
 create mode 100644 include/libc-misc.h

-- 
2.47.1



More information about the Libc-alpha mailing list