This introduces R_RISCV_PLT32, PC-relative data relocation that takes the 32-bit relative offset to a function or its PLT entry from its relocation location. This is needed to support relative vtables on RISCV. Github PR: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/363 The lld handling of this reloc is D143115. Differential Revision: https://reviews.llvm.org/D143226
13 lines
603 B
LLVM
13 lines
603 B
LLVM
; RUN: llc -mtriple=riscv64 < %s | FileCheck %s --match-full-lines
|
|
; RUN: llc -mtriple=riscv32 < %s | FileCheck %s --match-full-lines
|
|
|
|
declare void @extern_func()
|
|
|
|
; CHECK-LABEL: const:
|
|
; CHECK-NEXT: .word extern_func@PLT-const
|
|
|
|
;; Note that for riscv32, the ptrtoint will actually upcast the ptr it to an
|
|
;; oversized 64-bit pointer that eventually gets truncated. This isn't needed
|
|
;; for riscv32, but this unifies the RV64 and RV32 test cases.
|
|
@const = dso_local constant i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @extern_func to i64), i64 ptrtoint (ptr @const to i64)) to i32)
|