Kbuild: add LDFLAGS_STANDALONE
authorDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Sun, 23 Sep 2018 17:15:15 +0000 (19:15 +0200)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Sun, 18 Nov 2018 15:02:23 +0000 (16:02 +0100)
Introduce a new Makefile variable for passing LDFLAGS to standalone
programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
misued on some archs to pass a specific linker script.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
arch/mips/cpu/mips32/config.mk
arch/mips/cpu/mips64/config.mk
arch/nds32/config.mk
arch/riscv/config.mk
arch/sh/config.mk
config.mk
examples/standalone/Makefile

index a0247596f555eb5732ddb268f4325d06395125f7..662e4f8fc8e0bffc4b5a32c994fd06eca77a58a8 100644 (file)
@@ -3,5 +3,5 @@
 # (C) Copyright 2003
 # Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
 
-CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \
-                              -T $(srctree)/examples/standalone/mips.lds
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000
+LDFLAGS_STANDALONE     += -T $(srctree)/examples/standalone/mips.lds
index cd96bbcce984fc3c2d2f341036bcf6886d57ffbc..6a53976b5c8cdc306f9015c64293ac82d09f1093 100644 (file)
@@ -3,5 +3,5 @@
 # (C) Copyright 2003
 # Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
 
-CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 \
-                              -T $(srctree)/examples/standalone/mips64.lds
+CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000
+LDFLAGS_STANDALONE     += -T $(srctree)/examples/standalone/mips64.lds
index c5520fd8d83c94aa901dcad9f63a7065d49952be..12cec368d3b8eba06f387f5941526fc98203560f 100644 (file)
@@ -12,8 +12,8 @@ ifeq ($(CROSS_COMPILE),)
 CROSS_COMPILE := nds32le-linux-
 endif
 
-CONFIG_STANDALONE_LOAD_ADDR = 0x300000 \
-                             -T $(srctree)/examples/standalone/nds32.lds
+CONFIG_STANDALONE_LOAD_ADDR = 0x300000
+LDFLAGS_STANDALONE     += -T $(srctree)/examples/standalone/nds32.lds
 
 PLATFORM_RELFLAGS      += -fno-common -mrelax
 PLATFORM_RELFLAGS      += -gdwarf-2
index ed9eb0c24cddc86f0d459c64edcb3f277f641604..cc5d8d1ad5e138dfb688336452196c3eb4a09859 100644 (file)
@@ -27,8 +27,8 @@ CFLAGS_EFI            += -march=rv64ima -mabi=lp64
 EFI_LDS                        := elf_riscv64_efi.lds
 endif
 
-CONFIG_STANDALONE_LOAD_ADDR = 0x00000000 \
-                             -T $(srctree)/examples/standalone/riscv.lds
+CONFIG_STANDALONE_LOAD_ADDR = 0x00000000
+LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/riscv.lds
 
 PLATFORM_CPPFLAGS      += -ffixed-gp -fpic
 PLATFORM_RELFLAGS      += -fno-common -gdwarf-2 -ffunction-sections
index 92abee17ad0ef4a6b40e9769c01c7f9b1f5e903a..6ef44638abd0855644c024a6feecfad02279d683 100644 (file)
@@ -9,7 +9,7 @@ endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x8C000000
 ifeq ($(CPU),sh2)
-CONFIG_STANDALONE_LOAD_ADDR += -EB
+LDFLAGS_STANDALONE += -EB
 endif
 
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
index b4e46189822d60b2a60572f5f722e5672d123a43..caf0dd9b81829bc166b0b88719c977ad2acfce7b 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -15,6 +15,7 @@ PLATFORM_CPPFLAGS :=
 PLATFORM_LDFLAGS :=
 LDFLAGS :=
 LDFLAGS_FINAL :=
+LDFLAGS_STANDALONE :=
 OBJCOPYFLAGS :=
 # clear VENDOR for tcsh
 VENDOR :=
@@ -75,4 +76,5 @@ LDFLAGS_FINAL += -Bstatic
 export PLATFORM_CPPFLAGS
 export RELFLAGS
 export LDFLAGS_FINAL
+export LDFLAGS_STANDALONE
 export CONFIG_STANDALONE_LOAD_ADDR
index 09364d84a0ade721c43eba4c03d7a1acaf996001..abe1bf1883483dd947017a7f492853878dcaec9b 100644 (file)
@@ -45,6 +45,8 @@ endif
 # source file.
 ccflags-y += $(call cc-option,-fno-toplevel-reorder)
 
+LDFLAGS_STANDALONE     += -Ttext $(CONFIG_STANDALONE_LOAD_ADDR)
+
 #########################################################################
 
 quiet_cmd_link_lib = LD      $@
@@ -54,7 +56,7 @@ $(LIB):       $(LIBOBJS) FORCE
        $(call if_changed,link_lib)
 
 quiet_cmd_link_elf = LD      $@
-      cmd_link_elf = $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
+      cmd_link_elf = $(LD) $(LDFLAGS) $(LDFLAGS_STANDALONE) -g  \
                     -o $@ -e $(SYM_PREFIX)$(@F) $< $(LIB) $(PLATFORM_LIBGCC)
 
 $(ELF): $(obj)/%: $(obj)/%.o $(LIB) FORCE