
https://reviews.llvm.org/D17938 introduced lowerRelativeReference to give ConstantExpr sub (A-B) special semantics in ELF: when `A` is an `unnamed_addr` function, create a PLT-generating relocation. This was intended for C++ relative vtables, but C++ relative vtable ended up using DSOLocalEquivalent (lowerDSOLocalEquivalent). This special treatment of `unnamed_addr` seems unusual. Let's remove it. Only COFF needs an overload to generate a @IMGREL32 relocation specifier (llvm/test/MC/COFF/cross-section-relative.ll). Pull Request: https://github.com/llvm/llvm-project/pull/134781
18 lines
786 B
LLVM
18 lines
786 B
LLVM
; RUN: llc -mtriple=armv7-unknown-linux -o - %s | FileCheck %s
|
|
|
|
@vtable = constant [4 x i32] [i32 0,
|
|
i32 sub (i32 ptrtoint (ptr @fn1 to i32), i32 ptrtoint (ptr getelementptr ([4 x i32], ptr @vtable, i32 0, i32 1) to i32)),
|
|
i32 sub (i32 ptrtoint (ptr @fn2 to i32), i32 ptrtoint (ptr getelementptr ([4 x i32], ptr @vtable, i32 0, i32 1) to i32)),
|
|
i32 sub (i32 ptrtoint (ptr @fn3 to i32), i32 ptrtoint (ptr getelementptr ([4 x i32], ptr @vtable, i32 0, i32 1) to i32))
|
|
]
|
|
|
|
declare void @fn1() unnamed_addr
|
|
declare void @fn2() unnamed_addr
|
|
declare void @fn3()
|
|
|
|
;; Create a PC-relative relocation that the linker might decline if the addend symbol is preemptible.
|
|
; CHECK: .long 0
|
|
; CHECK-NEXT: .long fn1-vtable-4
|
|
; CHECK-NEXT: .long fn2-vtable-4
|
|
; CHECK-NEXT: .long fn3-vtable-4
|