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

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
This commit is contained in:
Sandra Loosemore 2012-08-04 20:35:05 -04:00 committed by Sandra Loosemore
parent 08264e04ba
commit 5dd4087e9a
5 changed files with 24 additions and 1 deletions

View 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>

View 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

View 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>

View 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} } */

View 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 ();