Skip to contentSkip to conversation

nommu/flat: build packages with the correct FLAGS

PATCH New Gustavo Zacarias 3 participants 4 messages Sep 11, 2013 – Sep 12, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nommu/flat: build packages with the correct FLAGS

When building for nommu flat targets the CFLAGS/CXXFLAGS/LDFLAGS must be adjusted accordingly.
For gcc this means passing along -Wl,-elf2flt to signal the linker. For ld this means -elf2flt.

Also correct the error in STACKSIZE settings from commit 9edf482d which is setting gcc flags as ld flags and will surely fail (no package uses it at the moment so it was never seen).

---
 package/Makefile.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
package/Makefile.in +5 -1
index 91ae1b9..dd365be 100644
@@ -115,7 +115,11 @@ TARGET_CXXFLAGS = $(TARGET_CFLAGS)
 TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
 
 ifeq ($(BR2_BINFMT_FLAT),y)
-TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))
+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
 
 ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 1/1 nommu/flat: build packages with the correct FLAGS

Dear Gustavo Zacarias,

Review

Quoted 3 lines · Gustavo Zacarias

ifeq ($(BR2_BINFMT_FLAT),y)

(quoted diff) +2 -0
+TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
+	-Wl$(comma)-elf2flt)

Nitpicking, can't this be written:

TARGET_CFLAGS += -Wl$(comma)-elf2flt$(if $($(PKG)_FLAT_STACKSIZE),=-s$($(PKG)_FLAT_STACKSIZE))

not sure if it's more readable though.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 nommu/flat: build packages with the correct FLAGS

Quoted 10 lines · Thomas Petazzoni

Dear Gustavo Zacarias,

Review

Quoted 3 lines · Gustavo Zacarias

ifeq ($(BR2_BINFMT_FLAT),y)

(quoted diff) +2 -0
+TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
+	-Wl$(comma)-elf2flt)

Nitpicking, can't this be written:

Quoted 3 lines

TARGET_CFLAGS += -Wl$(comma)-elf2flt$(if $($(PKG)_FLAT_STACKSIZE),=-s$($(PKG)_FLAT_STACKSIZE))

not sure if it's more readable though.

Yes very likely, but i went for readable :)
If the FLAT support is extended there may be other options appended there and separate clauses will be likely/better to avoid duplication and general uglyness.
Regards.

#3 lore raw

PATCH 1/1 nommu/flat: build packages with the correct FLAGS

In reply to Gustavo Zacarias
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

Gustavo> When building for nommu flat targets the CFLAGS/CXXFLAGS/LDFLAGS must be Gustavo> adjusted accordingly.
Gustavo> For gcc this means passing along -Wl,-elf2flt to signal the linker. Gustavo> For ld this means -elf2flt.

Gustavo> Also correct the error in STACKSIZE settings from commit 9edf482d which Gustavo> is setting gcc flags as ld flags and will surely fail (no package uses Gustavo> it at the moment so it was never seen).

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard