[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH V4 4/6] external plat: Add solo5 platform link files.
Signed-off-by: Haibo Xu <haibo.xu@xxxxxxx> Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx> --- Linker.uk | 61 +++++++++++++++++++++++++++ link64.lds | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 Linker.uk create mode 100644 link64.lds diff --git a/Linker.uk b/Linker.uk new file mode 100644 index 0000000..9889a86 --- /dev/null +++ b/Linker.uk @@ -0,0 +1,61 @@ +ifeq (x86_64,$(CONFIG_UK_ARCH)) +SOLO5_LDSCRIPT := $(LIBSOLO5PLAT_BASE)/link64.lds +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 := $(LIBSOLO5PLAT_BASE)/link64.lds +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/link64.lds b/link64.lds new file mode 100644 index 0000000..0c151b7 --- /dev/null +++ b/link64.lds @@ -0,0 +1,119 @@ +/* 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 = .; + + . = ALIGN(0x1000); + __eh_frame_start = .; + .eh_frame : + { + *(.eh_frame) + *(.eh_frame.*) + } + __eh_frame_end = .; + + __eh_frame_hdr_start = .; + .eh_frame_hdr : + { + *(.eh_frame_hdr) + *(.eh_frame_hdr.*) + } + __eh_frame_hdr_end = .; + + . = ALIGN(0x1000); + uk_ctortab = .; + .uk_ctortab : + { + KEEP(*(SORT_BY_NAME(.uk_ctortab[0-7]))) + LONG(0) + } + + . = ALIGN(0x1000); + /* Read-only data */ + .rodata : + { + *(.rodata) + *(.rodata.*) + } + + _erodata = .; + + /* Constructor tables (read-only) */ + . = ALIGN(0x8); + _ctors = .; + .preinit_array : { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } + + . = ALIGN(0x8); + .init_array : { + 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 = .; +} -- 2.17.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |