[PATCH] D28956: [LLD][ELF] Add support for local symbols in Synthetic Sections

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 02:03:35 PST 2017


peter.smith added a comment.

That is possible although in many cases the disassembler can derive that information without an additional symbol. For example there is some functionality in GNU objdump to display the symbol name of the PLT from some hard-coded choice of PLT size made when building objdump. For example, from hello world compiled and linked with ld.bfd:

  000102ac <puts at plt-0x14>:
     102ac:	e52de004 	push	{lr}		; (str lr, [sp, #-4]!)
     102b0:	e59fe004 	ldr	lr, [pc, #4]	; 102bc <_init+0x1c>
     102b4:	e08fe00e 	add	lr, pc, lr
     102b8:	e5bef008 	ldr	pc, [lr, #8]!
     102bc:	00010288 	.word	0x00010288
  
  000102c0 <puts at plt>:
     102c0:	e28fc600 	add	ip, pc, #0, 12
     102c4:	e28cca10 	add	ip, ip, #16, 20	; 0x10000
     102c8:	e5bcf288 	ldr	pc, [ip, #648]!	; 0x288
  ...

The lld ARM backend uses 4 word plt entries and doesn't get picked up by objdump's recognizer.

For x86 objdump can recognise lld's plt entries

  00000000002011b0 <__libc_start_main at plt-0x10>:
    2011b0:	ff 35 62 0e 00 00    	pushq  0xe62(%rip)        # 202018 <__TMC_END__+0x8>
    2011b6:	ff 25 64 0e 00 00    	jmpq   *0xe64(%rip)        # 202020 <__TMC_END__+0x10>
    2011bc:	0f 1f 40 00          	nopl   0x0(%rax)
  
  00000000002011c0 <__libc_start_main at plt>:
    2011c0:	ff 25 62 0e 00 00    	jmpq   *0xe62(%rip)        # 202028 <__TMC_END__+0x18>
    2011c6:	68 00 00 00 00       	pushq  $0x0
    2011cb:	e9 e0 ff ff ff       	jmpq   2011b0 <_fini+0x10>

So I think it probably isn't worth manually adding the symbols with @plt.


https://reviews.llvm.org/D28956





More information about the llvm-commits mailing list