[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Minios-devel] [UNIKRAFT PATCHv5 16/46] plat/kvm: Generate linker scripts from source code
On 07.09.2018 07:40, Wei Chen (Arm Technology China) wrote:
Hi Simon,
-----Original Message-----
From: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
Sent: 2018年9月6日 23:50
To: Wei Chen (Arm Technology China) <Wei.Chen@xxxxxxx>; minios-
devel@xxxxxxxxxxxxxxxxxxxx
Cc: Kaly Xin (Arm Technology China) <Kaly.Xin@xxxxxxx>; nd <nd@xxxxxxx>
Subject: Re: [Minios-devel] [UNIKRAFT PATCHv5 16/46] plat/kvm: Generate linker
scripts from source code
Hey Wei,
I am currently thinking of a nicer solution for linker scripts that have
to be pre-processed. I think also other platforms could benefit from
something like this. The build system should provide you an easy way to
let you do this. Let me come up with a patch tomorrow to achieve this.
You could then just use this one.
Oh, that would be better if we have a common solution for all platform : )
On 10.08.2018 09:08, Wei Chen wrote:
Sometimes, using a macro in linker script will be easier for people
to see what is done. This means we will share macros with source code.
So, generate linker script from a .S will help linker script to share
macros with source code.
Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
---
plat/kvm/Linker.uk | 7 +++++--
plat/kvm/x86/{link64.ld => link64.lds.S} | 0
2 files changed, 5 insertions(+), 2 deletions(-)
rename plat/kvm/x86/{link64.ld => link64.lds.S} (100%)
diff --git a/plat/kvm/Linker.uk b/plat/kvm/Linker.uk
index 2292b03..fbadde2 100644
--- a/plat/kvm/Linker.uk
+++ b/plat/kvm/Linker.uk
@@ -1,5 +1,6 @@
ifeq (x86_64,$(CONFIG_UK_ARCH))
-KVM_LDSCRIPT := -Wl,-T,$(CONFIG_UK_BASE)/plat/kvm/x86/link64.ld
+KVM_LDSCRIPT := -Wl,-T,$(CONFIG_UK_BASE)/plat/kvm/x86/link64.lds
+KVM_LDSCRIPT_FLAGS := -Wl,-T,$(KVM_LDSCRIPT)
KVM_LDFLAGS-y += -Wl,-m,elf_x86_64
endif
@@ -14,8 +15,10 @@ $(KVM_IMAGE): $(KVM_LINK) $(KVM_LINK-y) $(UK_LINK)
$(UK_LINK-y)
$(call build_cmd,OBJCOPY,,$@.o,\
$(OBJCOPY) -w -G kvmos_* -G _libkvmplat_entry $@.ld.o $@.o)
ifeq (x86_64,$(CONFIG_UK_ARCH))
+ $(call build_cmd,CC,,link64.lds.o,\
+ $(CC) -E $(ASINCLUDES) $(ASFLAGS) $(ASFLAGS-y) -P
$(KVM_LDSCRIPT).S -o $(KVM_LDSCRIPT))
This rule says that the generated linker script is not saved to the
build directory. We should definitely avoid this since multiple projects
may use the same unikraft source base. Project configurations may result
in different linker scripts. Because of this, each project has its own
build directory.
Yes, this would be a problem. Should I fix it in my patch or will you cover
it in your new patch?
I will send the patch, try to get it in quickly, and then you can just
use the introduced mechanism in this patch.
$(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)
$(KVM_LDSCRIPT_FLAGS) $@.o -o $@)
ifeq ($(CONFIG_OPTIMIZE_DBGFILE),y)
$(call build_cmd,OBJCOPY,,$@.dbg,\
$(OBJCOPY) --only-keep-debug $@ $@.dbg)
diff --git a/plat/kvm/x86/link64.ld b/plat/kvm/x86/link64.lds.S
similarity index 100%
rename from plat/kvm/x86/link64.ld
rename to plat/kvm/x86/link64.lds.S
Thanks,
Simon
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|