Section at absolute address

Ramana ramana.venkat83@gmail.com
Tue Aug 3 04:20:00 GMT 2010


> using ld, how can I locate a section at an absolute address?
> I want to do another linking step (using relocatable binary) and want a
> given section to stay at that very address it had after the first link
> took place.
> Whenever I define a symbol in a linker script like "foo=1;" nm tells me
> that this symbol is absolute and thus is not changed in further linking
> steps. Basically that is what I want for a section (or all symbols in
> that section).

Assuming that you want the section/symbols to reside at the defined
address (my_address) after the first linking step you can do the
following in the linker script

for symbol:
                foo = ABSOLUTE(my_address);

for section:
              SECTIONS{
                             my_sec my_address:   AT(my_address) { }
               }

If you want to have the section/symbols to reside at the defined
address in final image too then follow the above steps in each linker
script you use in every linking step.

Ram
Freescale Semiconductor, India



More information about the Binutils mailing list