summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-04-22 20:40:10 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-04-22 20:40:10 +0000
commit265ebd7d70496049d49021b4eb5eabffcf291b7d (patch)
tree4812863753534f9ff90358e0e120efa8bbcac6b8 /llvm/test/CodeGen/ARM
parenteedef73b633496ca52af265b472519f0e385a7d2 (diff)
downloadbcm5719-llvm-265ebd7d70496049d49021b4eb5eabffcf291b7d.tar.gz
bcm5719-llvm-265ebd7d70496049d49021b4eb5eabffcf291b7d.zip
CodeGen: Use PLT relocations for relative references to unnamed_addr functions.
The relative vtable ABI (PR26723) needs PLT relocations to refer to virtual functions defined in other DSOs. The unnamed_addr attribute means that the function's address is not significant, so we're allowed to substitute it with the address of a PLT entry. Also includes a bonus feature: addends for COFF image-relative references. Differential Revision: http://reviews.llvm.org/D17938 llvm-svn: 267211
Diffstat (limited to 'llvm/test/CodeGen/ARM')
-rw-r--r--llvm/test/CodeGen/ARM/plt-relative-reloc.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/plt-relative-reloc.ll b/llvm/test/CodeGen/ARM/plt-relative-reloc.ll
new file mode 100644
index 00000000000..08dcfdf1298
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/plt-relative-reloc.ll
@@ -0,0 +1,16 @@
+; RUN: llc -mtriple=armv7-unknown-linux -o - %s | FileCheck %s
+
+@vtable = constant [4 x i32] [i32 0,
+ i32 sub (i32 ptrtoint (void ()* @fn1 to i32), i32 ptrtoint (i32* getelementptr ([4 x i32], [4 x i32]* @vtable, i32 0, i32 1) to i32)),
+ i32 sub (i32 ptrtoint (void ()* @fn2 to i32), i32 ptrtoint (i32* getelementptr ([4 x i32], [4 x i32]* @vtable, i32 0, i32 1) to i32)),
+ i32 sub (i32 ptrtoint (void ()* @fn3 to i32), i32 ptrtoint (i32* getelementptr ([4 x i32], [4 x i32]* @vtable, i32 0, i32 1) to i32))
+]
+
+declare void @fn1() unnamed_addr
+declare void @fn2() unnamed_addr
+declare void @fn3()
+
+; CHECK: .long 0
+; CHECK-NEXT: .long (fn1(prel31)-vtable)-4
+; CHECK-NEXT: .long (fn2(prel31)-vtable)-4
+; CHECK-NEXT: .long (fn3-vtable)-4
OpenPOWER on IntegriCloud