From: patrick Date: Sat, 10 Feb 2018 06:52:47 +0000 (+0000) Subject: Put the ldscript parts into a single file instead of storing it as head X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=69e72f4e91bc3b4aa05108ecd763078497c7d584;p=openbsd Put the ldscript parts into a single file instead of storing it as head and tail and cat(1) it together. It was maybe needed when ports needed different contents, but now it's just a headache. ok deraadt@ --- diff --git a/sys/arch/arm/conf/kern.ldscript b/sys/arch/arm/conf/kern.ldscript new file mode 100644 index 00000000000..77fc9948f47 --- /dev/null +++ b/sys/arch/arm/conf/kern.ldscript @@ -0,0 +1,81 @@ +/* $OpenBSD: kern.ldscript,v 1.1 2018/02/10 06:52:47 patrick Exp $ */ +/* $NetBSD: ldscript.evbarm,v 1.2 2003/03/05 23:54:22 thorpej Exp $ */ + +OUTPUT_ARCH(arm) +ENTRY(KERNEL_BASE_phys) +SECTIONS +{ + KERNEL_BASE_phys = @KERNEL_BASE_PHYS@; + KERNEL_BASE_virt = @KERNEL_BASE_VIRT@; + + /* Kernel start: */ + .start (KERNEL_BASE_phys) : + { + *(.start) + } =0 + + /* Read-only sections, merged into text segment: */ + .text (KERNEL_BASE_virt + SIZEOF(.start)) : + AT (LOADADDR(.start) + SIZEOF(.start)) + { + *(.text) + *(.text.*) + *(.stub) + *(.glue_7t) *(.glue_7) + *(.rodata) *(.rodata.*) + } =0 + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + /* Adjust the address for the data segment to start on the next page + boundary. */ + . = ALIGN(0x8000); + .data : + AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text))) + { + __data_start = . ; + *(.data) + *(.data.*) + } + .sdata : + AT (LOADADDR(.data) + (ADDR(.sdata) - ADDR(.data))) + { + *(.sdata) + *(.sdata.*) + } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + __bss_start__ = .; + .sbss : + { + PROVIDE (__sbss_start = .); + PROVIDE (___sbss_start = .); + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.scommon) + PROVIDE (__sbss_end = .); + PROVIDE (___sbss_end = .); + } + .bss : + { + *(.dynbss) + *(.bss) + *(.bss.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = .; + _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; + PROVIDE (end = .); + /DISCARD/ : + { + *(.ARM.exidx) + } +} + diff --git a/sys/arch/arm/conf/ldscript.head b/sys/arch/arm/conf/ldscript.head deleted file mode 100644 index 7cc5b7fa873..00000000000 --- a/sys/arch/arm/conf/ldscript.head +++ /dev/null @@ -1,26 +0,0 @@ -/* $OpenBSD: ldscript.head,v 1.2 2005/01/02 19:57:57 drahn Exp $ */ -/* $NetBSD: ldscript.evbarm,v 1.2 2003/03/05 23:54:22 thorpej Exp $ -*/ - -OUTPUT_ARCH(arm) -ENTRY(KERNEL_BASE_phys) -SECTIONS -{ - KERNEL_BASE_phys = @KERNEL_BASE_PHYS@; - KERNEL_BASE_virt = @KERNEL_BASE_VIRT@; - - /* Kernel start: */ - .start (KERNEL_BASE_phys) : - { - *(.start) - } =0 - - /* Read-only sections, merged into text segment: */ - .text (KERNEL_BASE_virt + SIZEOF(.start)) : - AT (LOADADDR(.start) + SIZEOF(.start)) - { - *(.text) - *(.text.*) - *(.stub) - *(.glue_7t) *(.glue_7) - *(.rodata) *(.rodata.*) diff --git a/sys/arch/arm/conf/ldscript.tail b/sys/arch/arm/conf/ldscript.tail deleted file mode 100644 index 36579dcaa4a..00000000000 --- a/sys/arch/arm/conf/ldscript.tail +++ /dev/null @@ -1,57 +0,0 @@ -/* $OpenBSD: ldscript.tail,v 1.5 2017/10/26 19:01:06 kettenis Exp $ */ - } =0 - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - /* Adjust the address for the data segment to start on the next page - boundary. */ - . = ALIGN(0x8000); - .data : - AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text))) - { - __data_start = . ; - *(.data) - *(.data.*) - } - .sdata : - AT (LOADADDR(.data) + (ADDR(.sdata) - ADDR(.data))) - { - *(.sdata) - *(.sdata.*) - } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - __bss_start__ = .; - .sbss : - { - PROVIDE (__sbss_start = .); - PROVIDE (___sbss_start = .); - *(.dynsbss) - *(.sbss) - *(.sbss.*) - *(.scommon) - PROVIDE (__sbss_end = .); - PROVIDE (___sbss_end = .); - } - .bss : - { - *(.dynbss) - *(.bss) - *(.bss.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. */ - . = ALIGN(32 / 8); - } - . = ALIGN(32 / 8); - _end = .; - _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; - PROVIDE (end = .); - /DISCARD/ : - { - *(.ARM.exidx) - } -} - diff --git a/sys/arch/armv7/conf/Makefile.armv7 b/sys/arch/armv7/conf/Makefile.armv7 index 9b77191dcc7..fe0564e4a8a 100644 --- a/sys/arch/armv7/conf/Makefile.armv7 +++ b/sys/arch/armv7/conf/Makefile.armv7 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.armv7,v 1.39 2018/02/09 03:59:15 tb Exp $ +# $OpenBSD: Makefile.armv7,v 1.40 2018/02/10 06:52:47 patrick Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -119,8 +119,8 @@ mcount.o: $S/lib/libkern/mcount.c Makefile ioconf.o: ioconf.c ${NORMAL_C} -ld.script: ${_archdir}/conf/ldscript.head ${_archdir}/conf/ldscript.tail - cat ${_archdir}/conf/ldscript.head ${_archdir}/conf/ldscript.tail | \ +ld.script: ${_archdir}/conf/kern.ldscript + cat ${_archdir}/conf/kern.ldscript | \ sed -e 's/@KERNEL_BASE_PHYS@/0/' \ -e 's/@KERNEL_BASE_VIRT@/${KERNEL_BASE_VIRT}/' \ -e 's/(KERNEL_BASE_phys)/(KERNEL_BASE_virt)/' > ld.script