===================================================================
@@ -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
===================================================================
@@ -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 ();
===================================================================
@@ -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} } */