This is the mail archive of the binutils@sourceware.org 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: New x86 linker testsuite failure


On Wed, Jun 27, 2018 at 01:35:53PM +0000, Alan Hayward wrote:
> Is the following patch ok?

No.  With changes like this you really do need to run the testsuite
over all supported ELF targets.

> This both restores my previous code and fixes
> up the macros. Ensured the ld alloc test now passes and the gdb works with
> armlinker binaries.

The patch results in some testsuite failures.

alpha-linux  +FAIL: ld-elf/mbind1b
alpha-linux  +FAIL: ld-elf/mbind1c
i686-nacl  +FAIL: strip -shared (maxpage1)
i686-nacl  +FAIL: objcopy -shared (maxpage1)
i686-nacl  +FAIL: objcopy -shared -z noseparate-code (tdata2)
i686-nacl  +FAIL: objcopy -shared -z separate-code (tdata2)
i686-nacl  +FAIL: objcopy -shared -z noseparate-code (tbss2)
i686-nacl  +FAIL: objcopy -shared -z separate-code (tbss2)
rx-elf  +XPASS: ld-scripts/rgn-at9
x86_64-nacl  +FAIL: strip -shared (maxpage1)
x86_64-nacl  +FAIL: objcopy -shared (maxpage1)
x86_64-nacl  +FAIL: objcopy -shared -z noseparate-code (tdata2)
x86_64-nacl  +FAIL: objcopy -shared -z separate-code (tdata2)
x86_64-nacl  +FAIL: objcopy -shared -z noseparate-code (tbss2)
x86_64-nacl  +FAIL: objcopy -shared -z separate-code (tbss2)

They appear to be due to changed handling of zero length sections.
For instance, readelf -lS on first x86_64-nacl testcase shows:

File: tmpdir/maxpage1
There are 12 section headers, starting at offset 0x2014c:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 010000 000004 00  AX  0   0  1
  [ 2] .hash             HASH            100000b4 0000b4 000028 04   A  4   0  4
  [ 3] .gnu.hash         GNU_HASH        100000dc 0000dc 000030 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          1000010c 00010c 000050 10   A  5   1  4
  [ 5] .dynstr           STRTAB          1000015c 00015c 00000e 00   A  0   0  1
  [ 6] .eh_frame         PROGBITS        1000016c 00016c 000000 00   A  0   0  4
  [ 7] .dynamic          DYNAMIC         1001016c 00016c 000060 08  WA  5   0  4
  [ 8] .data             PROGBITS        100101cc 0001cc 000004 00  WA  0   0  1
  [ 9] .symtab           SYMTAB          00000000 020000 0000e0 10     10  10  4
  [10] .strtab           STRTAB          00000000 0200e0 000017 00      0   0  1
  [11] .shstrtab         STRTAB          00000000 0200f7 000054 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 4 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x010000 0x00000000 0x00000000 0x10000 0x10000 R E 0x10000
  LOAD           0x000000 0x10000000 0x10000000 0x0016c 0x0016c R   0x10000
  LOAD           0x00016c 0x1001016c 0x1001016c 0x00064 0x00064 RW  0x10000
  DYNAMIC        0x00016c 0x1001016c 0x1001016c 0x00060 0x00060 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00     .text 
   01     .hash .gnu.hash .dynsym .dynstr 
   02     .eh_frame .dynamic .data 
   03     .dynamic 

Notice that the zero length .eh_frame is reported by readelf as
belonging to the last PT_LOAD segment, which isn't correct for its
VMA.  (Prior to your patch readelf omitted .eh_frame from the section
to segment mapping.)  The proper location for .eh_frame is at the end
of the second PT_LOAD segment, but because it is now wrongly mapped to
the last PT_LOAD segment strip produces:

File: tmpdir/maxpage1.out
There are 10 section headers, starting at offset 0x30044:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 020000 000004 00  AX  0   0  1
  [ 2] .hash             HASH            100000b4 0000b4 000028 04   A  4   0  4
  [ 3] .gnu.hash         GNU_HASH        100000dc 0000dc 000030 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          1000010c 00010c 000050 10   A  5   1  4
  [ 5] .dynstr           STRTAB          1000015c 00015c 00000e 00   A  0   0  1
  [ 6] .eh_frame         PROGBITS        1000016c 00016c 000000 00   A  0   0  4
  [ 7] .dynamic          DYNAMIC         1001016c 01016c 000060 08  WA  5   0  4
  [ 8] .data             PROGBITS        100101cc 0101cc 000004 00  WA  0   0  1
  [ 9] .shstrtab         STRTAB          00000000 030000 000044 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 4 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x020000 0x00000000 0x00000000 0x10000 0x10000 R E 0x10000
  LOAD           0x000000 0x10000000 0x10000000 0x0016c 0x0016c R   0x10000
  LOAD           0x00016c 0x1000016c 0x1000016c 0x10064 0x10064 RW  0x10000
  DYNAMIC        0x01016c 0x1001016c 0x1001016c 0x00060 0x00060 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00     .text 
   01     .hash .gnu.hash .dynsym .dynstr 
   02     .eh_frame .dynamic .data 
   03     .dynamic 


-- 
Alan Modra
Australia Development Lab, IBM


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