diff --git a/Makefile b/Makefile index e088497..4986150 100644 --- a/Makefile +++ b/Makefile @@ -313,6 +313,7 @@ # 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 CFLAGS CFLAGS_KERNEL export AFLAGS AFLAGS_KERNEL export LDFLAGS_barebox +export LDFLAGS_pbl export CFLAGS_UBSAN diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 740b079..29fd8e2 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -140,6 +140,7 @@ # 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 @@ 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 72b77ad..486dfd8 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -44,6 +44,7 @@ LDFLAGS += $(ldflags-y) -m $(ld-emul) LDFLAGS_barebox += $(ldflags-y) +LDFLAGS_pbl += $(ldflags-y) # # CPU-dependent compiler/assembler options for optimization. diff --git a/images/Makefile b/images/Makefile index 34b7a56..650baf1 100644 --- a/images/Makefile +++ b/images/Makefile @@ -54,7 +54,7 @@ $(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 $@.map $(LDFLAGS_$(@F)) -o $@ \ -T $(pbl-lds) \ --start-group $(barebox-pbl-common) $(obj)/piggy.o \