[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v4 2/7] plat: move common section definitions from linker script to include file
Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx> --- plat/common/include/common.lds.h | 32 ++++++++++++++++- plat/common/x86/link64.lds | 59 -------------------------------- plat/kvm/arm/link64.lds.S | 28 ++------------- plat/kvm/x86/link64.lds.S | 4 ++- plat/linuxu/arm/link.lds.S | 10 ++---- plat/linuxu/x86/link64.lds.S | 6 +++- plat/xen/arm/link32.lds.S | 29 ++-------------- plat/xen/x86/link64.lds.S | 4 ++- 8 files changed, 49 insertions(+), 123 deletions(-) delete mode 100644 plat/common/x86/link64.lds diff --git a/plat/common/include/common.lds.h b/plat/common/include/common.lds.h index 8672b6ff..db951c54 100644 --- a/plat/common/include/common.lds.h +++ b/plat/common/include/common.lds.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause */ /* - * Copyright (c) 2019, NEC Laboratories Europe GmbH, NEC Corporation. + * Copyright (c) 2019, NEC Laboratories Europe GmbH, NEC Corporation, + * University Politehnica of Bucharest. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,6 +32,8 @@ #ifndef __UK_COMMON_LDS_H #define __UK_COMMON_LDS_H +#include <uk/arch/limits.h> /* for __PAGE_SIZE */ + /* DWARF debug sections. Symbols in the DWARF debugging sections are * relative to the beginning of the section so we begin them at 0. */ @@ -64,4 +67,31 @@ .debug_macro 0 : { *(.debug_macro) } \ .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } +#define EXCEPTION_SECTIONS \ + . = ALIGN(__PAGE_SIZE); \ + __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 = .; + +#define CTORTAB_SECTION \ + . = ALIGN(__PAGE_SIZE); \ + uk_ctortab = .; \ + .uk_ctortab : \ + { \ + KEEP(*(SORT_BY_NAME(.uk_ctortab[0-7]))) \ + LONG(0) \ + } + #endif /* __UK_COMMON_LDS_H */ diff --git a/plat/common/x86/link64.lds b/plat/common/x86/link64.lds deleted file mode 100644 index 96f353b8..00000000 --- a/plat/common/x86/link64.lds +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause */ -/* - * Authors: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> - * - * Copyright (c) 2019, Politehnica University of Bucharest. 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. - */ - -. = 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) -} - diff --git a/plat/kvm/arm/link64.lds.S b/plat/kvm/arm/link64.lds.S index 96d9edcb..753d1696 100644 --- a/plat/kvm/arm/link64.lds.S +++ b/plat/kvm/arm/link64.lds.S @@ -69,25 +69,7 @@ SECTIONS { . = ALIGN(__PAGE_SIZE); _etext = .; - /* Exception frame */ - __eh_frame_start = .; - .eh_frame : - { - *(.eh_frame) - *(.eh_frame.*) - } - __eh_frame_end = .; - - /* Exception frame header */ - __eh_frame_hdr_start = .; - .eh_frame_hdr : - { - - *(.eh_frame_hdr) - *(.eh_frame_hdr.*) - } - . = ALIGN(__PAGE_SIZE); - __eh_frame_hdr_end = .; + EXCEPTION_SECTIONS /* Read-only data */ _rodata = .; @@ -100,13 +82,7 @@ SECTIONS { _erodata = .; - . = ALIGN(__PAGE_SIZE); - uk_ctortab = .; - .uk_ctortab : - { - KEEP(*(SORT_BY_NAME(.uk_ctortab[0-7]))) - LONG(0) - } + CTORTAB_SECTION /* Constructor tables (read-only) */ . = ALIGN(0x8); diff --git a/plat/kvm/x86/link64.lds.S b/plat/kvm/x86/link64.lds.S index 2a258e5d..5c63e4af 100644 --- a/plat/kvm/x86/link64.lds.S +++ b/plat/kvm/x86/link64.lds.S @@ -43,7 +43,9 @@ SECTIONS } _etext = .; - INCLUDE plat/common/x86/link64.lds + EXCEPTION_SECTIONS + + CTORTAB_SECTION /* Read-only data */ . = ALIGN(0x1000); diff --git a/plat/linuxu/arm/link.lds.S b/plat/linuxu/arm/link.lds.S index 6f45fd8b..8a731c5c 100644 --- a/plat/linuxu/arm/link.lds.S +++ b/plat/linuxu/arm/link.lds.S @@ -1,11 +1,7 @@ +#include <common.lds.h> + SECTIONS { - . = ALIGN(0x1000); - uk_ctortab = .; - .uk_ctortab : - { - KEEP(*(SORT_BY_NAME(.uk_ctortab[0-7]))) - LONG(0) - } + CTORTAB_SECTION } INSERT AFTER .rodata diff --git a/plat/linuxu/x86/link64.lds.S b/plat/linuxu/x86/link64.lds.S index 077aaf66..46034477 100644 --- a/plat/linuxu/x86/link64.lds.S +++ b/plat/linuxu/x86/link64.lds.S @@ -1,6 +1,10 @@ +#include <common.lds.h> + SECTIONS { - INCLUDE plat/common/x86/link64.lds + EXCEPTION_SECTIONS + + CTORTAB_SECTION } INSERT AFTER .rodata diff --git a/plat/xen/arm/link32.lds.S b/plat/xen/arm/link32.lds.S index 9af25f15..8bbefa64 100644 --- a/plat/xen/arm/link32.lds.S +++ b/plat/xen/arm/link32.lds.S @@ -49,26 +49,7 @@ SECTIONS _etext = .; /* End of text section */ - /* Exception frame */ - . = ALIGN(4096); - __eh_frame_start = .; - .eh_frame : - { - *(.eh_frame) - *(.eh_frame.*) - } - __eh_frame_end = .; - - - /* Exception frame header */ - __eh_frame_hdr_start = .; - .eh_frame_hdr : - { - *(.eh_frame_hdr) - *(.eh_frame_hdr.*) - } - . = ALIGN(4096); - __eh_frame_hdr_end = .; + EXCEPTION_SECTIONS /* Read-only data */ _rodata = .; @@ -80,13 +61,7 @@ SECTIONS . = ALIGN(4096); _erodata = .; - uk_ctortab = .; - .uk_ctortab : - { - KEEP(*(SORT_BY_NAME(.uk_ctortab[0-7]))) - LONG(0) - } - . = ALIGN(4096); + CTORTAB_SECTION . = ALIGN(0x8); _ctors = .; diff --git a/plat/xen/x86/link64.lds.S b/plat/xen/x86/link64.lds.S index 44a9deb9..116a12e8 100644 --- a/plat/xen/x86/link64.lds.S +++ b/plat/xen/x86/link64.lds.S @@ -41,7 +41,9 @@ SECTIONS _etext = .; /* End of text section */ - INCLUDE plat/common/x86/link64.lds + EXCEPTION_SECTIONS + + CTORTAB_SECTION _rodata = .; .rodata : { -- 2.21.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |