diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2023-01-11 16:31:47 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2023-01-11 16:31:47 +0000 |
commit | ed3eefe7e46420428d66da897ca9c21ea1c63ac5 (patch) | |
tree | b5353ea58e49233cc9bcb6a7d6bc2d16722cffbd /libexec | |
parent | bc53315d8a604ab169021c0ab1eaa1a08be6b50e (diff) |
Add ld.so linker scripts on the remaining platforms.
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/m88k/Makefile.inc | 4 | ||||
-rw-r--r-- | libexec/ld.so/m88k/ld.script | 65 | ||||
-rw-r--r-- | libexec/ld.so/sh/Makefile.inc | 4 | ||||
-rw-r--r-- | libexec/ld.so/sh/ld.script | 65 |
4 files changed, 136 insertions, 2 deletions
diff --git a/libexec/ld.so/m88k/Makefile.inc b/libexec/ld.so/m88k/Makefile.inc index e9aea23bde4..16d92dadc9a 100644 --- a/libexec/ld.so/m88k/Makefile.inc +++ b/libexec/ld.so/m88k/Makefile.inc @@ -1,6 +1,8 @@ -# $OpenBSD: Makefile.inc,v 1.3 2019/10/20 03:44:49 guenther Exp $ +# $OpenBSD: Makefile.inc,v 1.4 2023/01/11 16:31:46 miod Exp $ CFLAGS += -fpic SRCS+= memcpy.c +LD_SCRIPT = ${.CURDIR}/${MACHINE_CPU}/ld.script + RELATIVE_RELOC=R_88K_BBASED_32 diff --git a/libexec/ld.so/m88k/ld.script b/libexec/ld.so/m88k/ld.script new file mode 100644 index 00000000000..84c3015fafb --- /dev/null +++ b/libexec/ld.so/m88k/ld.script @@ -0,0 +1,65 @@ +PHDRS +{ + rodata PT_LOAD FILEHDR PHDRS FLAGS (4); + text PT_LOAD; + btext PT_LOAD FLAGS (0x08000005); + data PT_LOAD; + random PT_OPENBSD_RANDOMIZE; + relro PT_GNU_RELRO; + dynamic PT_DYNAMIC; + note PT_NOTE; +} + +SECTIONS +{ + . = 0 + SIZEOF_HEADERS; + /* RODATA */ + .gnu.hash : { *(.gnu.hash) } :rodata + .dynsym : { *(.dynsym) } :rodata + .dynstr : { *(.dynstr) } :rodata + .rodata : { *(.rodata .rodata.*) } :rodata + .eh_frame : { *(.eh_frame) } :rodata + + /* TEXT */ + . = ALIGN(0x1000); + .boot.text : + { + boot_text_start = .; + . = ALIGN(0x1000); + *(.boot.text) + boot_text_end = .; + } :btext =0xf4005800 + . = ALIGN(0x1000); + .text : { *(.text .text.*) } :text =0xf4005800 + + /* RELRO DATA */ + . = DATA_SEGMENT_ALIGN (0x10000, 0x1000); + .openbsd.randomdata : { *(.openbsd.randomdata .openbsd.randomdata.*) } + :data :relro :random + .data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro + .dynamic : { *(.dynamic) } :data :relro :dynamic + .got : { *(.got.plt) *(.got) } :data :relro + . = DATA_SEGMENT_RELRO_END (0, .); + + /* BOOTDATA */ + . = ALIGN(0x1000); + boot_data_start = .; + .rela.dyn : + { + *(.rela.text .rela.text.*) + *(.rela.rodata .rela.rodata.*) + *(.rela.data .rela.data.*) + *(.rela.got) + *(.rela.bss .rela.bss.*) + } :data + .rela.plt : { *(.rela.plt) } :data + .note : { *(.note.openbsd.*) } :data :note + .hash : { *(.hash) } :data + .boot.data : { *(.boot.data .boot.data.*) } :data + + /* DATA */ + . = ALIGN(0x1000); + .data : { *(.data .data.*) } :data + .bss : { *(.dynbss) *(.bss .bss.*) *(COMMON) } :data + . = DATA_SEGMENT_END (.); +} diff --git a/libexec/ld.so/sh/Makefile.inc b/libexec/ld.so/sh/Makefile.inc index a1fb482334c..1a7f913531b 100644 --- a/libexec/ld.so/sh/Makefile.inc +++ b/libexec/ld.so/sh/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.9 2019/10/20 03:44:49 guenther Exp $ +# $OpenBSD: Makefile.inc,v 1.10 2023/01/11 16:31:46 miod Exp $ CFLAGS += -fpic CFLAGS+=-m4-nofpu @@ -11,4 +11,6 @@ ${MDOBJ}: ar x `$(CC) -print-libgcc-file-name` ${MDOBJ} OBJS+=${MDOBJ} +LD_SCRIPT = ${.CURDIR}/${MACHINE_CPU}/ld.script + RELATIVE_RELOC=R_SH_RELATIVE diff --git a/libexec/ld.so/sh/ld.script b/libexec/ld.so/sh/ld.script new file mode 100644 index 00000000000..1b84e5bc1a1 --- /dev/null +++ b/libexec/ld.so/sh/ld.script @@ -0,0 +1,65 @@ +PHDRS +{ + rodata PT_LOAD FILEHDR PHDRS FLAGS (4); + text PT_LOAD; + btext PT_LOAD FLAGS (0x08000005); + data PT_LOAD; + random PT_OPENBSD_RANDOMIZE; + relro PT_GNU_RELRO; + dynamic PT_DYNAMIC; + note PT_NOTE; +} + +SECTIONS +{ + /* RODATA */ + . = 0 + SIZEOF_HEADERS; + .gnu.hash : { *(.gnu.hash) } :rodata + .dynsym : { *(.dynsym) } :rodata + .dynstr : { *(.dynstr) } :rodata + .rodata : { *(.rodata .rodata.*) } :rodata + .eh_frame : { *(.eh_frame) } :rodata + + /* TEXT */ + . = ALIGN (0x1000); + .text : { *(.text .text.*) } :text =0xc3c3c3c3 + . = ALIGN (0x1000); + .boot.text : + { + boot_text_start = .; + *(.boot.text) + boot_text_end = .; + } :btext + + /* RELRO DATA */ + . = DATA_SEGMENT_ALIGN (0x10000, 0x1000); + .openbsd.randomdata : { *(.openbsd.randomdata .openbsd.randomdata.*) } + :data :relro :random + .data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro + .dynamic : { *(.dynamic) } :data :relro :dynamic + .got : { *(.got.plt) *(.got) } :data :relro + . = DATA_SEGMENT_RELRO_END (0, .); + + /* BOOTDATA */ + . = ALIGN (0x1000); + boot_data_start = .; + .rela.dyn : + { + *(.rela.text .rela.text.*) + *(.rela.rodata .rela.rodata.*) + *(.rela.data .rela.data.*) + *(.rela.got) + *(.rela.bss .rela.bss.*) + } :data + .rela.plt : { *(.rela.plt) } :data + .hash : { *(.hash) } :data + .note : { *(.note.openbsd.* ) } :data :note + .boot.data : { *(.boot.data .boot.data.*) } :data + boot_data_end = .; + + /* DATA */ + . = ALIGN (0x1000); + .data : { *(.data .data.*) } :data + .bss : { *(.dynbss) *(.bss .bss.*) *(COMMON) } :data + . = DATA_SEGMENT_END (.); +} |