gold script handling of program headers

David Miller davem@davemloft.net
Wed Apr 16 01:44:00 GMT 2008


From: Ian Lance Taylor <iant@google.com>
Date: Tue, 15 Apr 2008 15:51:29 -0700

> David Miller <davem@davemloft.net> writes:
> 
> > So the resulting offset is 0x403f50, and this is where the bogus
> > non-zero this->offset() seen by Output_file_header::do_write() seems
> > to come from.
> 
> 
> Thanks for the bug report.  I committed this patch, which should fix
> this problem.

The new script test fails on sparc64:

Did not find expected segment in script_test_4.stdout:
   \.interp[ 	]*PROGBITS[ 	]*10000400

Actual output below:
There are 41 section headers, starting at offset 0x5320:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        0000000010000400 000400 000015 00   A  0   0  1
  [ 2] .gnu.version_r    VERNEED         0000000010000418 000418 000050 00   A  6   2  4
  [ 3] .gnu.version      VERSYM          0000000010000468 000468 000016 02   A  7   0  2
  [ 4] .gnu.hash         GNU_HASH        0000000010000480 000480 000040 04   A  7   0  8
  [ 5] .hash             HASH            00000000100004c0 0004c0 000040 04   A  7   0  8
  [ 6] .dynstr           STRTAB          0000000010000500 000500 00011d 00   A  0   0  1
  [ 7] .dynsym           DYNSYM          0000000010000620 000620 000108 18   A  6   1  8
  [ 8] .rela.dyn         RELA            0000000010000728 000728 000078 18   A  7   0  8
  [ 9] .rela.plt         RELA            00000000100007a0 0007a0 000090 18   A  7   0  8
  [10] .eh_frame_hdr     PROGBITS        0000000010000830 000830 000034 00   A  0   0  4
  [11] .eh_frame         PROGBITS        0000000010000868 000868 00009c 00   A  0   0  8
  [12] .rodata           PROGBITS        0000000010000908 000908 000090 00   A  0   0  8
  [13] .note             NOTE            0000000010000998 000998 000020 00   A  0   0  4
  [14] .text             PROGBITS        00000000100009c0 0009c0 000bc0 00  AX  0   0 32
  [15] .text             PROGBITS        0000000010001580 001580 000284 00  AX  0   0  4
  [16] .fini             PROGBITS        0000000010001820 001820 000030 00  AX  0   0 32
  [17] .init             PROGBITS        0000000010001860 001860 000078 00  AX  0   0 32
  [18] .dynamic          DYNAMIC         0000000010101900 001900 0001a0 10  WA  6   0  8
  [19] .data             PROGBITS        0000000010101aa0 001aa0 000070 00  WA  0   0  8
  [20] .plt              PROGBITS        0000000010101b10 001b10 000140 00 WAX  0   0  8
  [21] .got              PROGBITS        0000000010101c50 001c50 000048 00  WA  0   0  8
  [22] .data             PROGBITS        0000000010101c98 001c98 000010 00  WA  0   0  8
  [23] .jcr              PROGBITS        0000000010101ca8 001ca8 000008 00  WA  0   0  8
  [24] .dtors            PROGBITS        0000000010101cb0 001cb0 000010 00  WA  0   0  8
  [25] .ctors            PROGBITS        0000000010101cc0 001cc0 000018 00  WA  0   0  8
  [26] .bss              NOBITS          0000000010201d00 001d00 0000e0 00  WA  0   0  8
  [27] .comment          PROGBITS        0000000000000000 001d00 00016b 00      0   0  1
  [28] .debug_pubnames   PROGBITS        0000000000000000 001e6b 0001e8 00      0   0  1
  [29] .debug_info       PROGBITS        0000000000000000 002053 000cb3 00      0   0  1
  [30] .debug_abbrev     PROGBITS        0000000000000000 002d06 0003e3 00      0   0  1
  [31] .debug_line       PROGBITS        0000000000000000 0030e9 00035c 00      0   0  1
  [32] .debug_str        PROGBITS        0000000000000000 003445 000348 00      0   0  1
  [33] .debug_aranges    PROGBITS        0000000000000000 003790 0001a0 00      0   0 16
  [34] .debug_ranges     PROGBITS        0000000000000000 003930 000080 00      0   0 16
  [35] .debug_frame      PROGBITS        0000000000000000 0039b0 000418 00      0   0  8
  [36] .debug_loc        PROGBITS        0000000000000000 003dc8 000740 00      0   0  1
  [37] .note             NOTE            0000000000000000 004508 000018 00      0   0  4
  [38] .symtab           SYMTAB          0000000000000000 004520 000960 18     39  31  8
  [39] .strtab           STRTAB          0000000000000000 004e80 00049e 00      0   0  1
  [40] .shstrtab         STRTAB          0000000000000000 005d60 00015b 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x100009c0
There are 9 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0x0000000010000040 0x0000000010000040 0x0001f8 0x0001f8 R   0x8
  INTERP         0x000400 0x0000000010000400 0x0000000010000400 0x000015 0x000015 R   0x1
      [Requesting program interpreter: /lib64/ld-linux.so.2]
  LOAD           0x000000 0x0000000010000000 0x0000000010000000 0x0018d8 0x0018d8 R E 0x2000
  LOAD           0x001900 0x0000000010101900 0x0000000010101900 0x0003d8 0x0003d8 RWE 0x2000
  LOAD           0x001d00 0x0000000010201d00 0x0000000010201d00 0x000000 0x0000e0 RW  0x2000
  DYNAMIC        0x001900 0x0000000010101900 0x0000000010101900 0x0001a0 0x0001a0 RW  0x8
  NOTE           0x000998 0x0000000010000998 0x0000000010000998 0x000020 0x000020 R   0x4
  GNU_EH_FRAME   0x000830 0x0000000010000830 0x0000000010000830 0x000034 0x000034 R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .gnu.version_r .gnu.version .gnu.hash .hash .dynstr .dynsym .rela.dyn .rela.plt .eh_frame_hdr .eh_frame .rodata .note .text .text .fini .init 
   03     .dynamic .data .plt .got .data .jcr .dtors .ctors 
   04     .bss 
   05     .dynamic 
   06     .note 
   07     .eh_frame_hdr 
   08     
FAIL: script_test_4.sh



More information about the Binutils mailing list