mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-03 17:31:50 +00:00
5011913625
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267211 91177308-0d34-0410-b5e6-96231b3b80d8
17 lines
745 B
LLVM
17 lines
745 B
LLVM
; 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
|