This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/RFA] Allow read-only orphans to sort with .text


On Thu, May 29, 2003 at 10:56:23AM -0700, Jason Thorpe wrote:
> This is a patch I've had kicking around in my tree for a while.  This 
> allows read-only orphan sections to be sorted with .text if no other 
> suitable adopted parent section can be found (e.g. if the linker script 
> does not have a ".rodata" section).

We used to place ro orphans that way at one stage (see ld/ChangeLog
2000-09-07 Alan Modra), but there's a case where this scheme fails.

Suppose the first object in the link doesn't have a .rodata section,
but has a ro orphan.  Your proposed change will cause the orphan to
be placed at the end of .text _and_ remember this place for future
ro orphans.  That will result in all ro orphans being placed at the
end of .text, even if .rodata is later used.

Now the bit I can't remember exactly is why this causes a problem,
but it's likely because a large amount of (orphan) rodata can sit
between .text and .fini, and a branch from code in .text can't
reach .fini on some targets.

So a suitable patch might be one that places ro orphans after .text
when .rodata doesn't exist, but _doesn't_ remember this place for
future ro orphans.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]