Linker script in bare bones tutorial
Posted: Fri Jan 04, 2013 1:12 pm
I have a few questions about the linker script in the bare bones tutorial. Here is the script:
My first question is in this section:
I assume sbss and ebss stand for start bss and end bss. Why do they need to be there?
My second question is that why we need a linker script in the first place? Isn't ELF a common format? Should ld be able to link it without us writing our own script?
Code: Select all
ENTRY (loader)
SECTIONS
{
. = 0x00100000;
.text ALIGN (0x1000) :
{
*(.text)
}
.rodata ALIGN (0x1000) :
{
*(.rodata*)
}
.data ALIGN (0x1000) :
{
*(.data)
}
.bss :
{
sbss = .;
*(COMMON)
*(.bss)
ebss = .;
}
}
Code: Select all
.bss :
{
sbss = .;
*(COMMON)
*(.bss)
ebss = .;
}
My second question is that why we need a linker script in the first place? Isn't ELF a common format? Should ld be able to link it without us writing our own script?