diff mbox

[v2,5/6] nommu/flat: don't add -elf2flt for some toolchains

Message ID 1431959088-15257-6-git-send-email-guido@vanguardiasur.com.ar
State Superseded
Headers show

Commit Message

Guido Martínez May 18, 2015, 2:24 p.m. UTC
Some toolchains (OSELAS 2014.12.0, for instance) internally do elf2flt
conversion without having to add anything to {C,CXX,LD}FLAGS. So, add an
option that allows to not add these flags.

Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar>
---
 package/Makefile.in | 3 +++
 toolchain/Config.in | 3 +++
 2 files changed, 6 insertions(+)

Comments

Thomas Petazzoni May 18, 2015, 7:58 p.m. UTC | #1
Dear Guido Martínez,

On Mon, 18 May 2015 11:24:47 -0300, Guido Martínez wrote:

>  ifeq ($(BR2_BINFMT_FLAT),y)
> +# Don't add any flags for toolchains that don't require it
> +ifneq ($(BR2_TOOLCHAIN_DONT_ELF2FLT),y)

An option named "DONT_<something>" really isn't nice.

>  TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
>  	-Wl$(comma)-elf2flt)
>  TARGET_CXXFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
>  	-Wl$(comma)-elf2flt)
>  TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-elf2flt)

But the Blackfin toolchain also doesn't need -elf2flt as far as I know,
the FLAT toolchain also directly produces FLAT binaries without
specifying any flags. Maybe we should instead adjust the logic here
instead of working around it?

Thanks,

Thomas
Guido Martínez May 19, 2015, 7 p.m. UTC | #2
On Mon, May 18, 2015 at 09:58:41PM +0200, Thomas Petazzoni wrote:
> Dear Guido Martínez,
> 
> On Mon, 18 May 2015 11:24:47 -0300, Guido Martínez wrote:
> 
> >  ifeq ($(BR2_BINFMT_FLAT),y)
> > +# Don't add any flags for toolchains that don't require it
> > +ifneq ($(BR2_TOOLCHAIN_DONT_ELF2FLT),y)
> 
> An option named "DONT_<something>" really isn't nice.
> 
> >  TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
> >  	-Wl$(comma)-elf2flt)
> >  TARGET_CXXFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
> >  	-Wl$(comma)-elf2flt)
> >  TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-elf2flt)
> 
> But the Blackfin toolchain also doesn't need -elf2flt as far as I know,
> the FLAT toolchain also directly produces FLAT binaries without
> specifying any flags.
Hm, that's right. In that case I don't know why -elf2flt is specified
when there's no $(PKG)_FLAT_STACKSIZE. For this particular toolchain it
causes the linker to explode while building U-boot, which doesn't happen
with other toolchains.

Removing "-Wl$(comma)-elf2flt" from the else-part fixes it too.

I'll into it some more.
diff mbox

Patch

diff --git a/package/Makefile.in b/package/Makefile.in
index a0c5a7a..0ac1a94 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -142,12 +142,15 @@  TARGET_CXXFLAGS = $(TARGET_CFLAGS)
 TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
 
 ifeq ($(BR2_BINFMT_FLAT),y)
+# Don't add any flags for toolchains that don't require it
+ifneq ($(BR2_TOOLCHAIN_DONT_ELF2FLT),y)
 TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
 	-Wl$(comma)-elf2flt)
 TARGET_CXXFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
 	-Wl$(comma)-elf2flt)
 TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-elf2flt)
 endif
+endif
 
 ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
 TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 7e66de0..fd8dc43 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -23,6 +23,9 @@  config BR2_TOOLCHAIN_USES_UCLIBC
 config BR2_TOOLCHAIN_HAS_RESOLVER
 	bool
 
+config BR2_TOOLCHAIN_DONT_ELF2FLT
+	bool
+
 config BR2_TOOLCHAIN_USES_MUSL
 	bool
 	select BR2_USE_WCHAR