This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH/RFA] Fix C-referenceable sections with explicit LMAs
On Sun, Dec 15, 2002 at 05:02:03PM -0800, Jason R Thorpe wrote:
> On Thu, Dec 12, 2002 at 10:29:23AM +0000, Nick Clifton wrote:
>
> > Maybe what we need here is a new keyword then. Something like
> > SIZEOF_INCLUDING_ORPHANS (or something less wordy) which would mean
> > "the size of the section plus the size of any attached orphan
> > sections". Then in the documentation we could make it clear that
> > SIZEOF is just the size of the basic section without any attachments,
> > and provide an example of the difference.
> >
> > What do you think ?
>
> I guess that would be fine. It's still annoying that existing linker
> scripts would not continue to work, but at least the recommended fix
> is much simpler.
>
> I'll work on a SIZEOF_WITH_ORPHANS (*slightly* less wordy :-) patch
> tonight.
I really don't see why any of this is necessary. You can set LMAs
using something like:
SECTIONS
{
.text (0x00800000) : AT (0x10800000)
{ *(.text) }
textpad = ALIGN (0x1000) - .;
. = . + textpad;
.rodata : AT (ADDR (.rodata) - textpad + LOADADDR (.text) - ADDR (.text))
{ *(.rodata) }
rodatapad = ALIGN (0x1000) - .;
. = . + rodatapad;
.data : AT (ADDR (.data) - rodatapad + LOADADDR (.rodata) - ADDR (.rodata))
{ *(.data) }
etc.
}
or equivalently
SECTIONS
{
.text (0x00800000) : AT (0x10800000)
{ *(.text) }
end_of_text_plus_orphans = .;
. = ALIGN (0x1000);
.rodata : AT (end_of_text_plus_orphans + LOADADDR (.text) - ADDR (.text))
{ *(.rodata) }
etc.
}
This should have exactly the same effect as using the proposed new
keyword, except that it defines a few syms and is a little more wordy.
--
Alan Modra
IBM OzLabs - Linux Technology Centre