This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add check for x32 support


  Currently on targets like x86_64 darwin which don't support -mx32 -maddress-mode=short,
tests that pass those on dg-options fail with excessive errors at -m64. The attached patch
resolves this by adding a check_effective_target_maybe_x32 proc to test if the -mx32
-maddress-mode=short flags are supported. Tested on x86_64-apple-darwin12. Okay for
gcc trunk?
         Jack

2012-11-02  H.J. Lu  <hjl.tools@gmail.com>
	    Jack Howarth  <howarth@bromo.med.uc.edu>

	* lib/target-supports.exp (check_effective_target_maybe_x32): New proc.
	* gcc.target/i386/pr54457.c: Use dg-require-effective-target maybe_x32.
	* gcc.target/i386/pr53249.c: Likewise.


Index: gcc/testsuite/gcc.target/i386/pr54457.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr54457.c	(revision 193097)
+++ gcc/testsuite/gcc.target/i386/pr54457.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-require-effective-target maybe_x32 } */
 /* { dg-options "-O2 -mx32 -maddress-mode=short" } */
 
 extern char array[40];
Index: gcc/testsuite/gcc.target/i386/pr53249.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr53249.c	(revision 193097)
+++ gcc/testsuite/gcc.target/i386/pr53249.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-require-effective-target maybe_x32 } */
 /* { dg-options "-O2 -mx32 -ftls-model=initial-exec -maddress-mode=short" } */
 
 struct gomp_task
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 193097)
+++ gcc/testsuite/lib/target-supports.exp	(working copy)
@@ -4608,6 +4608,14 @@ proc check_effective_target_lto { } {
     return [info exists ENABLE_LTO]
 }
 
+# Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
+
+proc check_effective_target_maybe_x32 { } {
+    return [check_no_compiler_messages maybe_x32 object {
+        void foo (void) {}
+    } "-mx32 -maddress-mode=short"]
+}
+
 # Return 1 if this target supports the -fsplit-stack option, 0
 # otherwise.
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]