GCC, changing base address?
Posted: Fri Jun 10, 2011 2:21 am
Hello.
The problem is, how can i change base address at which gcc generates the executable?
It is set to generate it at 0x0, i need it to work if it's loaded at 0x1000.
I tried linker options, like -Wl,--section-start=.text=0x1000, that produced a mess.
I tried putting .org 0x1000,0 at start of crt0.S. That kinda worked, but the first 0x1000 bytes are filled with zeros, which is unacceptable (what if base is 0x80000000?).
What is the proper way of doing it?
Changing it in the toolchain sources is not an option, since i want to be able to build with base of 0x0 as well.
There is probably a simple linker option for that, but LD is too well documented to even hope of finding it.
The problem is, how can i change base address at which gcc generates the executable?
It is set to generate it at 0x0, i need it to work if it's loaded at 0x1000.
I tried linker options, like -Wl,--section-start=.text=0x1000, that produced a mess.
I tried putting .org 0x1000,0 at start of crt0.S. That kinda worked, but the first 0x1000 bytes are filled with zeros, which is unacceptable (what if base is 0x80000000?).
What is the proper way of doing it?
Changing it in the toolchain sources is not an option, since i want to be able to build with base of 0x0 as well.
There is probably a simple linker option for that, but LD is too well documented to even hope of finding it.