From: visa Date: Thu, 18 Feb 2021 16:27:07 +0000 (+0000) Subject: Make kernel ld.script similar to octeon's on loongson and sgi. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bd694fdc92c3679f2f75b304162387822064c866;p=openbsd Make kernel ld.script similar to octeon's on loongson and sgi. --- diff --git a/sys/arch/loongson/conf/ld.script b/sys/arch/loongson/conf/ld.script index d529e3df319..49adf31254b 100644 --- a/sys/arch/loongson/conf/ld.script +++ b/sys/arch/loongson/conf/ld.script @@ -1,27 +1,57 @@ +/* $OpenBSD: ld.script,v 1.5 2021/02/18 16:27:07 visa Exp $ */ + OUTPUT_FORMAT("elf64-tradlittlemips") OUTPUT_ARCH(mips) ENTRY(__start) +PHDRS +{ + text PT_LOAD; + openbsd_randomize PT_OPENBSD_RANDOMIZE; +} + SECTIONS { - .text : { *(.text .text.* .gnu.linkonce.t.*) } + .text : + { + *(.text .text.* .gnu.linkonce.t.*) + } :text PROVIDE (etext = .); - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .data : { *(.data .data.* .gnu.linkonce.d.*) } + .rodata : + { + *(.rodata .rodata.* .gnu.linkonce.r.*) + } :text + + . = ALIGN(8); + PROVIDE (__kernel_randomdata = .); .openbsd.randomdata : { - /* XXX shouldn't this be placed next to rodata? */ __retguard_start = ABSOLUTE(.); *(.openbsd.randomdata.retguard .openbsd.randomdata.retguard.*) /* XXX . = ALIGN(0x1000); */ __retguard_end = ABSOLUTE(.); *(.openbsd.randomdata .openbsd.randomdata.*) - } + } :text :openbsd_randomize + . = ALIGN(8); + PROVIDE (__kernel_randomdata_end = .); + + .data : + { + *(.data .data.* .gnu.linkonce.d.*) + } :text PROVIDE (edata = .); - .sbss : { *(.sbss .sbss.* .gnu.linkonce.sb.* .scommon) } - .bss : { *(.bss .bss.* .gnu.linkonce.b.* COMMON) } + .sbss : + { + *(.sbss .sbss.* .gnu.linkonce.sb.* .scommon) + } + .bss : + { + *(.bss .bss.* .gnu.linkonce.b.* COMMON) + } + . = ALIGN(8); PROVIDE (_end = .); PROVIDE (end = .); + /DISCARD/ : { *(.pdr) diff --git a/sys/arch/sgi/conf/ld.script b/sys/arch/sgi/conf/ld.script index 99134c0ea6e..85a74ec1049 100644 --- a/sys/arch/sgi/conf/ld.script +++ b/sys/arch/sgi/conf/ld.script @@ -1,27 +1,57 @@ +/* $OpenBSD: ld.script,v 1.10 2021/02/18 16:27:08 visa Exp $ */ + OUTPUT_FORMAT("elf64-tradbigmips") OUTPUT_ARCH(mips) ENTRY(__start) +PHDRS +{ + text PT_LOAD; + openbsd_randomize PT_OPENBSD_RANDOMIZE; +} + SECTIONS { - .text : { *(.text .text.* .gnu.linkonce.t.*) } + .text : + { + *(.text .text.* .gnu.linkonce.t.*) + } :text PROVIDE (etext = .); - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .data : { *(.data .data.* .gnu.linkonce.d.*) } + .rodata : + { + *(.rodata .rodata.* .gnu.linkonce.r.*) + } :text + + . = ALIGN(8); + PROVIDE (__kernel_randomdata = .); .openbsd.randomdata : { - /* XXX shouldn't this be placed next to rodata? */ __retguard_start = ABSOLUTE(.); *(.openbsd.randomdata.retguard .openbsd.randomdata.retguard.*) /* XXX . = ALIGN(0x1000); */ __retguard_end = ABSOLUTE(.); *(.openbsd.randomdata .openbsd.randomdata.*) - } + } :text :openbsd_randomize + . = ALIGN(8); + PROVIDE (__kernel_randomdata_end = .); + + .data : + { + *(.data .data.* .gnu.linkonce.d.*) + } :text PROVIDE (edata = .); - .sbss : { *(.sbss .sbss.* .gnu.linkonce.sb.* .scommon) } - .bss : { *(.bss .bss.* .gnu.linkonce.b.* COMMON) } + .sbss : + { + *(.sbss .sbss.* .gnu.linkonce.sb.* .scommon) + } + .bss : + { + *(.bss .bss.* .gnu.linkonce.b.* COMMON) + } + . = ALIGN(8); PROVIDE (_end = .); PROVIDE (end = .); + /DISCARD/ : { *(.pdr)