Patchwork [U-Boot] sh: only add -mno-fdpic if the compiler supports it

login
register
mail settings
Submitter Mike Frysinger
Date Oct. 13, 2011, 4:45 a.m.
Message ID <1318481147-23270-1-git-send-email-vapier@gentoo.org>
Download mbox | patch
Permalink /patch/119345/
State Accepted
Commit 4cde1740d259eb3d1f6943e6eb131c33e7b9faf3
Delegated to: Nobuhiro Iwamatsu
Headers show

Comments

Mike Frysinger - Oct. 13, 2011, 4:45 a.m.
Not all SuperH toolchains support -mno-fdpic.  Chances are good that if
the flag doesn't work, it isn't defaulting to the FDPIC ABI, so the flag
isn't needed.  So only add it if it is actually supported.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 arch/sh/cpu/sh2/config.mk |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Phil Edworthy - Oct. 13, 2011, 7:39 a.m.
Hi Mike,

Mike Frysinger wrote on 13/10/2011 05:45:47:
> Not all SuperH toolchains support -mno-fdpic.  Chances are good that if
> the flag doesn't work, it isn't defaulting to the FDPIC ABI, so the flag
> isn't needed.  So only add it if it is actually supported.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---

Tested on SH7264 with CodeSourcery 2011.03 SH2A toolchain.

Thanks
Phil
Nobuhiro Iwamatsu - Oct. 21, 2011, 4 a.m.
Applied. Thanks.

Nobuhiro

2011/10/13  <phil.edworthy@renesas.com>:
> Hi Mike,
>
> Mike Frysinger wrote on 13/10/2011 05:45:47:
>> Not all SuperH toolchains support -mno-fdpic.  Chances are good that if
>> the flag doesn't work, it isn't defaulting to the FDPIC ABI, so the flag
>> isn't needed.  So only add it if it is actually supported.
>>
>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> ---
>
> Tested on SH7264 with CodeSourcery 2011.03 SH2A toolchain.
>
> Thanks
> Phil
>

Patch

diff --git a/arch/sh/cpu/sh2/config.mk b/arch/sh/cpu/sh2/config.mk
index f46b38f..bdd3315 100644
--- a/arch/sh/cpu/sh2/config.mk
+++ b/arch/sh/cpu/sh2/config.mk
@@ -24,10 +24,11 @@ 
 ENDIANNESS += -EB
 
 ifdef CONFIG_SH2A
-PLATFORM_CPPFLAGS += -m2a -m2a-nofpu -mb -mno-fdpic -ffreestanding
+PLATFORM_CPPFLAGS += -m2a -m2a-nofpu -mb -ffreestanding
 else # SH2
 PLATFORM_CPPFLAGS += -m3e -mb
 endif
+PLATFORM_CPPFLAGS += $(call cc-option,-mno-fdpic)
 
 PLATFORM_RELFLAGS += -ffixed-r13
 PLATFORM_LDFLAGS += $(ENDIANNESS)