From 864a3f996b5ae9820b6b32b59b91564a8f714b98 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Mon, 20 May 2019 23:07:00 +0200 Subject: [PATCH] sparc: do not leave a hole between .text and .data The a.out format does not allow to handle this properly. So we need the two sections to be contiguous. Change-Id: I44455d4fb728bd47d5dcebc48c52b7d90d808104 Reviewed-on: https://review.haiku-os.org/c/1469 Reviewed-by: waddlesplash --- .../sparc/boot_loader_openfirmware.ld | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/system/ldscripts/sparc/boot_loader_openfirmware.ld b/src/system/ldscripts/sparc/boot_loader_openfirmware.ld index 3449242731..18b9e9b63d 100644 --- a/src/system/ldscripts/sparc/boot_loader_openfirmware.ld +++ b/src/system/ldscripts/sparc/boot_loader_openfirmware.ld @@ -5,21 +5,26 @@ ENTRY(_start) SECTIONS { + /* Execution address. The file is loaded at 0x4000 with its header, + * then relocated here. */ . = 0x202000; - __text_begin = .; + /* keep text and data sections next to each other, as the loader in openboot + * is not able to handle a hole between them. + */ + /* text/read-only data */ - .text : { *(.text.start) /* Make sure entry point is at start of file */ + .text : { + /* Make sure entry point is at start of file. Not required, since + * it is set using ENTRY above, but it looks nicer and makes it + * clearer we jumped at the correct address. */ + *(.text.start) + *(.text .text.* .gnu.linkonce.t.*) *(.rodata .rodata.* .gnu.linkonce.r.*) *(.sdata2) } - /* writable data */ - /* align to the same offset in the next page (for performance reasons - (not that it really matters in the boot loader)) */ - . = ALIGN(0x1000) + 0x1000 + (. & (0x1000 - 1)); - .data : { __ctor_list = .; *(.ctors)