hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit d0be4a65a027d7d3c1a37aadffc3452128e4977c
parent dc8868223dc5c6794fda75776a7b07bebde9d1f0
Author: Alexey Yerin <yyp@disroot.org>
Date:   Tue, 12 Dec 2023 22:17:57 +0300

+libc: Avoid overriding the default linker script on other platforms

Similar to how OpenBSD does it.

'.dynamic' was chosen because it's usually after RELRO sections and prevents
"section is not contiguous with other relro sections" linker error.

Signed-off-by: Alexey Yerin <yyp@disroot.org>

Diffstat:
Mrt/+freebsd/hare+libc.sc | 46+++++++---------------------------------------
Mrt/+linux/hare+libc.sc | 46+++++++---------------------------------------
2 files changed, 14 insertions(+), 78 deletions(-)

diff --git a/rt/+freebsd/hare+libc.sc b/rt/+freebsd/hare+libc.sc @@ -1,44 +1,12 @@ SECTIONS { - . = 0x8000000; - .text : { - KEEP (*(.text)) - *(.text.*) - } - . = 0x80000000; - .data : { - KEEP (*(.data)) - *(.data.*) - } - - .rela.plt : { - *(.rela.plt) - } - - .init_array : { - PROVIDE_HIDDEN (__init_array_start = .); - PROVIDE_HIDDEN (__init_array_end = .); - } - .libc_init_array : { - PROVIDE_HIDDEN (__libc_init_array_start = .); - KEEP (*(.init_array)) - PROVIDE_HIDDEN (__libc_init_array_end = .); - } - - .fini_array : { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); + PROVIDE(__libc_init_array_start = .); + KEEP(*(.init_array)) + PROVIDE(__libc_init_array_end = .); } - .test_array : { - PROVIDE_HIDDEN (__test_array_start = .); - KEEP (*(.test_array)) - PROVIDE_HIDDEN (__test_array_end = .); - } - - .bss : { - KEEP (*(.bss)) - *(.bss.*) + PROVIDE(__test_array_start = .); + KEEP(*(.test_array*)) + PROVIDE(__test_array_end = .); } -} +} INSERT AFTER .dynamic; diff --git a/rt/+linux/hare+libc.sc b/rt/+linux/hare+libc.sc @@ -1,44 +1,12 @@ SECTIONS { - . = 0x8000000; - .text : { - KEEP (*(.text)) - *(.text.*) - } - . = 0x80000000; - .data : { - KEEP (*(.data)) - *(.data.*) - } - - .rela.plt : { - *(.rela.plt) - } - - .init_array : { - PROVIDE_HIDDEN (__init_array_start = .); - PROVIDE_HIDDEN (__init_array_end = .); - } - .libc_init_array : { - PROVIDE_HIDDEN (__libc_init_array_start = .); - KEEP (*(.init_array)) - PROVIDE_HIDDEN (__libc_init_array_end = .); - } - - .fini_array : { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); + PROVIDE(__libc_init_array_start = .); + KEEP(*(.init_array)) + PROVIDE(__libc_init_array_end = .); } - .test_array : { - PROVIDE_HIDDEN (__test_array_start = .); - KEEP (*(.test_array)) - PROVIDE_HIDDEN (__test_array_end = .); - } - - .bss : { - KEEP (*(.bss)) - *(.bss.*) + PROVIDE(__test_array_start = .); + KEEP(*(.test_array*)) + PROVIDE(__test_array_end = .); } -} +} INSERT AFTER .dynamic;