[LLVMdev] [lld] Emitting section relative offsets in st_value

Tom Stellard tom at stellard.net
Wed Jun 17 06:51:17 PDT 2015


Hi,

I'm working on an AMDGPU target for lld, and I'm running into an issue where
the symbol offset stored in st_value is converted from section relative
to absolute during linking.  I'm wondering if there is some way to
avoid this.

Here is the ELF dump from my object file:

  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
...
 [ 2] .text             PROGBITS         0000000000000000  00000100
       0000000000000258  0000000000000000  AX       0     0     256


Symbol table '.symtab' contains 5 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000250     0 NOTYPE  LOCAL  DEFAULT    2 BB0_2
     2: 00000000000001e4     0 NOTYPE  LOCAL  DEFAULT    2 BB0_3
     3: 0000000000000258     0 NOTYPE  LOCAL  DEFAULT    2 EndOfTextLabel
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    2 matmul

Here is the ELF dump from the executable produced by the linker:

  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
...
 [ 6] .text             PROGBITS         0000000000001000  00001000
       0000000000000258  0000000000000000 WAXo       0     0     256

Symbol table '.symtab' contains 5 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000001000   484 IFUNC   LOCAL  DEFAULT    6 matmul
     2: 00000000000011e4   108 IFUNC   LOCAL  DEFAULT    6 BB0_3
     3: 0000000000001250     8 IFUNC   LOCAL  DEFAULT    6 BB0_2
     4: 0000000000001258     0 IFUNC   LOCAL  DEFAULT    6 EndOfTextLabel

Thanks,
Tom



More information about the llvm-dev mailing list