From 5f22109207efa29eeccc8198d7efceab0a10e067 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 18 Nov 2014 01:11:14 +0000 Subject: rename ld.script to same name as other architectures --- sys/arch/amd64/conf/Makefile.amd64 | 4 +- sys/arch/amd64/conf/kern.ldscript | 125 ------------------------------------- sys/arch/amd64/conf/ld.script | 125 +++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 127 deletions(-) delete mode 100644 sys/arch/amd64/conf/kern.ldscript create mode 100644 sys/arch/amd64/conf/ld.script (limited to 'sys/arch/amd64') diff --git a/sys/arch/amd64/conf/Makefile.amd64 b/sys/arch/amd64/conf/Makefile.amd64 index 6db6e19d920..1324bf241ee 100644 --- a/sys/arch/amd64/conf/Makefile.amd64 +++ b/sys/arch/amd64/conf/Makefile.amd64 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.amd64,v 1.62 2014/11/17 23:54:32 guenther Exp $ +# $OpenBSD: Makefile.amd64,v 1.63 2014/11/18 01:11:13 deraadt Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -42,7 +42,7 @@ CMACHFLAGS+= -Wa,-n COPTS?= -O2 CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} AFLAGS= -D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS} -LDSCRIPT= ${_machdir}/conf/kern.ldscript +LDSCRIPT= ${_machdir}/conf/ld.script LINKFLAGS= -T ${LDSCRIPT} -X --warn-common -nopie .if ${IDENT:M-DDDB_STRUCT} diff --git a/sys/arch/amd64/conf/kern.ldscript b/sys/arch/amd64/conf/kern.ldscript deleted file mode 100644 index 7a8960f6315..00000000000 --- a/sys/arch/amd64/conf/kern.ldscript +++ /dev/null @@ -1,125 +0,0 @@ -/* $OpenBSD: kern.ldscript,v 1.4 2014/11/17 23:54:32 guenther Exp $ */ - -/* - * Copyright (c) 2009 Tobias Weingartner - * - * Permission to use, copy, modify, and 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. - */ - -OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") -OUTPUT_ARCH(i386:x86-64) - -/* Define how we want out ELF binary to look like. */ -PHDRS -{ - text PT_LOAD FILEHDR PHDRS; - rodata PT_LOAD; - data PT_LOAD; - bss PT_LOAD; - openbsd_randomize 0x65a3dbe6; /* PT_OPENBSD_RANDOMIZE */ -} - -/* - * If we want the text/rodata/data sections aligned on 2M boundaries, - * we could use the following instead. Note, file size would increase - * due to necessary padding. - * - *__ALIGN_SIZE = 0x200000; - */ -__ALIGN_SIZE = 0x1000; -__kernel_base_virt = 0xffffffff81000000 + SIZEOF_HEADERS; -__kernel_base_phys = __kernel_base_virt & 0x7fffffff; - -/* We use physical address to jump to kernel */ -start_phys = LOADADDR(.text) + (start - __kernel_base_virt); -ENTRY(start_phys) -SECTIONS -{ - __kernel_text_virt = __kernel_base_virt; - __kernel_text_phys = __kernel_base_phys; - .text (__kernel_text_virt) : AT (__kernel_text_phys) - { - __text_start = ABSOLUTE(.) & 0xfffffffffffff000; - __text_size = SIZEOF(.text); - __text_load = LOADADDR(.text); - locore.o(.text) - *(.text .text.*) - } :text - PROVIDE (__etext = .); - PROVIDE (etext = .); - _etext = .; - - /* Move rodata to the next page, so we can nuke X and W bit on them */ - . = ALIGN(__ALIGN_SIZE); - __kernel_rodata_virt = .; - __kernel_rodata_phys = . & 0x7fffffff; - .rodata (__kernel_rodata_virt) : AT (__kernel_rodata_phys) - { - __rodata_start = ABSOLUTE(.); - __rodata_size = SIZEOF(.rodata); - __rodata_load = LOADADDR(.rodata); - *(.rodata .rodata.*) - } :rodata - PROVIDE (erodata = .); - _erodata = .; - - /* Move data to the next page, so we can add W bit on them */ - . = ALIGN(__ALIGN_SIZE); - __kernel_data_virt = .; - __kernel_data_phys = . & 0x7fffffff; - .data (__kernel_data_virt) : AT (__kernel_data_phys) - { - __data_start = ABSOLUTE(.); - __data_size = SIZEOF(.data); - __data_load = LOADADDR(.data); - *(.data .data.*) - } :data - . = ALIGN(0x1000); - __kernel_randomdata_phys = . & 0x7fffffff; - .openbsd.randomdata : AT (__kernel_randomdata_phys) - { - *(.openbsd.randomdata) - } :data :openbsd_randomize - . = ALIGN(0x1000); - PROVIDE (edata = .); - _edata = .; - - /* BSS starts right after padded data */ - __kernel_bss_virt = .; - __kernel_bss_phys = . & 0x7fffffff; - .bss (__kernel_bss_virt) : AT (__kernel_bss_phys) - { - __bss_start = ABSOLUTE(.); - __bss_size = SIZEOF(.bss); - __bss_load = LOADADDR(.bss); - *(.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(64 / 8); - } :bss - . = ALIGN(64 / 8); - _end = .; - PROVIDE (end = .); - - /* XXX - hack alert, since we are not C++, nuke these */ - /DISCARD/ : - { - *(.note.GNU-stack) - *(.eh_frame) - } -} - diff --git a/sys/arch/amd64/conf/ld.script b/sys/arch/amd64/conf/ld.script new file mode 100644 index 00000000000..4dc06ff4c0e --- /dev/null +++ b/sys/arch/amd64/conf/ld.script @@ -0,0 +1,125 @@ +/* $OpenBSD: ld.script,v 1.1 2014/11/18 01:11:13 deraadt Exp $ */ + +/* + * Copyright (c) 2009 Tobias Weingartner + * + * Permission to use, copy, modify, and 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. + */ + +OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") +OUTPUT_ARCH(i386:x86-64) + +/* Define how we want out ELF binary to look like. */ +PHDRS +{ + text PT_LOAD FILEHDR PHDRS; + rodata PT_LOAD; + data PT_LOAD; + bss PT_LOAD; + openbsd_randomize 0x65a3dbe6; /* PT_OPENBSD_RANDOMIZE */ +} + +/* + * If we want the text/rodata/data sections aligned on 2M boundaries, + * we could use the following instead. Note, file size would increase + * due to necessary padding. + * + *__ALIGN_SIZE = 0x200000; + */ +__ALIGN_SIZE = 0x1000; +__kernel_base_virt = 0xffffffff81000000 + SIZEOF_HEADERS; +__kernel_base_phys = __kernel_base_virt & 0x7fffffff; + +/* We use physical address to jump to kernel */ +start_phys = LOADADDR(.text) + (start - __kernel_base_virt); +ENTRY(start_phys) +SECTIONS +{ + __kernel_text_virt = __kernel_base_virt; + __kernel_text_phys = __kernel_base_phys; + .text (__kernel_text_virt) : AT (__kernel_text_phys) + { + __text_start = ABSOLUTE(.) & 0xfffffffffffff000; + __text_size = SIZEOF(.text); + __text_load = LOADADDR(.text); + locore.o(.text) + *(.text .text.*) + } :text + PROVIDE (__etext = .); + PROVIDE (etext = .); + _etext = .; + + /* Move rodata to the next page, so we can nuke X and W bit on them */ + . = ALIGN(__ALIGN_SIZE); + __kernel_rodata_virt = .; + __kernel_rodata_phys = . & 0x7fffffff; + .rodata (__kernel_rodata_virt) : AT (__kernel_rodata_phys) + { + __rodata_start = ABSOLUTE(.); + __rodata_size = SIZEOF(.rodata); + __rodata_load = LOADADDR(.rodata); + *(.rodata .rodata.*) + } :rodata + PROVIDE (erodata = .); + _erodata = .; + + /* Move data to the next page, so we can add W bit on them */ + . = ALIGN(__ALIGN_SIZE); + __kernel_data_virt = .; + __kernel_data_phys = . & 0x7fffffff; + .data (__kernel_data_virt) : AT (__kernel_data_phys) + { + __data_start = ABSOLUTE(.); + __data_size = SIZEOF(.data); + __data_load = LOADADDR(.data); + *(.data .data.*) + } :data + . = ALIGN(0x1000); + __kernel_randomdata_phys = . & 0x7fffffff; + .openbsd.randomdata : AT (__kernel_randomdata_phys) + { + *(.openbsd.randomdata) + } :data :openbsd_randomize + . = ALIGN(0x1000); + PROVIDE (edata = .); + _edata = .; + + /* BSS starts right after padded data */ + __kernel_bss_virt = .; + __kernel_bss_phys = . & 0x7fffffff; + .bss (__kernel_bss_virt) : AT (__kernel_bss_phys) + { + __bss_start = ABSOLUTE(.); + __bss_size = SIZEOF(.bss); + __bss_load = LOADADDR(.bss); + *(.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(64 / 8); + } :bss + . = ALIGN(64 / 8); + _end = .; + PROVIDE (end = .); + + /* XXX - hack alert, since we are not C++, nuke these */ + /DISCARD/ : + { + *(.note.GNU-stack) + *(.eh_frame) + } +} + -- cgit v1.2.3