allocating starting at top of memory with ld?

Nick Clifton nickc@redhat.com
Tue May 5 10:27:00 GMT 2009


Hi Galen,

> Thanks for the response.  The reason for wanting to allocate downwards 
> is that the bottom portion of memory is occupied by data of varying size 
> that is not part of the link process.  The situation is somewhat similar 
> to having a heap that grows up and a stack that grows down. I'm trying 
> to pack my stuff at the top of memory in order to maximize the space 
> available for the data that lives at the bottom.

I assume that it is not possible to place this varying size data at the 
high end of memory or after the end of the linked executable /

> The only idea I've come up with so far is to link twice.  The first link 
> would be a 'normal' link with input sections being assigned upwards.  
> objdump would then be used to extract the resulting size of the output 
> section.  Then a second link would be performed, passing an org of a 
> bogus output section on the command line that acts as a negative offset 
> from the top of memory.

This ought to work.

> Is there a simpler way to achieve a top down packing of data files?

None that I can think of, sorry.

Cheers
   Nick



More information about the Binutils mailing list