From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE
Date: Sun, 23 Sep 2018 19:15:15 +0200 [thread overview]
Message-ID: <20180923171517.21363-2-daniel.schwierzeck@gmail.com> (raw)
In-Reply-To: <20180923171517.21363-1-daniel.schwierzeck@gmail.com>
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>
---
arch/mips/cpu/mips32/config.mk | 4 ++--
arch/mips/cpu/mips64/config.mk | 4 ++--
arch/nds32/config.mk | 4 ++--
arch/riscv/config.mk | 4 ++--
arch/sh/config.mk | 2 +-
config.mk | 2 ++
examples/standalone/Makefile | 4 +++-
7 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index a0247596f5..662e4f8fc8 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -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
diff --git a/arch/mips/cpu/mips64/config.mk b/arch/mips/cpu/mips64/config.mk
index cd96bbcce9..6a53976b5c 100644
--- a/arch/mips/cpu/mips64/config.mk
+++ b/arch/mips/cpu/mips64/config.mk
@@ -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
diff --git a/arch/nds32/config.mk b/arch/nds32/config.mk
index cb3d8b35b5..0a93fd428d 100644
--- a/arch/nds32/config.mk
+++ b/arch/nds32/config.mk
@@ -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-strict-aliasing -fno-common -mrelax
PLATFORM_RELFLAGS += -gdwarf-2
diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk
index 219e66683d..d0b7e8e88b 100644
--- a/arch/riscv/config.mk
+++ b/arch/riscv/config.mk
@@ -27,8 +27,8 @@ PLATFORM_LDFLAGS += -m $(64bit-emul)
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-strict-aliasing -fno-common -gdwarf-2 -ffunction-sections
diff --git a/arch/sh/config.mk b/arch/sh/config.mk
index 92abee17ad..6ef44638ab 100644
--- a/arch/sh/config.mk
+++ b/arch/sh/config.mk
@@ -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__
diff --git a/config.mk b/config.mk
index b4e4618982..caf0dd9b81 100644
--- 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
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 09364d84a0..abe1bf1883 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -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
--
2.19.0
next prev parent reply other threads:[~2018-09-23 17:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-23 17:15 [U-Boot] [PATCH 0/3] MIPS: fix building and linking of standalone programs Daniel Schwierzeck
2018-09-23 17:15 ` Daniel Schwierzeck [this message]
2018-10-28 20:12 ` [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE Daniel Schwierzeck
2018-10-29 13:34 ` Tom Rini
[not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA3A3B5EC@ATCPCS16.andestech.com>
2018-10-30 1:40 ` Rick Chen
2018-11-02 22:28 ` Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS Daniel Schwierzeck
2018-10-28 20:13 ` Daniel Schwierzeck
2018-10-29 13:34 ` Tom Rini
2018-11-02 22:29 ` Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 3/3] MIPS: fix linking of standalone programs Daniel Schwierzeck
2018-11-02 22:30 ` Daniel Schwierzeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180923171517.21363-2-daniel.schwierzeck@gmail.com \
--to=daniel.schwierzeck@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox