Just another image base address
d2rk
Posts: 31
Hi,
How can I change image base address which is by default is 0? I do not want to relocate all the segments, but to have something like PIC (position-independent code) does. The purpose of this to place the image anywhere on Hub RAM.
How can I change image base address which is by default is 0? I do not want to relocate all the segments, but to have something like PIC (position-independent code) does. The purpose of this to place the image anywhere on Hub RAM.
Comments
I think you would have to write a custom linker script to change the base address. All subroutine addresses and most jump addresses are assigned by the linker. They cannot be changed at run time.
Eric
PIC is normally used when building dynamic library code that could be loaded to and run from any address.
Don't think it helps with moving data around, only functions.
If you don't want to write a linker script, you could give the command line option -Ttext=0xnnnn instead; that will relocate the text section and all the sections that depend on it to a different address. Unfortunately there are a few additional sections (like the .init section) which will not be relocated this way, and the --section-start directive does not seem to be working.
Another option would be to create a relocatable output (with -r) and write an elf file relocation program. That would be a lot of work :-(.
Eric