[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Minios-devel] [UNIKRAFT PATCH v2 2/5] plat/solo5: Add solo5 platform link files.
On 19.03.19 11:31, Haibo Xu wrote:
Signed-off-by: Haibo Xu <haibo.xu@xxxxxxx>
---
plat/Linker.uk | 1 +
plat/solo5/Linker.uk | 61 ++++++++++++++++++++++++++++
plat/solo5/link64.lds | 94 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 156 insertions(+)
create mode 100644 plat/solo5/Linker.uk
create mode 100644 plat/solo5/link64.lds
diff --git a/plat/Linker.uk b/plat/Linker.uk
index 3e33bcc..4d25450 100644
--- a/plat/Linker.uk
+++ b/plat/Linker.uk
@@ -1,3 +1,4 @@
include $(UK_PLAT_XEN_BASE)/Linker.uk
include $(UK_PLAT_KVM_BASE)/Linker.uk
include $(UK_PLAT_LINUXU_BASE)/Linker.uk
+include $(UK_PLAT_SOLO5_BASE)/Linker.uk
diff --git a/plat/solo5/Linker.uk b/plat/solo5/Linker.uk
new file mode 100644
index 0000000..5559ff6
--- /dev/null
+++ b/plat/solo5/Linker.uk
@@ -0,0 +1,61 @@
+ifeq (x86_64,$(CONFIG_UK_ARCH))
+SOLO5_LDSCRIPT := $(CONFIG_UK_BASE)/plat/solo5/link64.lds
Please use `$(LIBSOLO5PLAT_BASE)/link64.lds` instead.
+SOLO5_LDFLAGS-y += -Wl,-m,elf_x86_64
+else ifeq (arm64,$(CONFIG_UK_ARCH))
+##
+## Currently only support generate little endian aarch64 output format
+##
+SOLO5_LDSCRIPT := $(CONFIG_UK_BASE)/plat/solo5/link64.lds
Same here.
+SOLO5_LDFLAGS-y += -Wl,-m,aarch64elf
+endif
+
+##
+## Link image
+##
+SOLO5_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_solo5-$(CONFIG_UK_ARCH)
+EXTRA_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T,$(EXTRA_LD_SCRIPT-y))
+
+$(SOLO5_IMAGE): $(SOLO5_ALIBS) $(SOLO5_ALIBS-y) $(SOLO5_OLIBS)
$(SOLO5_OLIBS-y) \
+ $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) \
+ $(SOLO5_LDSCRIPT) $(SOLO5_HVT_BINDING)
+ $(call build_cmd,LD,,$@.ld.o,\
+ $(LD) -r $(LIBLDFLAGS) $(LIBLDFLAGS-y) \
+ $(SOLO5_LDFLAGS) $(SOLO5_LDFLAGS-y) \
+ $(SOLO5_OLIBS) $(SOLO5_OLIBS-y) \
+ $(UK_OLIBS) $(UK_OLIBS-y) \
+ -Wl$(comma)--start-group \
+ $(SOLO5_ALIBS) $(SOLO5_ALIBS-y) \
+ $(UK_ALIBS) $(UK_ALIBS-y) \
+ -Wl$(comma)--end-group \
+ -o $@.ld.o)
+ $(call build_cmd,OBJCOPY,,$@.o,\
+ $(OBJCOPY) -w -G solo5_app_main $@.ld.o $@.o)
+ifneq ($(filter x86_64 arm64,$(CONFIG_UK_ARCH)),)
+ $(call build_cmd,LD,,$@,\
+ $(LD) $(LDFLAGS) $(LDFLAGS-y) \
+ $(SOLO5_LDFLAGS) $(SOLO5_LDFLAGS-y) \
+ -Wl$(comma)-dT$(comma)$(call strip,$(SOLO5_LDSCRIPT)) \
+ $(EXTRA_LD_SCRIPT_FLAGS) \
+ $@.o $(SOLO5_HVT_BINDING) -o $@)
+ifeq ($(CONFIG_OPTIMIZE_DBGFILE),y)
+ $(call build_cmd,OBJCOPY,,$@.dbg,\
+ $(OBJCOPY) --only-keep-debug $@ $@.dbg)
+endif
+ifeq ($(CONFIG_OPTIMIZE_SYMFILE),y)
+ $(call build_cmd,NM,,$@.sym,\
+ $(NM) -n $@ > $@.sym)
+endif
+ $(call build_cmd,GZ,,$@.gz,\
+ $(GZIP) -f -9 -c $@ >$@.gz)
+endif
+
+# register image to the build
+UK_IMAGES-$(CONFIG_PLAT_SOLO5) += $(SOLO5_IMAGE)
+
+# ...for cleaning:
+LIBSOLO5PLAT_CLEAN += $(call build_clean,$(SOLO5_IMAGE))
+LIBSOLO5PLAT_CLEAN += $(call build_clean,$(SOLO5_IMAGE).gz)
+LIBSOLO5PLAT_CLEAN += $(call build_clean,$(SOLO5_IMAGE).dbg)
+LIBSOLO5PLAT_CLEAN += $(call build_clean,$(SOLO5_IMAGE).sym)
+LIBSOLO5PLAT_CLEAN += $(call build_clean,$(SOLO5_IMAGE).o)
+LIBSOLO5PLAT_CLEAN += $(call build_clean,$(SOLO5_IMAGE).ld.o)
diff --git a/plat/solo5/link64.lds b/plat/solo5/link64.lds
new file mode 100644
index 0000000..5678ae3
--- /dev/null
+++ b/plat/solo5/link64.lds
@@ -0,0 +1,94 @@
+/* SPDX-License-Identifier: ISC */
+/*
+ * Author(s): Dan Williams <djwillia@xxxxxxxxxx>
+ * Martin Lucina <martin.lucina@xxxxxxxxxx>
+ * Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ * Haibo Xu <haibo.xu@xxxxxxx>
+ *
+ * Copyright (c) 2016, IBM
+ * (c) 2016-2017 Docker, Inc.
+ * (c) 2017, NEC Europe Ltd.
+ * (c) 2018, Arm Ltd. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted, provided
+ * that the above copyright notice and this permission notice appear
+ * in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+ENTRY(_start)
+
+SECTIONS {
+ . = 0x100000;
+
+ /* Code */
+ _stext = .;
+
+ .text :
+ {
+ *(.text)
+ *(.text.*)
+ }
+
+ _etext = .;
+
In the meantime we need also to include `plat/common/x86/link64.lds`.
See commit 9fd889764. As external library, you could use GCC's
pre-processor instead to generate the final linker script. I am not sure
if you can access the path `plat/common/x86/link64.lds` the same way as
the internal plats are doing by just using the linker.
+ . = ALIGN(0x1000);
+ /* Read-only data */
+ .rodata :
+ {
+ *(.rodata)
+ *(.rodata.*)
+ }
+
+ _erodata = .;
+
+ /* Constructor tables (read-only) */
+ _ctors = .;
+ .preinit_array : {
+ . = ALIGN(0x8);
We recently found problems when the ALIGN does not take place outside
.preinit_array (see commit 4f1cdc690).
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ }
+
+ .init_array : {
+ . = ALIGN(0x8);
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)
SORT_BY_INIT_PRIORITY(.ctors.*)))
+ KEEP (*(.init_array .ctors))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ }
+ _ectors = .;
+
+ . = ALIGN(0x1000);
+ /* Read-write data (initialized) */
+ .data :
+ {
+ *(.data)
+ *(.data.*)
+ }
+
+ _edata = .;
+
+ . = ALIGN(0x1000);
+ /* Read-write data (uninitialized) */
+ .bss :
+ {
+ *(.bss)
+ *(.bss.*)
+ *(COMMON)
+ }
+
+ . = ALIGN(0x1000);
+ _ebss = .;
+ _end = .;
+}
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|