[Concept,07/15] ulib: sandbox: Move the linker-script name into config.mk

Message ID 20250905170132.182249-8-sjg@u-boot.org
State New
Headers
Series ulib: Provide test programs and documentation |

Commit Message

Simon Glass Sept. 5, 2025, 5:01 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Each architecture will have its own version of the linker script, so use
a Makefile variable for it.

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

 Makefile               | 5 +++--
 arch/sandbox/config.mk | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)
  

Patch

diff --git a/Makefile b/Makefile
index 7011535bb2f..1a378ebbee3 100644
--- a/Makefile
+++ b/Makefile
@@ -1856,7 +1856,7 @@  endif
 # Build U-Boot as a shared library
 quiet_cmd_libu-boot.so = LD      $@
       cmd_libu-boot.so = $(CC) -shared -o $@ -Wl,--build-id=none \
-	-Wl,-T,$(srctree)/arch/sandbox/cpu/u-boot-lib.lds \
+	-Wl,-T,$(LIB_LDS) \
 	$(u-boot-init) \
 	$(KBUILD_LDFLAGS:%=-Wl,%) $(SANITIZERS) $(LTO_FINAL_LDFLAGS) \
 	-Wl,--whole-archive \
@@ -1865,7 +1865,8 @@  quiet_cmd_libu-boot.so = LD      $@
 	-Wl,--no-whole-archive \
 	$(PLATFORM_LIBS) -Wl,-Map -Wl,libu-boot.map
 
-libu-boot.so: $(u-boot-init) $(u-boot-main) $(u-boot-keep-syms-lto) FORCE
+libu-boot.so: $(u-boot-init) $(u-boot-main) $(u-boot-keep-syms-lto) \
+		$(LIB_LDS) FORCE
 	$(call if_changed,libu-boot.so)
 
 # Build ulib_test that links with shared library
diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 405843800e9..566f5b417ae 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -69,3 +69,6 @@  EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv64_efi.lds
 endif
 EFI_CRT0 := crt0_sandbox_efi.o
 EFI_RELOC := reloc_sandbox_efi.o
+
+# U-Boot Library
+LIB_LDS := $(srctree)/arch/sandbox/cpu/u-boot-lib.lds