diff mbox

Fwd: PING^3: [PATCH]: New configure options that make the compiler use -fPIE and -pie as default option

Message ID 871thyatef.fsf@igel.home
State New
Headers show

Commit Message

Andreas Schwab May 30, 2015, 5:04 p.m. UTC
Andreas Schwab <schwab@linux-m68k.org> writes:

> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>> diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
>> index 88356cc..74ebff7 100644
>> --- a/gcc/config/m68k/m68k.h
>> +++ b/gcc/config/m68k/m68k.h
>> @@ -40,7 +40,8 @@ along with GCC; see the file COPYING3.  If not see
>>  %{m68020-40:-m68040}%{m68020-60:-m68040}\
>>  %{mcpu=*:-mcpu=%*}%{march=*:-march=%*}\
>>  "
>> -#define ASM_PCREL_SPEC "%{fPIC|fpic|mpcrel:--pcrel} \
>> +#define ASM_PCREL_SPEC "%{" FPIC_SPEC ":--pcrel} \
>> + %{mpcrel:%{" NO_FPIC_SPEC ":--pcrel}} \
>>   %{msep-data|mid-shared-library:--pcrel} \
>
> That expands to a spurious --pcrel with -fno-PIE, causing the assembler
> to error out while compiling crtstuff if the compiler is configured with
> --enable-default-pie.

This was already buggy before, -fpie should always have implied --pcrel.
Fixed as below.

Andreas.

	* config/m68k/m68k.h (ASM_PCREL_SPEC): Pass --pcrel also for
	implict or explicit -fPIE or -fpie.
diff mbox

Patch

diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 74ebff7..b227c67 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -40,8 +40,8 @@  along with GCC; see the file COPYING3.  If not see
 %{m68020-40:-m68040}%{m68020-60:-m68040}\
 %{mcpu=*:-mcpu=%*}%{march=*:-march=%*}\
 "
-#define ASM_PCREL_SPEC "%{" FPIC_SPEC ":--pcrel} \
- %{mpcrel:%{" NO_FPIC_SPEC ":--pcrel}} \
+#define ASM_PCREL_SPEC "%{" FPIE_OR_FPIC_SPEC ":--pcrel} \
+ %{mpcrel:%{" NO_FPIE_AND_FPIC_SPEC ":--pcrel}} \
  %{msep-data|mid-shared-library:--pcrel} \
 "