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]

[PATCH/RFC] Re: Problem with referenceable sections ("link sets")


On Tue, Nov 19, 2002 at 09:44:21AM -0800, Jason R Thorpe wrote:

 > Well, this patch (against 2.11.2) almost does it ... if there is one
 > orphan section, the right thing happens.  But if there are two, the
 > two orphans get overlapped.

Ok, this patch (again, against 2.11.2) actually works.  I needed to add
a new token, SIZEOF_UNADJ, to fetch the unadjusted size of a section.
This isn't actually allowed in the grammar, just used internally.

The way it works is:

	* When a section gets its first orphan, the orphan is
	  placed at LOADADDR(section)+SIZEOF_UNADJ(section).
	  The SIZEOF_UNADJ is needed for the first one, because
	  the parent's section SIZEOF value is adjusted to reflect
	  the contents of all of the orphans sorted after it, and
	  using that SIZEOF would misplace the first orphan, because
	  the parent section would have accumulated all of the
	  ajustments by the time the expression can be folded.

	* For all subsequent orphans sorted after that section,
	  the orphan is placed at LOADADDR(prev_orphan)+
	  SIZEOF_UNADJ(prev_orphan).  However, note that SIZEOF_UNADJ
	  and SIZEOF are equivalent in this case, since orphans never
	  have their SIZEOF's adjusted.

Also included in this patch is a change that allows sorting
read-only data after .text if .rodata is not present as an
output section.  This matches the behavior of compilers which
do not emit .rodata sections (as GCC 2.95.3 for arm-elf did not
until fixed it while working on this).

Anyway, I'd appreciate any comments people might have on this.  Tomorrow
I'll cook up a patch for current Binutils...

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

Attachment: ld-orphan-patch
Description: Text document


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