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] Fix C-referenceable sections with explicit LMAs


On Tue, Dec 10, 2002 at 03:40:46PM +0000, Nick Clifton wrote:

 > I think that Alan Modra's recent changes have already fixed this.
 > Certainly your test case assembles and links without errors and
 > without your patch applied.  (It does not pass however as the sections
 > are not layed out as expected.  I am not sure if this is a bug or
 > not).  Can you check to see if your patch is still needed please ?

Yes, my patch is still needed, because without one part of my patch, those
orphans aren't getting merged with the available read-only section.

Here are the sections from an unmodified ld:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000008  00800000  10800000  00010000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000004  00800008  10800008  00010008  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000004  0080000c  0080000c  0000800c  2**0
                  ALLOC
  3 link_set_1    00000004  00800010  00800010  00008010  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 link_set_2    00000004  00800014  00800014  00008014  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA

The LMAs (and VMAs, for that matter) for the "link_set_*" sections are
wrong; they need to be merged with .text in this case.  One part of my
patch does this.  Alan felt this part of the patch was fine, and suggested
a nicer way to do what I wanted, and I incorporated his suggested into my
last version of the path.

Then, once they are merged with .text (or .rodata, assuming the
output has a .rodata section), all hell breaks loose if SIZEOF
does not reflect the additional output that has been merged into
the sections.  That's what the SIZEOF adjustment takes care of.

If you apply just the piece that allows merging read-only orphans
with .text, then the linker will definitely complain about the overlapping
sections when you run the test case.

So, even with all of Alan's recent changes, the last patch I posted is
still required to fix this problem for me (and the patch doesn't need
to be updated -- cvs found no conflicts when I just cvs update'd my
tree).

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


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