From: Torbjörn SVENSSON Date: Wed, 6 Nov 2024 06:12:14 +0000 (+0100) Subject: testsuite: arm: Use effective-target arm_libc_fp_abi for pr68620.c test X-Git-Tag: releases/gcc-14.3.0~898 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29284becc5cbfdf3a474b75087e71812c1e70de1;p=thirdparty%2Fgcc.git testsuite: arm: Use effective-target arm_libc_fp_abi for pr68620.c test This fixes reported regression at https://linaro.atlassian.net/browse/GNU-1407. gcc/testsuite/ChangeLog: * gcc.target/arm/pr68620.c: Use effective-target arm_libc_fp_abi. * lib/target-supports.exp: Define effective-target arm_libc_fp_abi. Signed-off-by: Torbjörn SVENSSON Co-authored-by: Richard Earnshaw (cherry picked from commit dc5d559494656c17c4faa99f398047b7d0c33adc) --- diff --git a/gcc/testsuite/gcc.target/arm/pr68620.c b/gcc/testsuite/gcc.target/arm/pr68620.c index 6e38671752f2..3ffaa5c5a9c9 100644 --- a/gcc/testsuite/gcc.target/arm/pr68620.c +++ b/gcc/testsuite/gcc.target/arm/pr68620.c @@ -1,8 +1,10 @@ /* { dg-do compile } */ /* { dg-skip-if "-mpure-code supports M-profile without Neon only" { *-*-* } { "-mpure-code" } } */ /* { dg-require-effective-target arm_arch_v7a_ok } */ -/* { dg-options "-mfp16-format=ieee -mfpu=auto -mfloat-abi=softfp" } */ +/* { dg-require-effective-target arm_libc_fp_abi_ok } */ +/* { dg-options "-mfp16-format=ieee -mfpu=auto" } */ /* { dg-add-options arm_arch_v7a } */ +/* { dg-add-options arm_libc_fp_abi } */ #include "arm_neon.h" diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index d8b5a06a4224..6b8603b1af86 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4733,6 +4733,41 @@ proc add_options_for_arm_fp { flags } { return "$flags $et_arm_fp_flags" } +# Some libc headers will only compile correctly if the correct ABI flags +# are picked for the target environment. Try to find an ABI setting +# that works. Glibc falls into this category. This test is intended +# to enable FP as far as possible, so does not try -mfloat-abi=soft. +proc check_effective_target_arm_libc_fp_abi_ok_nocache { } { + global et_arm_libc_fp_abi_flags + set et_arm_libc_fp_abi_flags "" + if { [check_effective_target_arm32] } { + foreach flags {"-mfloat-abi=hard" "-mfloat-abi=softfp"} { + if { [check_no_compiler_messages_nocache arm_libc_fp_abi_ok object { + #include + } "$flags"] } { + set et_arm_libc_fp_abi_flags $flags + return 1 + } + } + } + return 0 +} + +proc check_effective_target_arm_libc_fp_abi_ok { } { + return [check_cached_effective_target arm_libc_fp_abi_ok \ + check_effective_target_arm_libc_fp_abi_ok_nocache] +} + +# Add flags that pick the right ABI for the supported libc headers on +# this platform. +proc add_options_for_arm_libc_fp_abi { flags } { + if { ! [check_effective_target_arm_libc_fp_abi_ok] } { + return "$flags" + } + global et_arm_libc_fp_abi_flags + return "$flags $et_arm_libc_fp_abi_flags" +} + # Return 1 if this is an ARM target defining __ARM_FP with # double-precision support. We may need -mfloat-abi=softfp or # equivalent options. Some multilibs may be incompatible with these