summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2021-02-18 16:27:09 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2021-02-18 16:27:09 +0000
commitc4a53b6d562a630fbd8c8262e40eea04f0aec3c9 (patch)
tree351223c210a49e6dd2e8ac94a55f5490f7556410 /sys/arch
parentbb43b48767169674e9c8d337d5bd582cc9134e58 (diff)
Make kernel ld.script similar to octeon's on loongson and sgi.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/loongson/conf/ld.script44
-rw-r--r--sys/arch/sgi/conf/ld.script44
2 files changed, 74 insertions, 14 deletions
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)