[PATCH] math: Fix x86_64 build for -Os (BZ 33367)
Sam James
sam@gentoo.org
Mon Sep 8 22:56:58 GMT 2025
"H.J. Lu" <hjl.tools@gmail.com> writes:
> On Mon, Sep 8, 2025 at 2:05 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>> On Mon, Sep 8, 2025 at 2:01 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>> >
>
>> >
>>
>> My GCC patch:
>>
>> https://patchwork.sourceware.org/project/gcc/list/?series=51782
>>
>> I am testing this:
>>
>> diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile
>> b/sysdeps/x86_64/fpu/multiarch/Makefile
>> index 708b14297f..0b2caac7a0 100644
>> --- a/sysdeps/x86_64/fpu/multiarch/Makefile
>> +++ b/sysdeps/x86_64/fpu/multiarch/Makefile
>> @@ -158,11 +158,14 @@ CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX
>> CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX
>> CFLAGS-s_sincos-avx.c = -msse2avx -DSSE2AVX
>>
>> -CFLAGS-s_modf-sse4_1.c = -msse4.1 -fno-builtin-modff32x -fno-builtin-modff64
>> -CFLAGS-s_modff-sse4_1.c = -msse4.1 -fno-builtin-modff32
>> +CFLAGS-s_modf-sse4_1.c = -msse4.1 -fno-builtin-modff32x \
>> + -fno-builtin-modff64 -fno-trapping-math
>> +CFLAGS-s_modff-sse4_1.c = -msse4.1 -fno-builtin-modff32 \
>> + -fno-trapping-math
>>
>> -CFLAGS-s_modf-avx.c = -mavx -fno-builtin-modff32x -fno-builtin-modff64
>> -CFLAGS-s_modff-avx.c = -mavx -fno-builtin-modff32
>> +CFLAGS-s_modf-avx.c = -mavx -fno-builtin-modff32x -fno-builtin-modff64 \
>> + -fno-trapping-math
>> +CFLAGS-s_modff-avx.c = -mavx -fno-builtin-modff32 -fno-trapping-math
>> endif
>>
>> ifeq ($(subdir),mathvec)
>>
>
> I got many failures:
>
> FAIL: ctype/tst-ctype-tls-dlopen-static
> FAIL: debug/tst-sprintf-fortify-rdonly-static
> FAIL: dlfcn/tststatic
> FAIL: dlfcn/tststatic2
> FAIL: dlfcn/tststatic3
> FAIL: dlfcn/tststatic4
> FAIL: dlfcn/tststatic5
> FAIL: elf/ifuncmain1picstatic
> FAIL: elf/ifuncmain1static
> FAIL: elf/ifuncmain2picstatic
> FAIL: elf/ifuncmain2static
> FAIL: elf/ifuncmain4picstatic
> FAIL: elf/ifuncmain4static
> FAIL: elf/ifuncmain5picstatic
> FAIL: elf/ifuncmain5static
> FAIL: elf/ifuncmain7picstatic
> FAIL: elf/ifuncmain7static
> FAIL: elf/ifuncmain9picstatic
> FAIL: elf/ifuncmain9static
> FAIL: elf/tst-array1-static
> FAIL: elf/tst-array1-static-cmp
> FAIL: elf/tst-array5-static
> FAIL: elf/tst-array5-static-cmp
> FAIL: elf/tst-bz15311
> FAIL: elf/tst-bz28937
> FAIL: elf/tst-cpu-features-cpuinfo-static
> FAIL: elf/tst-cpu-features-supports-static
> FAIL: elf/tst-dl-iter-static
> FAIL: elf/tst-dl-printf-static
> FAIL: elf/tst-dl_find_object-static
> FAIL: elf/tst-dlopen-sgid
> FAIL: elf/tst-dso-ordering-all2-0
> FAIL: elf/tst-dso-ordering-all3-0
> FAIL: elf/tst-dso-ordering-all3-1
> FAIL: elf/tst-dso-ordering-all3-2
> FAIL: elf/tst-dso-ordering-all3-3
> FAIL: elf/tst-dso-ordering-all4-0
> FAIL: elf/tst-dso-ordering-all4-1
> FAIL: elf/tst-dso-ordering-all4-10
> FAIL: elf/tst-dso-ordering-all4-11
> FAIL: elf/tst-dso-ordering-all4-12
> FAIL: elf/tst-dso-ordering-all4-13
> FAIL: elf/tst-dso-ordering-all4-14
> FAIL: elf/tst-dso-ordering-all4-15
> FAIL: elf/tst-dso-ordering-all4-16
> FAIL: elf/tst-dso-ordering-all4-17
> FAIL: elf/tst-dso-ordering-all4-18
> FAIL: elf/tst-dso-ordering-all4-19
> FAIL: elf/tst-dso-ordering-all4-2
> FAIL: elf/tst-dso-ordering-all4-20
> FAIL: elf/tst-dso-ordering-all4-21
> FAIL: elf/tst-dso-ordering-all4-22
> FAIL: elf/tst-dso-ordering-all4-23
> FAIL: elf/tst-dso-ordering-all4-24
> FAIL: elf/tst-dso-ordering-all4-25
> FAIL: elf/tst-dso-ordering-all4-26
> FAIL: elf/tst-dso-ordering-all4-27
> FAIL: elf/tst-dso-ordering-all4-28
> FAIL: elf/tst-dso-ordering-all4-29
> FAIL: elf/tst-dso-ordering-all4-3
> FAIL: elf/tst-dso-ordering-all4-30
> FAIL: elf/tst-dso-ordering-all4-31
> FAIL: elf/tst-dso-ordering-all4-32
> FAIL: elf/tst-dso-ordering-all4-33
> FAIL: elf/tst-dso-ordering-all4-34
> FAIL: elf/tst-dso-ordering-all4-35
> FAIL: elf/tst-dso-ordering-all4-36
> FAIL: elf/tst-dso-ordering-all4-37
> FAIL: elf/tst-dso-ordering-all4-38
> FAIL: elf/tst-dso-ordering-all4-39
> FAIL: elf/tst-dso-ordering-all4-4
> FAIL: elf/tst-dso-ordering-all4-40
> FAIL: elf/tst-dso-ordering-all4-41
> FAIL: elf/tst-dso-ordering-all4-42
> FAIL: elf/tst-dso-ordering-all4-43
> FAIL: elf/tst-dso-ordering-all4-44
> FAIL: elf/tst-dso-ordering-all4-45
> FAIL: elf/tst-dso-ordering-all4-46
> FAIL: elf/tst-dso-ordering-all4-47
> FAIL: elf/tst-dso-ordering-all4-48
> FAIL: elf/tst-dso-ordering-all4-49
> FAIL: elf/tst-dso-ordering-all4-5
> FAIL: elf/tst-dso-ordering-all4-50
> FAIL: elf/tst-dso-ordering-all4-51
> FAIL: elf/tst-dso-ordering-all4-52
> FAIL: elf/tst-dso-ordering-all4-53
> FAIL: elf/tst-dso-ordering-all4-54
> FAIL: elf/tst-dso-ordering-all4-55
> FAIL: elf/tst-dso-ordering-all4-56
> FAIL: elf/tst-dso-ordering-all4-6
> FAIL: elf/tst-dso-ordering-all4-7
> FAIL: elf/tst-dso-ordering-all4-8
> FAIL: elf/tst-dso-ordering-all4-9
> FAIL: elf/tst-dso-ordering1
> FAIL: elf/tst-dso-ordering10
> FAIL: elf/tst-dso-ordering2
> FAIL: elf/tst-dso-ordering3
> FAIL: elf/tst-dso-ordering4
> FAIL: elf/tst-dso-ordering5
> FAIL: elf/tst-dso-ordering6
> FAIL: elf/tst-dso-ordering7
> FAIL: elf/tst-dso-ordering8
> FAIL: elf/tst-dso-ordering9
> FAIL: elf/tst-dst-static
> FAIL: elf/tst-env-setuid-static
> FAIL: elf/tst-env-setuid-tunables
> FAIL: elf/tst-execstack-prog-static
> FAIL: elf/tst-execstack-prog-static-noexecstack
> FAIL: elf/tst-execstack-prog-static-tunable
> FAIL: elf/tst-get-cpu-features-static
> FAIL: elf/tst-getauxval-static
> FAIL: elf/tst-ldconfig-X
> FAIL: elf/tst-ldconfig-bad-aux-cache
> FAIL: elf/tst-ldconfig-ld_so_conf-update
> FAIL: elf/tst-ldconfig-p
> FAIL: elf/tst-ldconfig-soname
> FAIL: elf/tst-linkall-static
> FAIL: elf/tst-pie-address-static
> FAIL: elf/tst-pie-bss-static
> FAIL: elf/tst-ptrguard1-static
> FAIL: elf/tst-rtld-run-static
> FAIL: elf/tst-single_threaded-pthread-static
> FAIL: elf/tst-single_threaded-static
> FAIL: elf/tst-single_threaded-static-dlopen
> FAIL: elf/tst-stackguard1-static
> FAIL: elf/tst-tls-allocation-failure-static
> FAIL: elf/tst-tls-allocation-failure-static-patched
> FAIL: elf/tst-tls1-static
> FAIL: elf/tst-tls1-static-non-pie
> FAIL: elf/tst-tls9-static
> FAIL: elf/tst-tlsalign-extern-static
> FAIL: elf/tst-tlsalign-static
> FAIL: elf/tst-tunables
> FAIL: elf/tst-tunables-enable_secure
> FAIL: gmon/tst-gmon-static
> FAIL: gmon/tst-gmon-static-gprof
> FAIL: gmon/tst-gmon-static-pie
> FAIL: gmon/tst-gmon-static-pie-gprof
> FAIL: inet/tst-deadline
> FAIL: inet/tst-idna_name_classify
> FAIL: io/tst-statx
> FAIL: libio/tst-cleanup-default-static
> FAIL: libio/tst-cleanup-default-static-cmp
> FAIL: libio/tst-cleanup-nostart-stop-gc-static
> FAIL: libio/tst-cleanup-nostart-stop-gc-static-cmp
> FAIL: libio/tst-cleanup-start-stop-gc-static
> FAIL: libio/tst-cleanup-start-stop-gc-static-cmp
> FAIL: libio/tst-stdio-static
> FAIL: localedata/bug-setlocale1-static
> FAIL: localedata/tst-langinfo-setlocale-static
> FAIL: malloc/tst-aligned-alloc-static
> FAIL: malloc/tst-interpose-static-nothread
> FAIL: malloc/tst-interpose-static-thread
> FAIL: math/atest-exp
> FAIL: math/atest-exp2
> FAIL: math/atest-sincos
> FAIL: math/test-fpucw-ieee-static
> FAIL: math/test-fpucw-static
> FAIL: math/test-signgam-uchar-init-static
> FAIL: math/test-signgam-uchar-static
> FAIL: math/test-signgam-uint-init-static
> FAIL: math/test-signgam-uint-static
> FAIL: math/test-signgam-ullong-init-static
> FAIL: math/test-signgam-ullong-static
> FAIL: misc/tst-align-clone-internal
> FAIL: misc/tst-clone2-internal
> FAIL: misc/tst-clone3-internal
> FAIL: misc/tst-empty
> FAIL: misc/tst-fd_to_filename
> FAIL: misc/tst-getpid1-internal
> FAIL: nptl/tst-cancel21-static
> FAIL: nptl/tst-cancel24-static
> FAIL: nptl/tst-cond11-static
> FAIL: nptl/tst-cond8-static
> FAIL: nptl/tst-locale1
> FAIL: nptl/tst-locale2
> FAIL: nptl/tst-mutex8-static
> FAIL: nptl/tst-mutexpi8-static
> FAIL: nptl/tst-pthread-gdb-attach-static
> FAIL: nptl/tst-pthread-key1-static
> FAIL: nptl/tst-pthread_exit-nothreads-static
> FAIL: nptl/tst-sem11-static
> FAIL: nptl/tst-sem12-static
> FAIL: nptl/tst-stackguard1-static
> FAIL: nss/tst-field
> FAIL: posix/tst-affinity-static
> FAIL: posix/tst-exec-static
> FAIL: posix/tst-libc-message
> FAIL: posix/tst-spawn-static
> FAIL: posix/tst-sysconf-cache-linesize-static
> FAIL: resolv/tst-ns_name_length_uncompressed
> FAIL: resolv/tst-ns_rr_cursor
> FAIL: resolv/tst-ns_samebinaryname
> FAIL: resolv/tst-resolv-txnid-collision
> FAIL: setjmp/tst-setjmp-static
> FAIL: stdlib/tst-getenv-static
> FAIL: stdlib/tst-secure-getenv
> FAIL: string/test-memswap
It's not obvious to me how modf{,f} is used at all for any of that. I
also thought from the thread that the codegen would be basically the
same as it is with -O2 now. What's going on?
>
> -O2 works.
More information about the Libc-alpha
mailing list