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

[Minios-devel] [UNIKRAFT PATCH v2] plat/*: Separate plat lib linker scripts from others



The Unikraft build system provides a option to include additional
linker scripts. In the current implementation EXTRA_LD_SCRIPT-y
is shared among all the platform which result in all platform using
this additional linker script. We introduce [PLAT]_LD_SCRIPT-y for
platform specific library.

Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 doc/guides/developers-app.rst | 4 ++++
 plat/kvm/Linker.uk            | 5 +++--
 plat/linuxu/Linker.uk         | 5 +++--
 plat/xen/Linker.uk            | 7 ++++---
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/doc/guides/developers-app.rst b/doc/guides/developers-app.rst
index d1b8bfa..bbd3bbd 100644
--- a/doc/guides/developers-app.rst
+++ b/doc/guides/developers-app.rst
@@ -304,6 +304,10 @@ your Makefile.uk to add ::
 
     EXTRA_LD_SCRIPT-$(CONFIG_LIBYOURAPPNAME) += $(LIBYOURAPPNAME_BASE)/extra.ld
 
+If your library is specific to a platform, edit your Makefile.uk to add ::
+
+       [PLATFORM]_LD_SCRIPT-$(CONFIG_LIBYOURAPPNAME) += 
$(LIBYOURAPPNAME_BASE)/extra.ld
+
 
 An example context of extra.ld: ::
 
diff --git a/plat/kvm/Linker.uk b/plat/kvm/Linker.uk
index f696e25..52ae61b 100644
--- a/plat/kvm/Linker.uk
+++ b/plat/kvm/Linker.uk
@@ -11,7 +11,8 @@ endif
 ##
 KVM_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_kvm-$(CONFIG_UK_ARCH)
 
-EXTRA_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T,$(EXTRA_LD_SCRIPT-y))
+KVM_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T$(comma),\
+                       $(KVM_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y))
 
 $(KVM_IMAGE): $(KVM_ALIBS) $(KVM_ALIBS-y) $(KVM_OLIBS) $(KVM_OLIBS-y) \
               $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) \
@@ -33,7 +34,7 @@ ifneq ($(filter x86_64 arm64,$(CONFIG_UK_ARCH)),)
               $(LD) $(LDFLAGS) $(LDFLAGS-y) \
                     $(KVM_LDFLAGS) $(KVM_LDFLAGS-y) \
                     -Wl$(comma)-dT$(comma)$(call strip,$(KVM_LDSCRIPT)) \
-                    $(EXTRA_LD_SCRIPT_FLAGS) \
+                    $(KVM_LD_SCRIPT_FLAGS) \
                     $@.o -o $@)
 ifeq ($(CONFIG_OPTIMIZE_DBGFILE),y)
        $(call build_cmd,OBJCOPY,,$@.dbg,\
diff --git a/plat/linuxu/Linker.uk b/plat/linuxu/Linker.uk
index dbdf9d9..ef4b201 100644
--- a/plat/linuxu/Linker.uk
+++ b/plat/linuxu/Linker.uk
@@ -4,7 +4,8 @@ LINUXU_LDFLAGS-y += -Wl,-e,_liblinuxuplat_start
 ## Link image
 ##
 LINUXU_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_linuxu-$(CONFIG_UK_ARCH)
-EXTRA_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T,$(EXTRA_LD_SCRIPT-y))
+LINUXU_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T$(comma),\
+                           $(LINUXU_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y))
 
 $(LINUXU_IMAGE): $(LINUXU_ALIBS) $(LINUXU_ALIBS-y) \
                 $(LINUXU_OLIBS) $(LINUXU_OLIBS-y) \
@@ -18,7 +19,7 @@ $(LINUXU_IMAGE): $(LINUXU_ALIBS) $(LINUXU_ALIBS-y) \
                     $(LINUXU_ALIBS) $(LINUXU_ALIBS-y) \
                     $(UK_ALIBS) $(UK_ALIBS-y) \
                     -Wl$(comma)--end-group \
-                    $(EXTRA_LD_SCRIPT_FLAGS) \
+                    $(LINUXU_LD_SCRIPT_FLAGS) \
                     -o $@)
 ifeq ($(CONFIG_OPTIMIZE_DBGFILE),y)
        $(call build_cmd,OBJCOPY,,$@.dbg,\
diff --git a/plat/xen/Linker.uk b/plat/xen/Linker.uk
index 801f5e2..5f39de1 100644
--- a/plat/xen/Linker.uk
+++ b/plat/xen/Linker.uk
@@ -18,7 +18,8 @@ endif
 ##
 XEN_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_xen-$(CONFIG_UK_ARCH)
 
-EXTRA_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T,$(EXTRA_LD_SCRIPT-y))
+XEN_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T$(comma),\
+                        $(XEN_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y))
 
 $(XEN_IMAGE): $(XEN_ALIBS) $(XEN_ALIBS-y) $(XEN_OLIBS) $(XEN_OLIBS-y) \
               $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) \
@@ -39,7 +40,7 @@ ifeq (arm,$(CONFIG_UK_ARCH))
        $(call build_cmd,LD,,$@.elf,\
               $(LD) $(LDFLAGS) $(LDFLAGS-y) $(XEN_LDFLAGS) $(XEN_LDFLAGS-y) \
                     -Wl$(comma)-dT$(comma)$(call strip,$(XEN_LDSCRIPT)) \
-                    $(EXTRA_LD_SCRIPT_FLAGS) \
+                    $(XEN_LD_SCRIPT_FLAGS) \
                     $@.o -o $@.elf)
 ifeq ($(CONFIG_OPTIMIZE_DBGFILE),y)
        $(call build_cmd,OBJCOPY,,$@.dbg,\
@@ -61,7 +62,7 @@ else
        $(call build_cmd,LD,,$@,\
               $(LD) $(LDFLAGS) $(LDFLAGS-y) $(XEN_LDFLAGS) $(XEN_LDFLAGS-y) \
                     -Wl$(comma)-dT$(comma)$(call strip,$(XEN_LDSCRIPT)) \
-                    $(EXTRA_LD_SCRIPT_FLAGS) \
+                    $(XEN_LD_SCRIPT_FLAGS) \
                     $@.o -o $@)
 ifeq ($(CONFIG_OPTIMIZE_DBGFILE),y)
        $(call build_cmd,OBJCOPY,,$@.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®.