[llvm-bugs] [Bug 32112] New: Missing relocations with ld.lld-4.0 and -target=x86_64 and -fpie

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 1 12:46:49 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=32112

            Bug ID: 32112
           Summary: Missing relocations with ld.lld-4.0 and -target=x86_64
                    and -fpie
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: rianquinn at gmail.com
                CC: llvm-bugs at lists.llvm.org

I am seeing an issue when compiling with clang-4.0 and ld.lld-4.0.
Specifically, if I compile with -target=x86_64 and link with -fpie, the PLT
relocations are all missing. Here is my readelf output, and you can see that
all of the UND symbols are missing relocations. It also appears the entire PLT
is simply missing. 

Any ideas on what I should do?

--------------------------------------------

ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x1280
  Start of program headers:          64 (bytes into file)
  Start of section headers:          14512 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         7
  Size of section headers:           64 (bytes)
  Number of section headers:         17
  Section header string table index: 15

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .gcc_except_table PROGBITS        00000000000001c8 0001c8 000080 00   A 
0   0  4
  [ 2] .rodata           PROGBITS        0000000000000248 000248 000038 01 AMS 
0   0  1
  [ 3] .dynsym           DYNSYM          0000000000000280 000280 000288 18   A 
5   1  8
  [ 4] .hash             HASH            0000000000000508 000508 0000e0 04   A 
3   0  4
  [ 5] .dynstr           STRTAB          00000000000005e8 0005e8 000369 00   A 
0   0  1
  [ 6] .rela.dyn         RELA            0000000000000958 000958 000060 18   A 
3   0  8
  [ 7] .eh_frame         PROGBITS        00000000000009b8 0009b8 000100 00   A 
0   0  8
  [ 8] .text             PROGBITS        0000000000001000 001000 0003bb 00  AX 
0   0 16
  [ 9] .data             PROGBITS        0000000000002000 002000 000010 00  WA 
0   0  8
  [10] .dynamic          DYNAMIC         0000000000003000 003000 0000d0 10  WA 
5   0  8
  [11] .got              PROGBITS        00000000000030d0 0030d0 000018 00  WA 
0   0  8
  [12] .bss              NOBITS          0000000000004000 0030e8 0004c0 00  WA 
0   0 16
  [13] .comment          PROGBITS        0000000000000000 0030e8 00004e 01  MS 
0   0  1
  [14] .symtab           SYMTAB          0000000000000000 003138 000318 18    
16   7  8
  [15] .shstrtab         STRTAB          0000000000000000 003450 000087 00     
0   0  1
  [16] .strtab           STRTAB          0000000000000000 0034d7 0003d8 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)

There are no section groups in this file.

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  PHDR           0x000040 0x0000000000000040 0x0000000000000040 0x000188
0x000188 R   0x8
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x000ab8
0x000ab8 R   0x1000
  LOAD           0x001000 0x0000000000001000 0x0000000000001000 0x0003bb
0x0003bb R E 0x1000
  LOAD           0x002000 0x0000000000002000 0x0000000000002000 0x0010e8
0x0024c0 RW  0x1000
  DYNAMIC        0x003000 0x0000000000003000 0x0000000000003000 0x0000d0
0x0000d0 RW  0x8
  GNU_RELRO      0x003000 0x0000000000003000 0x0000000000003000 0x0000e8
0x001000 R   0x1
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW  0

 Section to Segment mapping:
  Segment Sections...
   00
   01     .gcc_except_table .rodata .dynsym .hash .dynstr .rela.dyn .eh_frame
   02     .text
   03     .data .dynamic .got .bss
   04     .dynamic
   05     .dynamic .got
   06

Dynamic section at offset 0x3000 contains 13 entries:
  Tag        Type                         Name/Value
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000007 (RELA)               0x958
 0x0000000000000008 (RELASZ)             96 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          4
 0x0000000000000006 (SYMTAB)             0x280
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0x5e8
 0x000000000000000a (STRSZ)              873 (bytes)
 0x0000000000000004 (HASH)               0x508
 0x0000000000000000 (NULL)               0x0

Relocation section '.rela.dyn' at offset 0x958 contains 4 entries:
    Offset             Info             Type               Symbol's Value 
Symbol's Name + Addend
00000000000030d0  0000000000000008 R_X86_64_RELATIVE                        
2008
0000000000002000  0000000000000008 R_X86_64_RELATIVE                         0
00000000000030d8  0000000000000008 R_X86_64_RELATIVE                        
4010
00000000000030e0  0000000000000008 R_X86_64_RELATIVE                        
4008

The decoding of unwind sections for machine type Advanced Micro Devices X86-64
is not currently supported.

Symbol table '.dynsym' contains 27 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZN12vcpu_manager8instanceEv
     2: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZN21serial_port_intel_x645writeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
     3: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZN21serial_port_intel_x648instanceEv
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEmmPKc
     5: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEmm
     6: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm
     7: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_mmRKS4_
     8: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev
     9: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__16stoullERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPmi
    10: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __cxa_begin_catch
    11: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __cxa_end_catch
    12: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __gxx_personality_v0
    13: 0000000000001230    43 FUNC    GLOBAL DEFAULT    8 __stack_chk_fail
    14: 0000000000002008     8 OBJECT  GLOBAL DEFAULT    9 __stack_chk_guard
    15: 0000000000001000   417 FUNC    GLOBAL DEFAULT    8 write
    16: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZSt9terminatev
    17: 0000000000001260    28 FUNC    GLOBAL DEFAULT    8 ___xpg_strerror_r
    18: 0000000000004000     8 OBJECT  GLOBAL DEFAULT   12 __dso_handle
    19: 0000000000001280    13 FUNC    GLOBAL DEFAULT    8 _start
    20: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND abort
    21: 0000000000004010  1200 OBJECT  GLOBAL DEFAULT   12 g_eh_frame_list
    22: 0000000000004008     8 OBJECT  GLOBAL DEFAULT   12 g_eh_frame_list_num
    23: 00000000000011b0    20 FUNC    GLOBAL DEFAULT    8 get_eh_frame_list
    24: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND memset
    25: 00000000000011d0    84 FUNC    GLOBAL DEFAULT    8 register_eh_frame
    26: 00000000000012a0     0 FUNC    GLOBAL DEFAULT    8 execute_entry

Symbol table '.symtab' contains 33 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000000001c8     0 NOTYPE  LOCAL  DEFAULT    1 GCC_except_table0
     2: 0000000000000230     0 NOTYPE  LOCAL  DEFAULT    1 GCC_except_table2
     3: 000000000000139a     0 NOTYPE  LOCAL  DEFAULT    8 stack_overflow
     4: 0000000000002000     8 OBJECT  LOCAL  HIDDEN     9
DW.ref.__gxx_personality_v0
     5: 0000000000001290    11 FUNC    LOCAL  HIDDEN     8
__clang_call_terminate
     6: 0000000000003000     0 NOTYPE  LOCAL  HIDDEN    10 _DYNAMIC
     7: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZN12vcpu_manager8instanceEv
     8: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZN21serial_port_intel_x645writeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
     9: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZN21serial_port_intel_x648instanceEv
    10: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEmmPKc
    11: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEmm
    12: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm
    13: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_mmRKS4_
    14: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev
    15: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZNSt3__16stoullERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPmi
    16: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __cxa_begin_catch
    17: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __cxa_end_catch
    18: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __gxx_personality_v0
    19: 0000000000001230    43 FUNC    GLOBAL DEFAULT    8 __stack_chk_fail
    20: 0000000000002008     8 OBJECT  GLOBAL DEFAULT    9 __stack_chk_guard
    21: 0000000000001000   417 FUNC    GLOBAL DEFAULT    8 write
    22: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZSt9terminatev
    23: 0000000000001260    28 FUNC    GLOBAL DEFAULT    8 ___xpg_strerror_r
    24: 0000000000004000     8 OBJECT  GLOBAL DEFAULT   12 __dso_handle
    25: 0000000000001280    13 FUNC    GLOBAL DEFAULT    8 _start
    26: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND abort
    27: 0000000000004010  1200 OBJECT  GLOBAL DEFAULT   12 g_eh_frame_list
    28: 0000000000004008     8 OBJECT  GLOBAL DEFAULT   12 g_eh_frame_list_num
    29: 00000000000011b0    20 FUNC    GLOBAL DEFAULT    8 get_eh_frame_list
    30: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND memset
    31: 00000000000011d0    84 FUNC    GLOBAL DEFAULT    8 register_eh_frame
    32: 00000000000012a0     0 FUNC    GLOBAL DEFAULT    8 execute_entry

Histogram for bucket list length (total of 27 buckets):
 Length  Number     % of total  Coverage
      0  11         ( 40.7%)
      1  11         ( 40.7%)     42.3%
      2  2          (  7.4%)     57.7%
      3  2          (  7.4%)     80.8%
      4  0          (  0.0%)     80.8%
      5  1          (  3.7%)    100.0%

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170301/a1181046/attachment.html>


More information about the llvm-bugs mailing list