Message ID | 20241107174847.1899424-1-torbjorn.svensson@foss.st.com |
---|---|
State | New |
Headers | show |
Series | [v2] testsuite: arm: Use effective-target arm_libc_fp_abi for pr68620.c test | expand |
On 07/11/2024 17:48, Torbjörn SVENSSON wrote: > Changes since v1: > > - Switch to arm_libc_fp_abi from arm_fp > > @Christophe, can you test this patch in the linaro farm to ensure that > it does not fail again? > > Ok for trunk and releases/gcc-14? > > -- > > 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 <torbjorn.svensson@foss.st.com> > Co-authored-by: Richard Earnshaw <rearnsha@arm.com> OK. R. > --- > gcc/testsuite/gcc.target/arm/pr68620.c | 4 ++- > gcc/testsuite/lib/target-supports.exp | 35 ++++++++++++++++++++++++++ > 2 files changed, 38 insertions(+), 1 deletion(-) > > diff --git a/gcc/testsuite/gcc.target/arm/pr68620.c b/gcc/testsuite/gcc.target/arm/pr68620.c > index 6e38671752f..3ffaa5c5a9c 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 75703ddca60..0c2fd83f45c 100644 > --- a/gcc/testsuite/lib/target-supports.exp > +++ b/gcc/testsuite/lib/target-supports.exp > @@ -4950,6 +4950,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 <stdint.h> > + } "$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
diff --git a/gcc/testsuite/gcc.target/arm/pr68620.c b/gcc/testsuite/gcc.target/arm/pr68620.c index 6e38671752f..3ffaa5c5a9c 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 75703ddca60..0c2fd83f45c 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4950,6 +4950,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 <stdint.h> + } "$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
Changes since v1: - Switch to arm_libc_fp_abi from arm_fp @Christophe, can you test this patch in the linaro farm to ensure that it does not fail again? Ok for trunk and releases/gcc-14? -- 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 <torbjorn.svensson@foss.st.com> Co-authored-by: Richard Earnshaw <rearnsha@arm.com> --- gcc/testsuite/gcc.target/arm/pr68620.c | 4 ++- gcc/testsuite/lib/target-supports.exp | 35 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-)