From 8bdb40a69cbfd32e05d82d5faf209c76eb80c7c0 Mon Sep 17 00:00:00 2001 From: Alexander Reim Date: Mon, 19 Oct 2020 11:21:22 +0200 Subject: [PATCH] WII: Update linkscript and fix for linker false error message --- backends/plugins/wii/plugin.ld | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/backends/plugins/wii/plugin.ld b/backends/plugins/wii/plugin.ld index 61b90d33946..b64fef7f819 100644 --- a/backends/plugins/wii/plugin.ld +++ b/backends/plugins/wii/plugin.ld @@ -4,6 +4,8 @@ OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc"); OUTPUT_ARCH(powerpc:common); +EXTERN(_start); +ENTRY(_start); PHDRS { @@ -12,14 +14,26 @@ PHDRS SECTIONS { - . = 0x81000000; + /* stub is loaded at physical address 0x00003400 (though both 0x80003400 and 0x00003400 are equivalent for IOS) */ + /* This can also be used to load an arbitrary standalone stub at an arbitrary address in memory, for any purpose */ + /* Use -Wl,--section-start,.stub=0xADDRESS to change */ + . = 0x00003400; + + .stub : + { + KEEP(*(.stub)) + } :plugin = 0 + + /* default base address */ + /* use -Wl,--section-start,.init=0xADDRESS to change */ + . = 0x80004000; /* Program */ .init : { KEEP (*crt0.o(*.init)) KEEP (*(.init)) - } :plugin = 0 + } = 0 .plt : { *(.plt) } .interp : { *(.interp) } .hash : { *(.hash) } @@ -85,7 +99,12 @@ SECTIONS .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } .rodata1 : { *(.rodata1) } - .sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) } + .sdata2 : { + PROVIDE(_SDA2_BASE_ = .); + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + } .sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ @@ -128,6 +147,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ___plugin_ctors_end = .; + . += 10; /* fix for linker false error message */ . = ALIGN(32); /* REQUIRED. LD is flaky without it. */ } @@ -150,6 +170,7 @@ SECTIONS .sdata : { + PROVIDE(_SDA_BASE_ = .); *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) @@ -238,7 +259,7 @@ __stack_end = (__bss_start + SIZEOF(.bss)); __intrstack_addr = (__stack_addr + 0x4000); __intrstack_end = (__stack_addr); __Arena1Lo = (__intrstack_addr + 31) & (-32); -__Arena1Hi = (0x816ffff0); +__Arena1Hi = (0x817FEFF0); __Arena2Lo = (0x90002000); __Arena2Hi = (0x933E0000); @@ -247,7 +268,7 @@ __ipcbufferLo = (0x933e0000); __ipcbufferHi = (0x93400000); /* for backward compatibility with old crt0 */ -PROVIDE (__stack = (0x816ffff0)); +PROVIDE (__stack = (0x817FEFF0)); PROVIDE(__isIPL = __isIPL); PROVIDE(__stack_addr = __stack_addr);