From 89b059cace59a2c6dd8d4920b02cac75053a37db Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 7 Nov 2020 15:43:30 +0100 Subject: [PATCH] Allocate .sbss and .common into .bss GNU ld fragments .bss into .sbss and .common (see man nm(1) for further reference). However, the linker script used by PSXSDK did not determine where to put such sections, causing some statically allocated objects to be placed **after** __bss_end, leading to undefined behaviour. --- misc/genscripts.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/misc/genscripts.sh b/misc/genscripts.sh index 755bca4..5fafa33 100755 --- a/misc/genscripts.sh +++ b/misc/genscripts.sh @@ -50,6 +50,13 @@ SECTIONS .bss ALIGN(4) : { *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) } __text_start = ADDR(.text);