mips.c (mips_option_override): Check -fpic for compatibility with -mabicalls and...
authorSandra Loosemore <sandra@codesourcery.com>
Sun, 5 Aug 2012 00:35:05 +0000 (20:35 -0400)
committerSandra Loosemore <sandra@gcc.gnu.org>
Sun, 5 Aug 2012 00:35:05 +0000 (20:35 -0400)
2012-08-04  Sandra Loosemore  <sandra@codesourcery.com>
    Richard Sandiford  <rdsandiford@googlemail.com>

gcc/
* config/mips/mips.c (mips_option_override): Check -fpic
for compatibility with -mabicalls and ABI.

gcc/testsuite/
* g++.dg/opt/enum2.C: Require fpic target.
* g++.dg/lto/20090303_0.C: Likewise.

Co-Authored-By: Richard Sandiford <rdsandiford@googlemail.com>
From-SVN: r190150

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/20090303_0.C
gcc/testsuite/g++.dg/opt/enum2.C

index b8f0a86a0f898904cd4e25aee0adb3baf0b9fd18..9292c7b651abdffef75443184941cab14af68048 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-04  Sandra Loosemore  <sandra@codesourcery.com>
+           Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * config/mips/mips.c (mips_option_override): Check -fpic
+       for compatibility with -mabicalls and ABI.
+
 2012-08-04  Catherine Moore  <clm@codesourcery.com>
            Sandra Loosemore  <sandra@codesourcery.com>
 
index ef1cccdcbe703b6df52b056b48a9f3010b31e49b..f36f65bfac0d6d1a5bdedcea4d3ed27cf20a339f 100644 (file)
@@ -16162,6 +16162,16 @@ mips_option_override (void)
       target_flags &= ~MASK_ABICALLS;
     }
 
+  /* PIC requires -mabicalls.  */
+  if (flag_pic)
+    {
+      if (mips_abi == ABI_EABI)
+       error ("cannot generate position-independent code for %qs",
+              "-mabi=eabi");
+      else if (!TARGET_ABICALLS)
+       error ("position-independent code requires %qs", "-mabicalls");
+    }
+
   if (TARGET_ABICALLS_PIC2)
     /* We need to set flag_pic for executables as well as DSOs
        because we may reference symbols that are not defined in
index 19a88759e7bc72b2c1be900fdc271b239168d1a6..e41b25a717a6b3e598b036ba2607045d47d3133e 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-04  Sandra Loosemore  <sandra@codesourcery.com>
+           Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * g++.dg/opt/enum2.C: Require fpic target.
+       * g++.dg/lto/20090303_0.C: Likewise.
+
 2012-08-04  Sandra Loosemore  <sandra@codesourcery.com>
            Catherine Moore  <clm@codesourcery.com>
 
index 36c8588bb552e293fc93ec0ea458858f7e150212..88bd6ad9bebb3da231dfaa9234956dc66a09b69a 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-lto-do run } */
+/* { dg-require-effective-target fpic } */
 /* { dg-lto-options {{-flto -flto-partition=1to1 -fPIC}} } */
 /* { dg-lto-options {{-flto -flto-partition=1to1}} { target sparc*-*-* } } */
 /* { dg-suppress-ld-options {-fPIC} }  */
index 6300896cff933516e13b7ed1db93a6c4d4b433f8..40a496e535dc06f53aaf5a3dac89cbbb27f1cb73 100644 (file)
@@ -1,8 +1,8 @@
 // PR c++/43680
 // Test that we don't make excessively aggressive assumptions about what
 // values an enum variable can have.
+// { dg-do run { target fpic } }
 // { dg-options "-O2 -fPIC" }
-// { dg-do run }
 
 extern "C" void abort ();