From 4b57a4986725ac5584bb6a7d346dbc83efe2d454 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 18 Jul 2024 21:07:08 -0400 Subject: usr.sbin: Fix linker script Fix issue with memory addresses of globals being zeroed Signed-off-by: Ian Moffett --- usr.sbin/link.ld | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/usr.sbin/link.ld b/usr.sbin/link.ld index da2346d..9fad881 100644 --- a/usr.sbin/link.ld +++ b/usr.sbin/link.ld @@ -1,35 +1,26 @@ ENTRY(_start) -PHDRS -{ - text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; /* Execute + Read */ - rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */ - data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */ -} - SECTIONS { . = 0x10000; - .text : { + .text : + { *(.text) *(.text.*) - } :text - - .rodata : ALIGN(8) { - *(.rodata) - *(.rodata.*) - } :rodata + } - .data : ALIGN(8) { + .data : ALIGN(8) + { *(.data) *(.data.*) - } :data + } - .bss : ALIGN(8) { + .bss : ALIGN(8) + { __bss_start = .; *(.bss) *(.bss.*) __bss_end = .; - } :data + } } -- cgit v1.2.3