]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: arm: Use effective-target arm_libc_fp_abi for pr68620.c test
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Wed, 6 Nov 2024 06:12:14 +0000 (07:12 +0100)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Fri, 8 Nov 2024 12:03:26 +0000 (13:03 +0100)
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>
(cherry picked from commit dc5d559494656c17c4faa99f398047b7d0c33adc)

gcc/testsuite/gcc.target/arm/pr68620.c
gcc/testsuite/lib/target-supports.exp

index 6e38671752f20e8304b6330a3aebdbf911a6604b..3ffaa5c5a9c97f96d9966c975bf9e7f985ce77ae 100644 (file)
@@ -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"
 
index d8b5a06a4224d706fc192945fd8f8b9b8f1febd4..6b8603b1af86e7bfd3ad70e9bace951ae56774f9 100644 (file)
@@ -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 <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