Test for linking for arm/size-optimization-ieee-[123].c
authorAlexandre Oliva <oliva@adacore.com>
Fri, 1 Apr 2022 03:34:57 +0000 (00:34 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Fri, 1 Apr 2022 03:34:57 +0000 (00:34 -0300)
These tests require a target that supports arm soft-float.  The
problem is that the test checks for compile-time soft-float support,
but they may hit a problem when the linker complains that it can't
combine the testcase's object file with hard-float init files and
target system libraries.

I don't see that the tests actually require linking, and they could be
simplified to dg-do assemble, but I figured a link test for soft-float
support could be useful, so I added that, and adjusted the tests to
require it instead.

for  gcc/testsuite/ChangeLog

* lib/target-supports.exp
(check_effective_target_arm_soft_ok_link): New.
* gcc.target/arm/size-optimization-ieee-1.c: Use it.
* gcc.target/arm/size-optimization-ieee-2.c: Likewise.
* gcc.target/arm/size-optimization-ieee-3.c: Likewise.

gcc/testsuite/gcc.target/arm/size-optimization-ieee-1.c
gcc/testsuite/gcc.target/arm/size-optimization-ieee-2.c
gcc/testsuite/gcc.target/arm/size-optimization-ieee-3.c
gcc/testsuite/lib/target-supports.exp

index 61475eb..9af2c6e 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do link { target arm_soft_ok } } */
+/* { dg-do link { target arm_soft_ok_link } } */
 /* { dg-skip-if "Feature is -mfloat-abi=soft only" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
 /* { dg-options "-mfloat-abi=soft" } */
 
index b469927..e78a7ad 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do link { target arm_soft_ok } } */
+/* { dg-do link { target arm_soft_ok_link } } */
 /* { dg-skip-if "Feature is -mfloat-abi=soft only" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
 /* { dg-options "-mfloat-abi=soft" } */
 
index 34b1ebe..bb9ccef 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do link { target arm_soft_ok } } */
+/* { dg-do link { target arm_soft_ok_link } } */
 /* { dg-skip-if "Feature is -mfloat-abi=soft only" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
 /* { dg-options "-mfloat-abi=soft" } */
 
index a1aef0e..ff8edbd 100644 (file)
@@ -3935,6 +3935,18 @@ proc check_effective_target_arm_soft_ok { } {
        } "-mfloat-abi=soft"]
 }
 
+# Return 1 if this is an ARM target supporting -mfloat-abi=soft even
+# for linking.  Some multilibs may be incompatible with this option,
+# and some linkers may reject incompatible options.
+
+proc check_effective_target_arm_soft_ok_link { } {
+    return [check_no_compiler_messages arm_soft_ok_link executable {
+       #include <stdint.h>
+       int dummy;
+       int main (void) { return 0; }
+       } "-mfloat-abi=soft"]
+}
+
 # Return 1 if this is an ARM target supporting -mfpu=vfp with an
 # appropriate abi.