List of standard / common symbols used in the linker script
Hi @All,
while I was focusing understanding and writing my linker script & startup files for my Cortex M3 MCU (Spansion MB9BF510R-Series), I recognized that somehow there seems to be common confusion about the existing symbols used.
It looks like there is just a lot of copy and paste going around.
So my question is, is there a list of of standard / common symbols (especially ones other libraries might use or expect) ?
some example: You can find a lot of different implementations of the bss section
a) here (from the CMSIS gcc_arm.ld) it is __bss_start__ and __bss_end__ --> OK !
.bss :
{
. = ALIGN(4);
__bss_start__ = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
} > RAM
b) This one uses _sbss, __sbss, _ebss, __ebss (each 2 symbols with the sam VMA) --> WHY??
.bss : ALIGN(4)
{
. = ALIGN(4);
_sbss = .;
__sbss = _sbss;
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
__ebss = _ebss ;
} > RAM
c) This one defines _end & __end (where both are the same) --> WHY??
.bss : ALIGN (8)
{
*(.shbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN (8);
*(.ram.b .bss.ram)
. = ALIGN (8);
_end = .;
__end = .;
} >ram
d) No underscores used / sbss & ebss outside of section definition
sbss = .;
.bss : { * (.bss); }
ebss = .;
bss_size = ebss - sbss;
e) ONLY declaration of a heap section I found mentioning about the common used symbol ("end = ." for newlib)
. = ALIGN(4);
.heap :
{
__end__ = .;
/* _heap_start = .; */
/* "end" is used by newlib's syscalls!!! */
PROVIDE(end = .);
. = . + heap_size;
} >RAM
In addition I'd like to know if there is any priority in usage of the symbols.
Cause one I found in a startup_*.S this:
.section .heap , "w" /* w = section is writable */
.align 3
#ifdef __HEAP_SIZE__
.equ __HeapSize, __HEAP_SIZE__
#else
.equ __HeapSize, 0x00000400
#endif
.globl __HeapStart
.globl __HeapEnd
.globl __HeapSize
__HeapStart:
.if __HeapSize
.space __HeapSize
.endif
__HeapEnd:
and in the linker script
.heap
{
. = ALIGN(4) ;
_sheap = .;
*(.heap*);
. = ALIGN(4) ;
_eheap = .;
}
PROVIDE(__HeapStart = _sheap);
PROVIDE(__HeapEnd = _eheap);
PROVIDE(__HeapSize = SIZEOF(.heap));
so which symbol definition is overridden? The __HeapSize from the asm or __HeapSize from the indirection file?
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Bommel for more information if necessary.