[haiku-commits] Change in haiku[master]: sparc: split the kernel into separate data and exec regions

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 30 Dec 2020 18:07:02 +0000

From Adrien Destugues <pulkomandy@xxxxxxxxx>:

Adrien Destugues has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3569 ;)


Change subject: sparc: split the kernel into separate data and exec regions
......................................................................

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.
---
M src/system/ldscripts/sparc/kernel.ld
1 file changed, 17 insertions(+), 8 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/69/3569/1

diff --git a/src/system/ldscripts/sparc/kernel.ld 
b/src/system/ldscripts/sparc/kernel.ld
index 07866a6..58809ff 100644
--- a/src/system/ldscripts/sparc/kernel.ld
+++ b/src/system/ldscripts/sparc/kernel.ld
@@ -2,11 +2,20 @@
 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 @@
        .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 @@
        .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 = . ;

--
To view, visit https://review.haiku-os.org/c/haiku/+/3569
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I4b37938e7e6d48b19c8af68cf4a77193269335d4
Gerrit-Change-Number: 3569
Gerrit-PatchSet: 1
Gerrit-Owner: Adrien Destugues <pulkomandy@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: sparc: split the kernel into separate data and exec regions - Gerrit