From 55f429bd0eb2c750513f721a123b5e8bfbe45d42 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Wed, 30 Dec 2020 19:03:56 +0100 Subject: [PATCH] sparc: split the kernel into separate data and exec regions This is what our bootloader expects. For some reason, ld does this by default on x86, but not on other platforms. So, define the headers ourselves. Change-Id: I4b37938e7e6d48b19c8af68cf4a77193269335d4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3569 Reviewed-by: waddlesplash --- src/system/ldscripts/sparc/kernel.ld | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/system/ldscripts/sparc/kernel.ld b/src/system/ldscripts/sparc/kernel.ld index 07866a664c..58809ffff1 100644 --- a/src/system/ldscripts/sparc/kernel.ld +++ b/src/system/ldscripts/sparc/kernel.ld @@ -2,11 +2,20 @@ OUTPUT_FORMAT("elf64-sparc") OUTPUT_ARCH(sparc:v9) ENTRY(_start) + +PHDRS +{ + headers PT_PHDR PHDRS ; + text PT_LOAD FILEHDR PHDRS ; + data PT_LOAD ; + dynamic PT_DYNAMIC ; +} + SECTIONS { . = 0xFFFFFFFF80000000 + SIZEOF_HEADERS; - .interp : { *(.interp) } + .interp : { *(.interp) } : text .hash : { *(.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } @@ -24,19 +33,19 @@ SECTIONS .plt : { *(.plt) } /* text/read-only data */ - .text : { *(.text .text.* .gnu.linkonce.t.*) } =0x90909090 + .text : { *(.text .text.* .gnu.linkonce.t.*) } :text =0x90909090 - .rodata : { *(.rodata) } + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } . = ALIGN(0x8); altcodepatch_begin = .; .altcodepatch : { *(.altcodepatch) } altcodepatch_end = .; - /* writable data */ - . = ALIGN(0x1000); + /* writable data */ + . = ALIGN (0x1000); __data_start = .; - .data : { *(.data .gnu.linkonce.d.*) } + .data : { *(.data .data.* .gnu.linkonce.d.*) } :data . = ALIGN(0x4); __ctor_list = .; @@ -46,11 +55,11 @@ SECTIONS .dtors : { *(.dtors) } __dtor_end = .; .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } + .dynamic : { *(.dynamic) } :dynamic :data /* uninitialized data (in same segment as writable data) */ __bss_start = .; - .bss : { *(.bss) } + .bss : { *(.bss .bss.* .gnu.linkonce.b.*) } :data . = ALIGN(0x1000); _end = . ;