From 2747433c7fbc7e4659b7b83657c64d22e3ca9777 Mon Sep 17 00:00:00 2001 From: jaby Date: Mon, 29 Aug 2022 08:43:59 +0200 Subject: [PATCH] More Linker Script improvements --- lib/pcsx-redux/ps-exe.ld | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/pcsx-redux/ps-exe.ld b/lib/pcsx-redux/ps-exe.ld index bc5bb41f..895a89d7 100644 --- a/lib/pcsx-redux/ps-exe.ld +++ b/lib/pcsx-redux/ps-exe.ld @@ -52,24 +52,39 @@ __stack_start = ORIGIN(ram) + LENGTH(ram); __heap_base = __planschi_end; SECTIONS { - __planschi_start = .; + /DISCARD/ : { *(.MIPS.abiflags) } + + /* Everything is statically linked, so discard PLTs. */ + /DISCARD/ : { *(.rel.iplt) *(.rela.iplt) *(.rel.plt) *(.rela.plt) *(.plt) *(.iplt) } + + /* Discard things that the standard link script drops, too. */ + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu.*) *(.comment) } +} + +SECTIONS { + __boot_loader_start = .; + __planschi_start = .; OVERLAY __bss_end : NOCROSSREFS SUBALIGN(4) { .planschi { *libJabyEngine.a:start.o(.text.startup._GLOBAL__*) *libJabyEngine.a:start.o(.ctors) - *libJabyEngine.a:start.o(.text.*) + *libJabyEngine.a:start.o(*) + + /* Old order + *libJabyEngine.a:start.o(.text.*) *libJabyEngine.a:start.o(.rodata*) *libJabyEngine.a:start.o(.sdata*) *libJabyEngine.a:start.o(.data*) *libJabyEngine.a:start.o(.sbss*) - *libJabyEngine.a:start.o(.bss*) + *libJabyEngine.a:start.o(.bss*)*/ } } + __boot_loader_end = .; /*Only needed for the PSX BIOS to load the entire game*/ . = ALIGN(2048); - __planschi_end = .; + __planschi_end = .; } SECTIONS { @@ -207,12 +222,4 @@ SECTIONS { . = ADDR(.text) - 0x800; __end = .; - - /DISCARD/ : { *(.MIPS.abiflags) } - - /* Everything is statically linked, so discard PLTs. */ - /DISCARD/ : { *(.rel.iplt) *(.rela.iplt) *(.rel.plt) *(.rela.plt) *(.plt) *(.iplt) } - - /* Discard things that the standard link script drops, too. */ - /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } }