This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: allocating starting at top of memory with ld?
- From: Nick Clifton <nickc at redhat dot com>
- To: Galen Seitz <galens at seitzassoc dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 05 May 2009 11:27:30 +0100
- Subject: Re: allocating starting at top of memory with ld?
- References: <49E640FF.9000601@seitzassoc.com> <49E6E95B.90300@redhat.com> <49F25436.5050609@seitzassoc.com>
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