[PATCH] D38554: Fixed ppc32 function relocations in non-pic mode

vit9696 via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 22 16:08:01 PDT 2017


vit9696 added a comment.

@joerg, this is nonsense in general, and possibly implementation dependent. A simple example as follows:

  int f1();
  int _start() { return f1(); }

Produces the following disassembly with the current llvm:

  Disassembly of section .text:
  _start:
         0:	7c 08 02 a6 	mflr 0
         4:	90 01 00 04 	stw 0, 4(1)
         8:	94 21 ff f0 	stwu 1, -16(1)
         c:	93 e1 00 0c 	stw 31, 12(1)
        10:	7c 3f 0b 78 	mr 31, 1
        14:	48 00 00 01 	bl .+0
  			00000014:  R_PPC_PLTREL24	Unknown
        18:	80 01 00 14 	lwz 0, 20(1)
        1c:	83 e1 00 0c 	lwz 31, 12(1)
        20:	38 21 00 10 	addi 1, 1, 16
        24:	7c 08 03 a6 	mtlr 0
        28:	4e 80 00 20 	blr

Even if you could find a linker that optimises R_PPC_PLTREL24 into R_PPC_REL24 for local symbols, this will not change the fact that this is an optimisation, and a linker is expected to produce PLT calls when given such code.


https://reviews.llvm.org/D38554





More information about the llvm-commits mailing list