public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* reserving LMA space in linker script
@ 2005-07-06 23:57 Darin Johnson
  2005-07-07 11:26 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Darin Johnson @ 2005-07-06 23:57 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: reserving LMA space in linker script
  2005-07-06 23:57 reserving LMA space in linker script Darin Johnson
@ 2005-07-07 11:26 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2005-07-07 11:26 UTC (permalink / raw)
  To: Darin Johnson; +Cc: binutils

Hi Darin,

> 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?

Does the region for the duplicated .data section have to occur before 
.data in memory ?  If it can occur afterwards then you should be able to 
use your original linker script like this:

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

Note - you will probably want to define a couple of symbols to hold the 
start and end addresses of your hole.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-07 11:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-06 23:57 reserving LMA space in linker script Darin Johnson
2005-07-07 11:26 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).