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: Problem with referenceable sections ("link sets")


On Sat, Nov 16, 2002 at 11:00:03PM -0800, Ian Lance Taylor wrote:

 > Look at gld${EMULATION_NAME}_place_orphan in ld/emultempl/elf32.em.
 > See where your sections are being sorted.  Make sure they are sorted
 > immediately after the .rodata section--place should be set to
 > hold_rodata.  If not there, where and why?

Yah, place is getting set to hold_rodata, and it seems to be sorted
in the correct order:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .start        000000c4  00200000  00200000  00008000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .text         00106324  c02000c4  002000c4  000080c4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .rodata       0001ba50  c03063e8  003063e8  0010e3e8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 link_set      00000018  c0321e38  c0321e38  00169e38  2**2
				      ^^^^^^^^
			    should be 00321e38
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .data         000349f4  c0328000  00328000  00130000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  5 .sbss         00000000  c035c9f4  c035c9f4  0016ca00  2**0
                  CONTENTS
  6 .bss          0001ea90  c035ca00  c035ca00  0016ca00  2**4

Hm... notice the incorrect "paddr" for PHDR that covers the link_set
section (and the LMA for link_set above is also incorrect):

Program Header:
    LOAD off    0x00008000 vaddr 0x00200000 paddr 0x00200000 align 2**15
         filesz 0x000000c4 memsz 0x000000c4 flags r-x
    LOAD off    0x000080c4 vaddr 0xc02000c4 paddr 0x002000c4 align 2**15
         filesz 0x00121d74 memsz 0x00121d74 flags r-x
    LOAD off    0x00130000 vaddr 0xc0328000 paddr 0x00328000 align 2**15
         filesz 0x000349f4 memsz 0x000349f4 flags rw-
    LOAD off    0x00169e38 vaddr 0xc0321e38 paddr 0xc0321e38 align 2**15
                                                  ^^^^^^^^^^
				        should be 0x00321e38
         filesz 0x00000018 memsz 0x00000018 flags r--
    LOAD off    0x0016ca00 vaddr 0xc035ca00 paddr 0xc035ca00 align 2**15
         filesz 0x00000000 memsz 0x0001ea90 flags rw-
private flags = 2: [APCS-32] [has entry point]

...I suppose *that* is why it's not being merged with the .text+.rodata
P-section.  I guess somehow the AT statement for the .rodata section isn't
being honored for the orphan..?  (The wacky paddr is probably what confuses
objcopy -O binary so much, since it needs to write it all out linearly...
I guess if I tried to load the S-record version of the image, it would
simply do the wrong thing :-)

-- 
        -- 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]