Page 1 of 1
Linker script
Posted: Sat Nov 15, 2025 8:45 am
by karim
the linker script is what tells the linker to arrange the code so that it expects to start at a certain address in RAM, for example 0x1000. After that, the loader comes and actually places the code at that RAM address (0x1000). So it’s basically like a map for the loader, right?
Re: Linker script
Posted: Sat Nov 15, 2025 5:08 pm
by Octocontrabass
I see you asked this question elsewhere too.
As long as you use a binary format that can store address information in its headers, like ELF or PE, the linker script does indeed work like a map for the loader.
However, if you're using a binary format that doesn't store address information, the loader has no way to know what you put in your linker script. Instead, the loader decides what it will do with your binary, and you have to write a linker script that matches what the loader will do.