diff mbox

PATC: PR target/64409: ICE building Mesa 10.4.0 for x32 ABI

Message ID 20141226183819.GA26275@gmail.com
State New
Headers show

Commit Message

H.J. Lu Dec. 26, 2014, 6:38 p.m. UTC
There is no counter part of x32 in MS ABI.   Issue an error when ms_abi
attribute is used with x32.  OK for trunk and branches?

Thanks.


H.J.
---
gcc/

	PR target/64409
	* config/i386/i386.c (ix86_function_type_abi): Issue an error
	when ms_abi attribute is used with x32.

gcc/testsuite/

	PR target/64409
	* gcc.target/i386/pr64409.c: New test.
---
 gcc/ChangeLog                           |  6 ++++++
 gcc/config/i386/i386.c                  | 13 ++++++++++++-
 gcc/testsuite/ChangeLog                 |  5 +++++
 gcc/testsuite/gcc.target/i386/pr64409.c |  6 ++++++
 4 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr64409.c

Comments

Uros Bizjak Dec. 27, 2014, 8:44 a.m. UTC | #1
On Fri, Dec 26, 2014 at 7:38 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> There is no counter part of x32 in MS ABI.   Issue an error when ms_abi
> attribute is used with x32.  OK for trunk and branches?

Is there a fundamental reason that x32 doesn't support ms_abi? IIRC,
x32 uses x86_64 ABI, so I see no reason why ms_abi should be disabled.

I think that from the user perspective, ms_abi should "just work" on
x32 in the same way as on x86_64.

Uros.
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2d21dfe..fbb92bd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@ 
+2014-12-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR target/64409
+	* config/i386/i386.c (ix86_function_type_abi): Issue an error
+	when ms_abi attribute is used with x32.
+
 2014-12-24  Oleg Endo  <olegendo@gcc.gnu.org>
 
 	PR target/51244
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 122a350..d693fdb 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6116,7 +6116,18 @@  ix86_function_type_abi (const_tree fntype)
       if (abi == SYSV_ABI)
 	{
 	  if (lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype)))
-	    abi = MS_ABI;
+	    {
+	      if (TARGET_X32)
+		{
+		  static bool warned = false;
+		  if (!warned)
+		    {
+		      error ("X32 does not support ms_abi attribute");
+		      warned = true;
+		    }
+		}
+	      abi = MS_ABI;
+	    }
 	}
       else if (lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (fntype)))
 	abi = SYSV_ABI;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d0bee5d..3725770 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@ 
+2014-12-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR target/64409
+	* gcc.target/i386/pr64409.c: New test.
+
 2014-12-24  Segher Boessenkool  <segher@kernel.crashing.org>
 
 	* gcc.target/powerpc/405-dlmzb-strlen-1.c: Explicitly align arg.
diff --git a/gcc/testsuite/gcc.target/i386/pr64409.c b/gcc/testsuite/gcc.target/i386/pr64409.c
new file mode 100644
index 0000000..6a64b59
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr64409.c
@@ -0,0 +1,6 @@ 
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-require-effective-target maybe_x32 } */
+/* { dg-options "-O0 -mx32" } */
+
+int a;
+int* __attribute__ ((ms_abi)) fn1 () { return &a; } /* { dg-error "X32 does not support ms_abi attribute" } */