summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2015-12-19 20:20:47 +0100
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2016-01-16 21:06:45 +0100
commite92d9124f8c398405af51aa0bb0277e2dfc68b3d (patch)
tree07f44f7f836b9aae0163abd8d86232737200fbff /arch
parent5b6f357fe73a3fab11870cceeac5f2fecd6d7e02 (diff)
MIPS: do not build position-independent executables for SPL
SPL binaries are usually linked to a fixed address in SRAM. Furthermore SPL binaries do not need to relocate itself. Thus do not build them as position-independent binaries which helps to largely reduce the size of SPL binaries. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/config.mk18
1 files changed, 14 insertions, 4 deletions
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 52e28f2ca5..415ec8afd2 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -63,10 +63,20 @@ PLATFORM_CPPFLAGS += -D__MIPS__
# On the other hand, we want PIC in the U-Boot code to relocate it from ROM
# to RAM. $28 is always used as gp.
#
-PLATFORM_CPPFLAGS += -G 0 -mabicalls -fpic
+ifdef CONFIG_SPL_BUILD
+PF_ABICALLS := -mno-abicalls
+PF_PIC := -fno-pic
+PF_PIE :=
+else
+PF_ABICALLS := -mabicalls
+PF_PIC := -fpic
+PF_PIE := -pie
+PF_OBJCOPY := -j .got -j .u_boot_list -j .rel.dyn -j .padding
+endif
+
+PLATFORM_CPPFLAGS += -G 0 $(PF_ABICALLS) $(PF_PIC)
PLATFORM_CPPFLAGS += -msoft-float
PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
-LDFLAGS_FINAL += --gc-sections -pie
-OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .got
-OBJCOPYFLAGS += -j .u_boot_list -j .rel.dyn -j .padding
+LDFLAGS_FINAL += --gc-sections $(PF_PIE)
+OBJCOPYFLAGS += -j .text -j .rodata -j .data $(PF_OBJCOPY)