[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v3 1/8] plat/kvm, plat/xen: Add linker script as build dependency



Modify tha platforms' Linker.uk so that the build rules that create
the final image also depend on changes in the corresponding linker scripts.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 plat/kvm/Linker.uk | 14 ++++++++++----
 plat/xen/Linker.uk | 23 +++++++++++++++--------
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/plat/kvm/Linker.uk b/plat/kvm/Linker.uk
index 2292b03..6c63e48 100644
--- a/plat/kvm/Linker.uk
+++ b/plat/kvm/Linker.uk
@@ -1,5 +1,5 @@
 ifeq (x86_64,$(CONFIG_UK_ARCH))
-KVM_LDSCRIPT  := -Wl,-T,$(CONFIG_UK_BASE)/plat/kvm/x86/link64.ld
+KVM_LDSCRIPT  := $(CONFIG_UK_BASE)/plat/kvm/x86/link64.ld
 KVM_LDFLAGS-y += -Wl,-m,elf_x86_64
 endif
 
@@ -8,14 +8,20 @@ endif
 ##
 KVM_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_kvm-$(CONFIG_UK_ARCH)
 
-$(KVM_IMAGE): $(KVM_LINK) $(KVM_LINK-y) $(UK_LINK) $(UK_LINK-y)
+$(KVM_IMAGE): $(KVM_LINK) $(KVM_LINK-y) $(UK_LINK) $(UK_LINK-y) $(KVM_LDSCRIPT)
        $(call build_cmd,LD,,$@.ld.o,\
-              $(LD) -r $(LIBLDFLAGS) $(LIBLDFLAGS-y) $(KVM_LDFLAGS) 
$(KVM_LDFLAGS-y) $^ -o $@.ld.o)
+              $(LD) -r $(LIBLDFLAGS) $(LIBLDFLAGS-y) \
+                       $(KVM_LDFLAGS) $(KVM_LDFLAGS-y) \
+                       $(KVM_LINK) $(KVM_LINK-y) \
+                       $(UK_LINK) $(UK_LINK-y) -o $@.ld.o)
        $(call build_cmd,OBJCOPY,,$@.o,\
               $(OBJCOPY) -w -G kvmos_* -G _libkvmplat_entry $@.ld.o $@.o)
 ifeq (x86_64,$(CONFIG_UK_ARCH))
        $(call build_cmd,LD,,$@,\
-              $(LD) $(LDFLAGS) $(LDFLAGS-y) $(KVM_LDFLAGS) $(KVM_LDFLAGS-y) 
$(KVM_LDSCRIPT) $@.o -o $@)
+              $(LD) $(LDFLAGS) $(LDFLAGS-y) \
+                    $(KVM_LDFLAGS) $(KVM_LDFLAGS-y) \
+                    -Wl$(comma)-T$(comma)$(call strip,$(KVM_LDSCRIPT)) \
+                    $@.o -o $@)
 ifeq ($(CONFIG_OPTIMIZE_DBGFILE),y)
        $(call build_cmd,OBJCOPY,,$@.dbg,\
               $(OBJCOPY) --only-keep-debug $@ $@.dbg)
diff --git a/plat/xen/Linker.uk b/plat/xen/Linker.uk
index e3f5a9a..f061934 100644
--- a/plat/xen/Linker.uk
+++ b/plat/xen/Linker.uk
@@ -1,16 +1,16 @@
 ifeq (x86_64,$(CONFIG_UK_ARCH))
-XEN_LDSCRIPT  := -Wl,-T,$(CONFIG_UK_BASE)/plat/xen/x86/link64.ld
+XEN_LDSCRIPT  := $(CONFIG_UK_BASE)/plat/xen/x86/link64.ld
 XEN_LDFLAGS-y += -Wl,-m,elf_x86_64
 endif
 ifeq (x86_32,$(CONFIG_UK_ARCH))
-XEN_LDSCRIPT  := -Wl,-T,$(CONFIG_UK_BASE)/plat/xen/x86/link32.ld
+XEN_LDSCRIPT  := $(CONFIG_UK_BASE)/plat/xen/x86/link32.ld
 XEN_LDFLAGS-y += -Wl,-m,elf_x86_32
 endif
 ifeq (arm_64,$(CONFIG_UK_ARCH))
-XEN_LDSCRIPT  := -Wl,-T,$(CONFIG_UK_BASE)/plat/xen/arm/link64.ld
+XEN_LDSCRIPT  := $(CONFIG_UK_BASE)/plat/xen/arm/link64.ld
 endif
 ifeq (arm,$(CONFIG_UK_ARCH))
-XEN_LDSCRIPT  := -Wl,-T,$(CONFIG_UK_BASE)/plat/xen/arm/link32.ld
+XEN_LDSCRIPT  := $(CONFIG_UK_BASE)/plat/xen/arm/link32.ld
 endif
 
 ##
@@ -18,14 +18,19 @@ endif
 ##
 XEN_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_xen-$(CONFIG_UK_ARCH)
 
-$(XEN_IMAGE): $(XEN_LINK) $(XEN_LINK-y) $(UK_LINK) $(UK_LINK-y)
+$(XEN_IMAGE): $(XEN_LINK) $(XEN_LINK-y) $(UK_LINK) $(UK_LINK-y) $(XEN_LDSCRIPT)
        $(call build_cmd,LD,,$@.ld.o,\
-              $(LD) -r $(LIBLDFLAGS) $(LIBLDFLAGS-y) $(XEN_LDFLAGS) 
$(XEN_LDFLAGS-y) $^ -o $@.ld.o)
+              $(LD) -r $(LIBLDFLAGS) $(LIBLDFLAGS-y) \
+                       $(XEN_LDFLAGS) $(XEN_LDFLAGS-y) \
+                       $(XEN_LINK) $(XEN_LINK-y) \
+                       $(UK_LINK) $(UK_LINK-y) -o $@.ld.o)
        $(call build_cmd,OBJCOPY,,$@.o,\
               $(OBJCOPY) -w -G xenos_* -G _libxenplat_start $@.ld.o $@.o)
 ifeq (arm,$(CONFIG_UK_ARCH))
        $(call build_cmd,LD,,$@.elf,\
-              $(LD) $(LDFLAGS) $(LDFLAGS-y) $(XEN_LDFLAGS) $(XEN_LDFLAGS-y) 
$(XEN_LDSCRIPT) $@.o -o $@.elf)
+              $(LD) $(LDFLAGS) $(LDFLAGS-y) $(XEN_LDFLAGS) $(XEN_LDFLAGS-y) \
+                    -Wl$(comma)-T$(comma)$(call strip,$(XEN_LDSCRIPT)) \
+                    $@.o -o $@.elf)
 ifeq ($(CONFIG_OPTIMIZE_DBGFILE),y)
        $(call build_cmd,OBJCOPY,,$@.dbg,\
               $(OBJCOPY) --only-keep-debug $@.elf $@.dbg)
@@ -44,7 +49,9 @@ endif
               $(GZIP) -f -9 -c $@ >$@.gz)
 else
        $(call build_cmd,LD,,$@,\
-              $(LD) $(LDFLAGS) $(LDFLAGS-y) $(XEN_LDFLAGS) $(XEN_LDFLAGS-y) 
$(XEN_LDSCRIPT) $@.o -o $@)
+              $(LD) $(LDFLAGS) $(LDFLAGS-y) $(XEN_LDFLAGS) $(XEN_LDFLAGS-y) \
+                    -Wl$(comma)-T$(comma)$(call strip,$(XEN_LDSCRIPT)) \
+                    $@.o -o $@)
 ifeq ($(CONFIG_OPTIMIZE_DBGFILE),y)
        $(call build_cmd,OBJCOPY,,$@.dbg,\
               $(OBJCOPY) --only-keep-debug $@ $@.dbg)
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.