mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
Kbuild: add LDFLAGS_STANDALONE
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>
This commit is contained in:
parent
101860ef69
commit
1d3b97c94e
7 changed files with 14 additions and 10 deletions
|
@ -3,5 +3,5 @@
|
||||||
# (C) Copyright 2003
|
# (C) Copyright 2003
|
||||||
# Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
|
# Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
|
||||||
|
|
||||||
CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \
|
CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000
|
||||||
-T $(srctree)/examples/standalone/mips.lds
|
LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/mips.lds
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
# (C) Copyright 2003
|
# (C) Copyright 2003
|
||||||
# Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
|
# Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
|
||||||
|
|
||||||
CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 \
|
CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000
|
||||||
-T $(srctree)/examples/standalone/mips64.lds
|
LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/mips64.lds
|
||||||
|
|
|
@ -12,8 +12,8 @@ ifeq ($(CROSS_COMPILE),)
|
||||||
CROSS_COMPILE := nds32le-linux-
|
CROSS_COMPILE := nds32le-linux-
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CONFIG_STANDALONE_LOAD_ADDR = 0x300000 \
|
CONFIG_STANDALONE_LOAD_ADDR = 0x300000
|
||||||
-T $(srctree)/examples/standalone/nds32.lds
|
LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/nds32.lds
|
||||||
|
|
||||||
PLATFORM_RELFLAGS += -fno-common -mrelax
|
PLATFORM_RELFLAGS += -fno-common -mrelax
|
||||||
PLATFORM_RELFLAGS += -gdwarf-2
|
PLATFORM_RELFLAGS += -gdwarf-2
|
||||||
|
|
|
@ -27,8 +27,8 @@ CFLAGS_EFI += -march=rv64ima -mabi=lp64
|
||||||
EFI_LDS := elf_riscv64_efi.lds
|
EFI_LDS := elf_riscv64_efi.lds
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CONFIG_STANDALONE_LOAD_ADDR = 0x00000000 \
|
CONFIG_STANDALONE_LOAD_ADDR = 0x00000000
|
||||||
-T $(srctree)/examples/standalone/riscv.lds
|
LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/riscv.lds
|
||||||
|
|
||||||
PLATFORM_CPPFLAGS += -ffixed-gp -fpic
|
PLATFORM_CPPFLAGS += -ffixed-gp -fpic
|
||||||
PLATFORM_RELFLAGS += -fno-common -gdwarf-2 -ffunction-sections
|
PLATFORM_RELFLAGS += -fno-common -gdwarf-2 -ffunction-sections
|
||||||
|
|
|
@ -9,7 +9,7 @@ endif
|
||||||
|
|
||||||
CONFIG_STANDALONE_LOAD_ADDR ?= 0x8C000000
|
CONFIG_STANDALONE_LOAD_ADDR ?= 0x8C000000
|
||||||
ifeq ($(CPU),sh2)
|
ifeq ($(CPU),sh2)
|
||||||
CONFIG_STANDALONE_LOAD_ADDR += -EB
|
LDFLAGS_STANDALONE += -EB
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
|
PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
|
||||||
|
|
|
@ -15,6 +15,7 @@ PLATFORM_CPPFLAGS :=
|
||||||
PLATFORM_LDFLAGS :=
|
PLATFORM_LDFLAGS :=
|
||||||
LDFLAGS :=
|
LDFLAGS :=
|
||||||
LDFLAGS_FINAL :=
|
LDFLAGS_FINAL :=
|
||||||
|
LDFLAGS_STANDALONE :=
|
||||||
OBJCOPYFLAGS :=
|
OBJCOPYFLAGS :=
|
||||||
# clear VENDOR for tcsh
|
# clear VENDOR for tcsh
|
||||||
VENDOR :=
|
VENDOR :=
|
||||||
|
@ -75,4 +76,5 @@ LDFLAGS_FINAL += -Bstatic
|
||||||
export PLATFORM_CPPFLAGS
|
export PLATFORM_CPPFLAGS
|
||||||
export RELFLAGS
|
export RELFLAGS
|
||||||
export LDFLAGS_FINAL
|
export LDFLAGS_FINAL
|
||||||
|
export LDFLAGS_STANDALONE
|
||||||
export CONFIG_STANDALONE_LOAD_ADDR
|
export CONFIG_STANDALONE_LOAD_ADDR
|
||||||
|
|
|
@ -45,6 +45,8 @@ endif
|
||||||
# source file.
|
# source file.
|
||||||
ccflags-y += $(call cc-option,-fno-toplevel-reorder)
|
ccflags-y += $(call cc-option,-fno-toplevel-reorder)
|
||||||
|
|
||||||
|
LDFLAGS_STANDALONE += -Ttext $(CONFIG_STANDALONE_LOAD_ADDR)
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
quiet_cmd_link_lib = LD $@
|
quiet_cmd_link_lib = LD $@
|
||||||
|
@ -54,7 +56,7 @@ $(LIB): $(LIBOBJS) FORCE
|
||||||
$(call if_changed,link_lib)
|
$(call if_changed,link_lib)
|
||||||
|
|
||||||
quiet_cmd_link_elf = LD $@
|
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)
|
-o $@ -e $(SYM_PREFIX)$(@F) $< $(LIB) $(PLATFORM_LIBGCC)
|
||||||
|
|
||||||
$(ELF): $(obj)/%: $(obj)/%.o $(LIB) FORCE
|
$(ELF): $(obj)/%: $(obj)/%.o $(LIB) FORCE
|
||||||
|
|
Loading…
Reference in a new issue