diff mbox

[testsuite] Disable attr_thumb.c test when Thumb mode is not supported.

Message ID 1436456373-3369-1-git-send-email-christophe.lyon@linaro.org
State New
Headers show

Commit Message

Christophe Lyon July 9, 2015, 3:39 p.m. UTC
Some multilibs do not support Thumb mode on ARM targets. This is the
case for instance when target is arm-linux-gnueabihf and with
-march=armv5-t: Thumb-1 hard-float VFP ABI is not implemented.

In this configuration, gcc.target/arm/attr_thumb.c is failing because
we switch thumb mode via an attribute.

This patch makes this test unsupported, by adding a new function in
lib/target-supports.exp: check_effective_target_arm_thumb_ok.

OK?

2015-07-09  Christophe Lyon  <christophe.lyon@linaro.org>

	* lib/target-supports.exp (check_effective_target_arm_thumb_ok):
	New function.
	* gcc.target/arm/attr_thumb.c: Call
	check_effective_target_arm_thumb_ok.

Change-Id: I60d9e008a0691f24d1d8c295a7e4364fb5df9dc3
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.target/arm/attr_thumb.c b/gcc/testsuite/gcc.target/arm/attr_thumb.c
index 02ddfda..6553e65 100644
--- a/gcc/testsuite/gcc.target/arm/attr_thumb.c
+++ b/gcc/testsuite/gcc.target/arm/attr_thumb.c
@@ -1,5 +1,7 @@ 
 /* Check that attribute target thumb is recognized. */
 /* { dg-do compile } */
+/* Make sure the current multilib supports thumb.  */
+/* { dg-require-effective-target arm_thumb_ok } */
 /* { dg-options "-O2 -mno-restrict-it" } */
 /* { dg-final { scan-assembler-not "\\.arm"  } } */
 /* { dg-final { scan-assembler "\\.thumb_func" } } */
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index bf512e9..7cc5bbf 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2910,6 +2910,15 @@  foreach { armfunc armflag armdef } { v4 "-march=armv4 -marm" __ARM_ARCH_4__
     }]
 }
 
+# Return 1 if this is an ARM target supporting -mthumb.  Some
+# multilibs may be incompatible with this option.
+
+proc check_effective_target_arm_thumb_ok { } {
+    return [check_no_compiler_messages arm_thumb_ok object {
+	int foo (int i) { return i; }
+	} "-mthumb"]
+}
+
 # Return 1 if this is an ARM target where -marm causes ARM to be
 # used (not Thumb)