reserving LMA space in linker script

Darin Johnson chezdj@earthlink.net
Wed Jul 6 23:57:00 GMT 2005


In a GNU ld script I'd like to have something like the following:

    .text  : { *(.text ... ) } > ram
   
    . = ALIGN(4);
    _data_load = .
    . += SIZEOF(.data);

    ...

    .data  : AT(_data_load)  { *(.data ...) } > ram

However, ld doesn't allow getting the address or size of a section
before it is defined.  This does work in some other linkers though.

The reason I want to do this is to be able to restart the code on
an embedded system without having to download through the
debugger all over again.  This is just like loading the data from
ROM except that the VMA and LMA are both in RAM.

I can solve this by allocating a large enough space, but I don't
want to leave holes in memory.  Is there any other way to get
this sort of thing done?

Thanks,
Darin Johnson



More information about the Binutils mailing list