[PATCH 02/32] Makefile: Avoid using TEXT_BASE if not present

Simon Glass sjg at chromium.org
Mon Feb 3 18:41:55 CET 2025


This value is only available if CONFIG_HAVE_TEXT_BASE is enabled. Add
conditions to avoid introducing errors in link scripts when it is not.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 2f7614191a1..3958ea45b9a 100644
--- a/Makefile
+++ b/Makefile
@@ -1050,8 +1050,10 @@ LDFLAGS_u-boot += -z notext $(call ld-option,--apply-dynamic-relocs)
 LDFLAGS_u-boot += --build-id=none
 
 ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),)
+ifdef CONFIG_HAVE_TEXT_BASE
 LDFLAGS_u-boot += -Ttext $(CONFIG_TEXT_BASE)
 endif
+endif
 
 # make the checker run with the right architecture
 CHECKFLAGS += --arch=$(ARCH)
@@ -1741,7 +1743,7 @@ quiet_cmd_u-boot-elf ?= LD      $@
 	cmd_u-boot-elf ?= $(LD) u-boot-elf.o -o $@ \
 	$(if $(CONFIG_SYS_BIG_ENDIAN),-EB,-EL) \
 	-T u-boot-elf.lds --defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_TEXT_BASE) \
-	-Ttext=$(CONFIG_TEXT_BASE)
+	$(if $(CONFIG_HAVE_TEXT_BASE),-Ttext=$(CONFIG_TEXT_BASE))
 u-boot.elf: u-boot.bin u-boot-elf.lds
 	$(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o
 	$(call if_changed,u-boot-elf)
-- 
2.43.0



More information about the U-Boot mailing list