[PATCH] D63076: [ELF][RISCV] Support PLT, GOT, copy and relative relocations

Jim Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 16:11:57 PDT 2019


jimw added a comment.

After spending some time looking at this, I have to agree with MaskRay that there is no meaningful distinction between R_RISCV_CALL and R_RISCV_CALL_PLT and they can be implemented the same.  As a test, I tried modifying GNU ld to handle R_RISCV_CALL exactly the same as R_RISCV_CALL_PLT, did native linux and cross newlib/linux builds and checks, and nothing broke.  The native gcc testsuite run is still going, but I don't expect that anything will fail.  I found the aarch64 ABI to be convincing.  It is a relatively recently designed ABI and has only R_AARCH64_CALL26 for calls.  An aarch64 toolchain emits the same assembly source for pic and non-pic calls, and creates the same object file code and relocs.  It isn't until link time where you see a difference, depending on the type of linking, and symbol info, at which point the R_RISCV_CALL reloc is modified to point directly at the target symbol or the PLT for it.  Older ABIs have separate relocs and separate assembly syntax for pic versus non-pic because older toolchains needed that, but current toolchains don't need that anymore.  It looks like a mistake designing the RISC-V ABI that we ended up with some old style assembler syntax and relocs that we don't need.

I haven't studied the full patch.  I'm already working on too many different projects and don't want to increase the number of them.  I'm just trying to comment on the stuff that appears to be in question.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63076/new/

https://reviews.llvm.org/D63076





More information about the llvm-commits mailing list