From 910b9befc07212f8b1313b234ce162dd6130e0d0 Mon Sep 17 00:00:00 2001 From: Simon Kuenzer Date: Thu, 23 Feb 2023 21:47:59 +0100 Subject: [PATCH] plat/*: Add linker scripts to link dependencies This commit adds needed linker scripts as dependency to the linking rule of the final image. This dependency was mostly indirectly covered via libraries. However, updates to platform linker scripts did not trigger relinking the final image. Additionally, pure API libraries (like `lib/ukfalloc`) would not even cause building a linker script that is shipped with the library or injected with an `EACHOLIB_SRCS` declaration. The library buildrule is generated but because no library object is generated, the linker script was never be part of a dependency list. Signed-off-by: Simon Kuenzer Reviewed-by: Delia Pavel Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #868 --- plat/kvm/Linker.uk | 4 +++- plat/linuxu/Linker.uk | 3 ++- plat/xen/Linker.uk | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plat/kvm/Linker.uk b/plat/kvm/Linker.uk index 00768fcc5..b5afbe050 100644 --- a/plat/kvm/Linker.uk +++ b/plat/kvm/Linker.uk @@ -30,7 +30,9 @@ define build_bootinfo = endef $(KVM_DEBUG_IMAGE): $(KVM_ALIBS) $(KVM_ALIBS-y) $(KVM_OLIBS) $(KVM_OLIBS-y) \ - $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) + $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) \ + $(KVM_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y) \ + $(UK_PLAT_KVM_DEF_LDS) $(call build_cmd,LD,,$(KVM_IMAGE).o,\ $(LD) -r $(LIBLDFLAGS) $(LIBLDFLAGS-y) \ $(KVM_LDFLAGS) $(KVM_LDFLAGS-y) \ diff --git a/plat/linuxu/Linker.uk b/plat/linuxu/Linker.uk index 6697ffa0e..be2563d48 100644 --- a/plat/linuxu/Linker.uk +++ b/plat/linuxu/Linker.uk @@ -10,7 +10,8 @@ LINUXU_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T$(comma),\ $(LINUXU_DEBUG_IMAGE): $(LINUXU_ALIBS) $(LINUXU_ALIBS-y) \ $(LINUXU_OLIBS) $(LINUXU_OLIBS-y) \ - $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) + $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) \ + $(LINUXU_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y) $(call build_cmd,LD,,$@,\ $(LD) $(LDFLAGS) $(LDFLAGS-y) \ $(LINUXU_LDFLAGS) $(LINUXU_LDFLAGS-y) \ diff --git a/plat/xen/Linker.uk b/plat/xen/Linker.uk index ef0efb423..c81602d98 100644 --- a/plat/xen/Linker.uk +++ b/plat/xen/Linker.uk @@ -19,7 +19,9 @@ XEN_LD_SCRIPT_FLAGS += $(addprefix -Wl$(comma)-T$(comma),\ $(XEN_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y)) $(XEN_DEBUG_IMAGE): $(XEN_ALIBS) $(XEN_ALIBS-y) $(XEN_OLIBS) $(XEN_OLIBS-y) \ - $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) + $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) \ + $(XEN_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y) \ + $(UK_PLAT_XEN_DEF_LDS) $(call build_cmd,LD,,$(XEN_IMAGE).ld.o,\ $(LD) -r $(LIBLDFLAGS) $(LIBLDFLAGS-y) \ $(XEN_LDFLAGS) $(XEN_LDFLAGS-y) \ -- 2.39.5