[lld][RISCV] Introduce handling for R_RISCV_PLT32 relocation
authorLeonard Chan <leonardchan@google.com>
Thu, 23 Feb 2023 22:05:11 +0000 (22:05 +0000)
committerLeonard Chan <leonardchan@google.com>
Thu, 23 Feb 2023 22:05:52 +0000 (22:05 +0000)
commit4f0aa2517d0cef0422cca03667f572b935f062fb
treed7196d6eee26c8207ea877ddc916894becfe42f8
parentc1b3e888449045db6b57353b2b3ebbb56541fb6c
[lld][RISCV] Introduce handling for R_RISCV_PLT32 relocation

This introduces R_RISCV_PLT32, a PC-relative data relocation that takes
the 32-bit relative offset to a function or its PLT entry.

This is needed to support relative vtables on RISCV.

Github PR: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/363

D143226 has the llvm parts.

Differential Revision: https://reviews.llvm.org/D143115
lld/ELF/Arch/RISCV.cpp
lld/ELF/InputSection.cpp
lld/test/ELF/riscv-reloc-plt32.s [new file with mode: 0644]
lld/test/ELF/riscv-undefined-weak.s