aboutsummaryrefslogtreecommitdiff
path: root/libgloss
diff options
context:
space:
mode:
authorJozef Lawrynowicz <jozef.l@mittosystems.com>2020-08-07 11:48:27 +0100
committerCorinna Vinschen <corinna@vinschen.de>2020-08-07 15:16:43 +0200
commit748970c8337eb286d816ac623c8ee097d4085c29 (patch)
tree26338bfc8d79c477889ee17a526c338febeb327f /libgloss
parentc8dc3fa0ba5543d69300040acabe751fc3ec7cb5 (diff)
downloadnewlib-748970c8337eb286d816ac623c8ee097d4085c29.zip
newlib-748970c8337eb286d816ac623c8ee097d4085c29.tar.gz
newlib-748970c8337eb286d816ac623c8ee097d4085c29.tar.bz2
MSP430: Word align __*_array_start symbols in sim linker scripts
__{preinit,init,fini}_array_start symbols must be word aligned in linker scripts. If the section preceding the __*_array_start symbol has an odd size, then a NULL byte will be present between the start symbol and the .*_array section itself, when the section gets automatically word-aligned. This results in a branch to an invalid address when the CRT startup code tries to run through the functions listed in the array sections. >From de115144d05ecbaa82c9c737cc261715ca4b7d67 Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz <jozef.l@mittosystems.com> Date: Mon, 3 Aug 2020 19:09:46 +0100 Subject: [PATCH 1/2] MSP430: Word align __*_array_start symbols in sim linker scripts __{preinit,init,fini}_array_start symbols must be word aligned in linker scripts. If the section preceding the __*_array_start symbol has an odd size, then a NULL byte will be present between the start symbol and the .*_array section itself, when the section gets automatically word-aligned. This results in a branch to an invalid address when the CRT startup code tries to run through the functions listed in the array sections.
Diffstat (limited to 'libgloss')
-rw-r--r--libgloss/msp430/msp430-sim.ld4
-rw-r--r--libgloss/msp430/msp430xl-sim.ld3
2 files changed, 7 insertions, 0 deletions
diff --git a/libgloss/msp430/msp430-sim.ld b/libgloss/msp430/msp430-sim.ld
index fadd137..5c0e3b7 100644
--- a/libgloss/msp430/msp430-sim.ld
+++ b/libgloss/msp430/msp430-sim.ld
@@ -42,14 +42,18 @@ SECTIONS
. = ALIGN(2);
*(.rodata1)
+ . = ALIGN(2);
KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
+ . = ALIGN(2);
PROVIDE (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE (__preinit_array_end = .);
+ . = ALIGN(2);
PROVIDE (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE (__init_array_end = .);
+ . = ALIGN(2);
PROVIDE (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
diff --git a/libgloss/msp430/msp430xl-sim.ld b/libgloss/msp430/msp430xl-sim.ld
index 125b7d8..5126e39 100644
--- a/libgloss/msp430/msp430xl-sim.ld
+++ b/libgloss/msp430/msp430xl-sim.ld
@@ -68,13 +68,16 @@ SECTIONS
. = ALIGN(2);
KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
+ . = ALIGN(2);
PROVIDE (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE (__preinit_array_end = .);
+ . = ALIGN(2);
PROVIDE (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE (__init_array_end = .);
+ . = ALIGN(2);
PROVIDE (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))