[PATCH] D27406: [LLD][ELF] Ifunc implementation using synthetic sections

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 09:55:04 PST 2016


peter.smith added a comment.

My current thinking is that the x86_32 ifunc support is not working at the moment.
When I look at the disassembly and the .plt.got that both ld.bfd and lld generate,  I see that in ld.bfd the .plt.got entry for the ifunc .plt entry contains the address of the ifunc resolver, whereas in lld the equivalent .plt.got entry points back to the lazy function resolver. I think that this is because on x86_64 the address of the ifunc resolver is in the relocation addend, whereas in x86_32 (which uses rel) it has to put the address directly into the .plt.got.

ld.bfd (*804a008 == 0804847b == func1_ifunc)

   08048370 <*ABS*@plt>:
   8048370:	ff 25 08 a0 04 08    	jmp    *0x804a008
   8048376:	68 10 00 00 00       	push   $0x10
   804837b:	e9 c0 ff ff ff       	jmp    8048340 <_init+0x24>
  
  Contents of section .got.plt:
   8049ff4 089f0408 00000000 00000000 56830408  ............V...
   804a004 66830408 7b840408                    f...{...       
  
  0804847b <func1_ifunc>:

lld (*1301c == 11216 == *ABS*`@`plt + 6)

  000111f0 <__libc_start_main at plt-0x10>:
     111f0:	ff 35 10 30 01 00    	pushl  0x13010
     111f6:	ff 25 14 30 01 00    	jmp    *0x13014
     111fc:	90                   	nop
     111fd:	90                   	nop
     111fe:	90                   	nop
     111ff:	90                   	nop
  
  00011210 <*ABS*@plt>:
     11210:	ff 25 1c 30 01 00    	jmp    *0x1301c
     11216:	68 08 00 00 00       	push   $0x8
     1121b:	e9 d0 ff ff ff       	jmp    111f0 <_fini+0x24>
  
  Contents of section .got.plt:
   1300c 0c200100 00000000 00000000 06120100  . ..............
   1301c 16120100  




https://reviews.llvm.org/D27406





More information about the llvm-commits mailing list