Lighbringer wrote:
I am using binutils 2.18 and am having problems with the linker script. I am somewhat new to linker scripting and the problem is that the binary file being created by ld is too big. My linker script is as follows:
OUTPUT_FORMAT("binary")
ENTRY(_start)
SECTIONS
{
.text 0x100000 : {
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}
.data : {
data = .; _data = .; __data = .;
*(.data)
. = ALIGN(4096);
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
}
It seems that the binary file does put everything in "proper" place, like the code at 0x100000, but with previous ld versions the binary was getting around 50k and this version is building a 1mb+ binary. I don't know what I am missing here, can someone help me? Is there some kind of compression the ld should do?
One other thing, my calling linker line is
ld -T script.ld -o foo.o <input files>
There's a working workaround, that creates the file I was expecting like this
ld --oformat binary -o foo.o <input files> -Ttext 0x100000
But I would really like to put things in the script.