images: Use separate LDFLAGS for PBL
Subsystems (2)
PATCH 1/1 images: Use separate LDFLAGS for PBL
When setting CONFIG_PBL_RELOCATABLE=y (selected by PBL_MULTI_IMAGES) and CONFIG_RELOCATABLE=n (trying to reduce image size), the PBL is also linked with "-static" instead of "-pie". The result is a non-working PBL.
As a side effect, also get rid of erroneous "-Map barebox.map" when linking the PBL.
Only changed for ARM, are any other platforms affected?
--- Makefile | 2 ++ arch/arm/Makefile | 7 +++++++ images/Makefile | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-)
Makefile +2 -0
@@ -313,6 +313,7 @@ LDFLAGS_barebox := -Map barebox.map # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. LDFLAGS_barebox += $(call ld-option, --no-dynamic-linker) +LDFLAGS_pbl += $(call ld-option, --no-dynamic-linker) # Read KERNELRELEASE from include/config/kernel.release (if it exists) KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
@@ -328,6 +329,7 @@ export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS export CFLAGS CFLAGS_KERNEL export AFLAGS AFLAGS_KERNEL export LDFLAGS_barebox +export LDFLAGS_pbl export CFLAGS_UBSAN
arch/arm/Makefile +7 -0
@@ -140,6 +140,7 @@ CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) # Add cleanup flags CPPFLAGS += -fdata-sections -ffunction-sections LDFLAGS_barebox += --gc-sections +LDFLAGS_pbl += --gc-sections # early code often runs at addresses we are not linked at CPPFLAGS += -fPIE
@@ -150,6 +151,12 @@ else LDFLAGS_barebox += -static endif +ifdef CONFIG_PBL_RELOCATABLE +LDFLAGS_pbl += -pie +else +LDFLAGS_pbl += -static +endif + KBUILD_BINARY := barebox.bin barebox.s5p: $(KBUILD_BINARY)
images/Makefile +1 -1
@@ -54,7 +54,7 @@ $(pbl-lds): $(obj)/../arch/$(ARCH)/lib/pbl.lds.S FORCE $(call if_changed_dep,cpp_lds_S) quiet_cmd_elf__ ?= LD $@ - cmd_elf__ ?= $(LD) $(LDFLAGS_barebox) --gc-sections \ + cmd_elf__ ?= $(LD) $(LDFLAGS_pbl) --gc-sections \ -e $(2) -Map [email protected] $(LDFLAGS_$(@F)) -o $@ \ -T $(pbl-lds) \ --start-group $(barebox-pbl-common) $(obj)/piggy.o \
Signature · 14 lines
Christian Eggers Embedded software developer Arnold & Richter Cine Technik GmbH & Co. Betriebs KG Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRA 57918 Persoenlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRB 54477 Geschaeftsfuehrer: Dr. Michael Neuhaeuser; Stephan Schenk; Walter Trauninger; Markus Zeiler _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 9 lines · Christian Eggers
When setting
CONFIG_PBL_RELOCATABLE=y(selected byPBL_MULTI_IMAGES) andCONFIG_RELOCATABLE=n(trying to reduce image size), the PBL is also linked with "-static" instead of "-pie". The result is a non-working PBL.As a side effect, also get rid of erroneous "-Map barebox.map" when linking the PBL.
Only changed for ARM, are any other platforms affected?
Yes, mips. FIxed up and applied, thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox