[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 1/4] plat/linuxu: Provider linker scripts (arm, x86_64)
On 02/12/2018 05:00 PM, Simon Kuenzer wrote: Provide linker scripts for generating Linux binaries. The main purpose is to enable adding custom Unikraft sections later. Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> Reviewed-by: Florian Schmidt <florian.schmidt@xxxxxxxxx> --- plat/linuxu/Linker.uk | 11 ++++-- plat/linuxu/arm/link32.ld | 82 +++++++++++++++++++++++++++++++++++++++++++++ plat/linuxu/x86/link64.ld | 85 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 plat/linuxu/arm/link32.ld create mode 100644 plat/linuxu/x86/link64.ld diff --git a/plat/linuxu/Linker.uk b/plat/linuxu/Linker.uk index 16a5b15..10e501f 100644 --- a/plat/linuxu/Linker.uk +++ b/plat/linuxu/Linker.uk @@ -1,4 +1,11 @@ -LINUXU_LDFLAGS-y += -e_liblinuxuplat_start +ifeq (x86_64,$(UK_ARCH)) +LINUXU_LDSCRIPT := $(UK_PLAT_LINUXU_BASE)/x86/link64.ld +LINUXU_LDFLAGS-y += -m elf_x86_64 +endif +ifeq (arm,$(UK_ARCH)) +LINUXU_LDSCRIPT := $(UK_PLAT_LINUXU_BASE)/arm/link32.ld +endif +#### Link image @@ -7,7 +14,7 @@ LINUXU_IMAGE := $(BUILD_DIR)/$(UK_NAME)_linuxu-$(UK_ARCH)$(LINUXU_IMAGE): $(LINUXU_LINK) $(LINUXU_LINK-y) $(UK_LINK) $(UK_LINK-y)$(call build_cmd,LD,,$@,\ - $(LD) $(LDFLAGS) $(LDFLAGS-y) $(LINUXU_LDFLAGS) $(LINUXU_LDFLAGS-y) $^ -o $@) + $(LD) $(LDFLAGS) $(LDFLAGS-y) $(LINUXU_LDFLAGS) $(LINUXU_LDFLAGS-y) -T $(LINUXU_LDSCRIPT) $^ -o $@) ifeq ($(OPTIMIZE_DBGFILE),y) $(call build_cmd,OBJCOPY,,$@.dbg,\ $(OBJCOPY) --only-keep-debug $@ $@.dbg) diff --git a/plat/linuxu/arm/link32.ld b/plat/linuxu/arm/link32.ld new file mode 100644 index 0000000..7dac4f6 --- /dev/null +++ b/plat/linuxu/arm/link32.ld @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> + * + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. + */ + +OUTPUT_ARCH(arm) +ENTRY(_liblinuxuplat_start) +SECTIONS { + . = 0x10074; /* TODO: Revisit */ + + /* Code */ + _text = .; + + .text : + { + *(.text) + *(.text.*) + } + . = ALIGN(0x1000); + _etext = .; + + /* Read-only data */ + _rodata = .; + .rodata : + { + *(.rodata) + *(.rodata.*) + } + . = ALIGN(0x1000); + _erodata = .; + + /* Read-write data (initialized) */ + _data = .; + .data : + { + *(.data) + *(.data.*) + } + . = ALIGN(0x1000); + _edata = .; + + /* Read-write data (uninitialized) */ + _bss = .; + .bss : + { + *(.bss) + *(.bss.*) + } + . = ALIGN(0x1000); + _ebss = .; + + _end = .; +} diff --git a/plat/linuxu/x86/link64.ld b/plat/linuxu/x86/link64.ld new file mode 100644 index 0000000..a7d642d --- /dev/null +++ b/plat/linuxu/x86/link64.ld @@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> + * + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. + */ + +OUTPUT_FORMAT("elf64-x86-64") +OUTPUT_ARCH(i386:x86-64) +ENTRY(_liblinuxuplat_start) +SECTIONS { + . = 0x4000b0; /* TODO: Revisit */ + + /* Code */ + _text = .; + + .text : + { + *(.text) + *(.text.*) + } + . = ALIGN(0x1000); + _etext = .; + + /* Read-only data */ + _rodata = .; + .rodata : + { + *(.rodata) + *(.rodata.*) + } + . = ALIGN(0x1000); + _erodata = .; + + /*. = 0x8000000;*/ + + /* Read-write data (initialized) */ + _data = .; + .data : + { + *(.data) + *(.data.*) + } + . = ALIGN(0x1000); + _edata = .; + + /* Read-write data (uninitialized) */ + _bss = .; + .bss : + { + *(.bss) + *(.bss.*) + } + . = ALIGN(0x1000); + _ebss = .; + + _end = .; +} -- Dr. Florian Schmidt フローリアン・シュミット Research Scientist, Systems and Machine Learning Group NEC Laboratories Europe Kurfürsten-Anlage 36, D-69115 Heidelberg Tel. +49 (0)6221 4342-265 Fax: +49 (0)6221 4342-155 e-mail: florian.schmidt@xxxxxxxxx ============================================================ Registered at Amtsgericht Mannheim, Germany, HRB728558 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |