From 92206558fb4909a86626782e57e4b155bdecc16d Mon Sep 17 00:00:00 2001 From: "Kyle Lemons (Loon, LLC)" Date: Sun, 4 Aug 2019 18:11:24 -0700 Subject: [PATCH] gameboy-advance: don't crash copying unaligned strings Strings are emitted in .rodata sections, which are not yet mentioned in the linker script. I can't exactly explain why it didn't work before, as these sections should have been included in .bss and thus properly aligned, but it appears to work reliably. --- targets/gameboy-advance.ld | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/targets/gameboy-advance.ld b/targets/gameboy-advance.ld index 139e4c07..490f8192 100644 --- a/targets/gameboy-advance.ld +++ b/targets/gameboy-advance.ld @@ -21,6 +21,14 @@ SECTIONS . = ALIGN(4); } >rom + .rodata : + { + . = ALIGN(4); + *(.rodata) + *(.rodata*) + . = ALIGN(4); + } >rom + /* Put the stack at the bottom of RAM, so that the application will * crash on stack overflow instead of silently corrupting memory. * See: http://blog.japaric.io/stack-overflow-protection/ */