[PATCH 2/2] Add sparc IFUNC support to Gold.

David Miller davem@davemloft.net
Fri Apr 20 06:51:00 GMT 2012


From: Cary Coutant <ccoutant@google.com>
Date: Tue, 17 Apr 2012 11:42:40 -0700

> You could try doubling the origin values in the MEMORY section of
> memory_test.t, in order to prevent the headers from merging with .sec0
> in the first load segment, and .sec3 from being placed in the third
> load segment with .sec4 and .sec5. Then you may need to modify the
> patterns to ignore the values in the Offset column. For reference, I
> modified memory_test.t as follows:
> 
> 3,6c3,6
> <   region1        : ORIGIN = 0x1000, LENGTH = 0x1000 ,
> <   region2 (r)    :    org = 0x2000, len    =    300
> <   region3 (wx)   :      o = 0x4000, l      =      4
> <   region4 (!r)   : o = 0x6000 + 60, len    = 0x30 * 0x6
> ---
>>   region1        : ORIGIN = 0x2000, LENGTH = 0x1000 ,
>>   region2 (r)    :    org = 0x4000, len    =    300
>>   region3 (wx)   :      o = 0x8000, l      =      4
>>   region4 (!r)   : o = 0xc000 + 60, len    = 0x30 * 0x6
> 19c19
> <   .sec3 0x5000 : { *(*.sec3) }
> ---
>>   .sec3 0xa000 : { *(*.sec3) }
> 
> And I get the following load segments on x86_64:

Unlike you I always get only 4 LOAD segments on Sparc.  I think
the linker is combining adjacent segments for whatever reason.

I always also get a LOAD segment starting at virtual address zero no
matter what gets used for the ORIGIN value in the scripts.  For
example, with the change you suggested I get:

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x00000000 0x00000000 0x04004 0x04004 R   0x2000
  LOAD           0x004004 0x00002000 0x00004004 0x00004 0x00004 R   0x2000
  LOAD           0x004008 0x00004008 0x00004008 0x05ffc 0x05ffc R   0x2000
  LOAD           0x00c03c 0x00008000 0x0000c03c 0x00004 0x00004 R   0x2000

 Section to Segment mapping:
  Segment Sections...
   00     .sec0
   01     .sec1
   02     .sec4 .sec5 .sec3
   03     .sec2

I note two things about the BFD linker test this GOLD test is based
upon (rgn-at5), that test checks the section headres, not the program
headers.  The BFD linker test also, unlike the GOLD test, passes in
"-max-pages-size=0x1000".

I wonder about that first LOAD segment you get on x86-64, it's smaller
than a page and in the Section to Segment mapping it doesn't correspond
to any named Section.  Whereas on sparc all of the listed segments
correspond to one of the sections created by the test.



More information about the Binutils mailing list