[PATCH] D34692: [LLD][ELF] Add support for multiple passes to createThunks()

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 07:12:17 PDT 2017


ikudrin added a comment.

This is a copy of a comment from D34689 <https://reviews.llvm.org/D34689#811237>.

It is possible that a precreated thunk section stays empty in the first pass, but is used in the next pass. In that case, it isn't added into ISR in ThunkCreator::mergeThunks(). For example:

  $ cat a.s
  	.global _start, foo
  .section .text.start,"ax",%progbits
  _start:
  	bl _start
  .section .text.dummy1,"ax",%progbits
  .space 0xfffffe
  .section .text.foo,"ax",%progbits
  foo:
  	bl _start
  $ llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi a.s -o a.o
  $ ld.lld a.o -o a.out
  $ objdump -d a.out
  a.out:     file format elf32-littlearm
  
  
  Disassembly of section .text:
  
  00011000 <_start>:
     11000:	f7ff effe 	blx	11000 <_start>
  
  00011004 <__Thumbv7ABSLongThunk__start>:
     11004:	f241 0c00 	movw	ip, #4096	; 0x1000
     11008:	f2c0 0c01 	movt	ip, #1
     1100c:	4760      	bx	ip
  	...
  
  01011002 <__Thumbv7ABSLongThunk__start>:
  	...
  
  0101100c <foo>:
   101100c:	f7ff fff9 	bl	1011002 <__Thumbv7ABSLongThunk__start>


https://reviews.llvm.org/D34692





More information about the llvm-commits mailing list