+2015-05-18 Nick Clifton <nickc@redhat.com>
+
+ * msp430/msp430-sim.ld (.stack): Add an assertion to make sure
+ that the data area does not overrun the stack. PROVIDE a new
+ symbol __stack_size to allow the user to set the limit.
+ * msp430/msp430xl-sim.ld (.stack): Likewise.
+ * rl78/rl78-sim.ld (.stack): Likewise.
+ * rl78/rl78.ld (.stack): Likewise.
+ * rx/rx-sim.ld (.stack): Likewise.
+ * rx/rx.ld (.stack): Likewise.
+
2015-05-05 Nick Clifton <nickc@redhat.com>
* msp430/msp430.ld: Delete.
_end = .;
PROVIDE (end = .);
+ /* The __stack_size value of 0x100 is just a guess, but since it is
+ PROVIDEd the user can override it on the command line. It has to be
+ set here, rather than inside the .stack section, as symbols defined
+ inside sections are only evaluated during the final phase of the link,
+ long after the ASSERT is checked. An ASSERT referencing a PROVIDED but
+ not yet evaluated symbol will automatically fail.
+
+ FIXME: It would be nice if this value could be automatically set via
+ gcc's -fstack-usage command line option somehow. */
+ PROVIDE (__stack_size = 0x100);
+
.stack (ORIGIN (RAM) + LENGTH(RAM)) :
{
PROVIDE (__stack = .);
*(.stack)
+
+ /* Linker section checking ignores empty sections like
+ this one so we have to have our own test here. */
+ ASSERT ((__stack > (_end + __stack_size)),
+ "Error: Too much data - no room left for the stack");
}
/* Make sure that .upper sections are not used without -mlarge support. */
The same reasoning applies to the absence of definitions for the
.either.text, .either.data and .either.bss sections as well. */
-
+
. = ALIGN(2);
*(.rodata .rodata.* .gnu.linkonce.r.* .const .const:*)
*(.rodata1)
LONG(0);
} > HIFRAM
+ /* The __stack_size value of 0x100 is just a guess, but since it is
+ PROVIDEd the user can override it on the command line. It has to be
+ set here, rather than inside the .stack section, as symbols defined
+ inside sections are only evaluated during the final phase of the link,
+ long after the ASSERT is checked. An ASSERT referencing a PROVIDED but
+ not yet evaluated symbol will automatically fail.
+
+ FIXME: It would be nice if this value could be automatically set via
+ gcc's -fstack-usage command line option somehow. */
+ PROVIDE (__stack_size = 0x100);
+
/* Note: We place the stack in HIFRAM because then there is less
chance that it will collide with allocated data in the RAM region.
In scripts targeted at real MCUs however it may be better to place
.stack (ORIGIN (HIFRAM) + LENGTH (HIFRAM)) :
{
PROVIDE (__stack = .);
+
+ /* Linker section checking ignores empty sections like
+ this one so we have to have our own test here. */
+ ASSERT ((__stack > (_end + __stack_size)),
+ "Error: Too much data - no room left for the stack");
}
.text :
} > RAM
PROVIDE (__bsssize = SIZEOF(.bss));
+ /* The __stack_size value of 0x100 is just a guess, but since it is
+ PROVIDEd the user can override it on the command line. It has to be
+ set here, rather than inside the .stack section, as symbols defined
+ inside sections are only evaluated during the final phase of the link,
+ long after the ASSERT is checked. An ASSERT referencing a PROVIDED but
+ not yet evaluated symbol will automatically fail.
+
+ FIXME: It would be nice if this value could be automatically set via
+ gcc's -fstack-usage command line option somehow. */
+ PROVIDE (__stack_size = 0x100);
+
.stack (ORIGIN (STACK)) :
{
PROVIDE (__stack = .);
*(.stack)
+
+ /* Linker section checking ignores empty sections like
+ this one so we have to have our own test here. */
+ ASSERT ((__stack > (_end + __stack_size)),
+ "Error: Too much data - no room left for the stack");
}
.saddr : {
} > RAM
PROVIDE (__bsssize = SIZEOF(.bss));
+ /* The __stack_size value of 0x100 is just a guess, but since it is
+ PROVIDEd the user can override it on the command line. It has to be
+ set here, rather than inside the .stack section, as symbols defined
+ inside sections are only evaluated during the final phase of the link,
+ long after the ASSERT is checked. An ASSERT referencing a PROVIDED but
+ not yet evaluated symbol will automatically fail.
+
+ FIXME: It would be nice if this value could be automatically set via
+ gcc's -fstack-usage command line option somehow. */
+ PROVIDE (__stack_size = 0x100);
+
.stack (ORIGIN (STACK)) :
{
PROVIDE (__stack = .);
*(.stack)
+
+ /* Linker section checking ignores empty sections like
+ this one so we have to have our own test here. */
+ ASSERT ((__stack > (_end + __stack_size)),
+ "Error: Too much data - no room left for the stack");
}
.saddr : {
} > RAM
PROVIDE (__bsssize = SIZEOF(.bss) / 4);
+ /* The __stack_size value of 0x100 is just a guess, but since it is
+ PROVIDEd the user can override it on the command line. It has to be
+ set here, rather than inside the .stack section, as symbols defined
+ inside sections are only evaluated during the final phase of the link,
+ long after the ASSERT is checked. An ASSERT referencing a PROVIDED but
+ not yet evaluated symbol will automatically fail.
+
+ FIXME: It would be nice if this value could be automatically set via
+ gcc's -fstack-usage command line option somehow. */
+ PROVIDE (__stack_size = 0x100);
+
.stack (ORIGIN (STACK)) :
{
PROVIDE (__stack = .);
*(.stack)
+
+ /* Linker section checking ignores empty sections like
+ this one so we have to have our own test here. */
+ ASSERT ((__stack > (_end + __stack_size)),
+ "Error: Too much data - no room left for the stack");
} > STACK
/* Providing one of these symbols in your code is sufficient to have
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
+ .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
} > RAM
PROVIDE (__bsssize = SIZEOF(.bss) / 4);
+ /* The __stack_size value of 0x100 is just a guess, but since it is
+ PROVIDEd the user can override it on the command line. It has to be
+ set here, rather than inside the .stack section, as symbols defined
+ inside sections are only evaluated during the final phase of the link,
+ long after the ASSERT is checked. An ASSERT referencing a PROVIDED but
+ not yet evaluated symbol will automatically fail.
+
+ FIXME: It would be nice if this value could be automatically set via
+ gcc's -fstack-usage command line option somehow. */
+ PROVIDE (__stack_size = 0x100);
+
.stack (ORIGIN (STACK)) :
{
PROVIDE (__stack = .);
*(.stack)
+
+ /* Linker section checking ignores empty sections like
+ this one so we have to have our own test here. */
+ ASSERT ((__stack > (_end + __stack_size)),
+ "Error: Too much data - no room left for the stack");
}
/* Providing one of these symbols in your code is sufficient to have
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
+ .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }