summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChristian Eggers <ceggers@arri.de>2020-01-27 14:30:43 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-02-10 09:42:43 +0100
commit07c4c069475fec43bd99e021afb3839d7b27fd5a (patch)
tree79c485537d7d537bbc567dce75fef9dc26081779 /arch
parent9fcd7fcd5c6028a77b6339c48a0d90f7f2dd3955 (diff)
downloadbarebox-07c4c069475fec43bd99e021afb3839d7b27fd5a.tar.gz
barebox-07c4c069475fec43bd99e021afb3839d7b27fd5a.tar.xz
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? Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Makefile7
-rw-r--r--arch/mips/Makefile1
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 740b0790e7..29fd8e276c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -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)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 72b77adc4c..486dfd8253 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -44,6 +44,7 @@ endif
LDFLAGS += $(ldflags-y) -m $(ld-emul)
LDFLAGS_barebox += $(ldflags-y)
+LDFLAGS_pbl += $(ldflags-y)
#
# CPU-dependent compiler/assembler options for optimization.