[lld] r332127 - [PPC64] isRelExpr should return true for the PPC Call Exprs.
Sean Fertile via llvm-commits
llvm-commits at lists.llvm.org
Fri May 11 12:31:19 PDT 2018
Author: sfertile
Date: Fri May 11 12:31:19 2018
New Revision: 332127
URL: http://llvm.org/viewvc/llvm-project?rev=332127&view=rev
Log:
[PPC64] isRelExpr should return true for the PPC Call Exprs.
Both R_PPC_CALL and R_PPC_CALL_PLT Exprs map to the R_PPC64_REL24 relocation
which has the form Sym + addend - P.
Differential Revision: https://reviews.llvm.org/D46654
Added:
lld/trunk/test/ELF/ppc64-rel-so-local-calls.s
Modified:
lld/trunk/ELF/Relocations.cpp
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=332127&r1=332126&r2=332127&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Fri May 11 12:31:19 2018
@@ -328,7 +328,8 @@ static bool needsGot(RelExpr Expr) {
// file (PC, or GOT for example).
static bool isRelExpr(RelExpr Expr) {
return isRelExprOneOf<R_PC, R_GOTREL, R_GOTREL_FROM_END, R_MIPS_GOTREL,
- R_PAGE_PC, R_RELAX_GOT_PC>(Expr);
+ R_PPC_CALL, R_PPC_CALL_PLT, R_PAGE_PC,
+ R_RELAX_GOT_PC>(Expr);
}
// Returns true if a given relocation can be computed at link-time.
Added: lld/trunk/test/ELF/ppc64-rel-so-local-calls.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-rel-so-local-calls.s?rev=332127&view=auto
==============================================================================
--- lld/trunk/test/ELF/ppc64-rel-so-local-calls.s (added)
+++ lld/trunk/test/ELF/ppc64-rel-so-local-calls.s Fri May 11 12:31:19 2018
@@ -0,0 +1,87 @@
+// REQUIRES: ppc
+
+// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
+// RUN: ld.lld -shared -z notext %t.o -o %t.so
+// RUN: llvm-readelf -dyn-relocations %t.so | FileCheck %s
+
+// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
+// RUN: ld.lld -shared -z notext %t.o -o %t.so
+// RUN: llvm-readelf -dyn-relocations %t.so | FileCheck %s
+
+
+// CHECK-NOT: foo
+// CHECK-NOT: bar
+
+ .text
+ .abiversion 2
+ .globl baz
+ .p2align 4
+ .type baz, at function
+baz:
+.Lfunc_begin0:
+.Lfunc_gep0:
+ addis 2, 12, .TOC.-.Lfunc_gep0 at ha
+ addi 2, 2, .TOC.-.Lfunc_gep0 at l
+.Lfunc_lep0:
+ .localentry baz, .Lfunc_lep0-.Lfunc_gep0
+ mflr 0
+ std 0, 16(1)
+ stdu 1, -64(1)
+ std 30, 48(1)
+ std 29, 40(1)
+ mr 30, 3
+ bl foo
+ mr 29, 3
+ mr 3, 30
+ bl bar
+ mullw 3, 3, 29
+ ld 30, 48(1)
+ ld 29, 40(1)
+ extsw 3, 3
+ addi 1, 1, 64
+ ld 0, 16(1)
+ mtlr 0
+ blr
+ .long 0
+ .quad 0
+.Lfunc_end0:
+ .size baz, .Lfunc_end0-.Lfunc_begin0
+
+ .p2align 4
+ .type foo, at function
+foo:
+.Lfunc_begin1:
+ mullw 3, 3, 3
+ extsw 3, 3
+ blr
+ .long 0
+ .quad 0
+.Lfunc_end1:
+ .size foo, .Lfunc_end1-.Lfunc_begin1
+
+ .p2align 4
+ .type bar, at function
+bar:
+.Lfunc_begin2:
+.Lfunc_gep2:
+ addis 2, 12, .TOC.-.Lfunc_gep2 at ha
+ addi 2, 2, .TOC.-.Lfunc_gep2 at l
+.Lfunc_lep2:
+ .localentry bar, .Lfunc_lep2-.Lfunc_gep2
+ mflr 0
+ std 0, 16(1)
+ stdu 1, -48(1)
+ std 30, 32(1)
+ mr 30, 3
+ bl foo
+ mullw 3, 3, 30
+ ld 30, 32(1)
+ extsw 3, 3
+ addi 1, 1, 48
+ ld 0, 16(1)
+ mtlr 0
+ blr
+ .long 0
+ .quad 0
+.Lfunc_end2:
+ .size bar, .Lfunc_end2-.Lfunc_begin2
More information about the llvm-commits
mailing list