[llvm] [BOLT][RISCV] Don't read .rela.plt twice when DT_RELA aliases DT_JMPREL (PR #211201)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 02:23:03 PDT 2026


================
@@ -2731,6 +2731,14 @@ void RewriteInstance::processDynamicRelocations() {
     }
   }
 
+  // On RISC-V, DT_RELA aliases DT_JMPREL when .rela.dyn is empty. Skip it to
+  // avoid reading .rela.plt twice.
+  if (DynamicRelocationsAddress && PLTRelocationsAddress &&
+      *DynamicRelocationsAddress == *PLTRelocationsAddress) {
----------------
WangJee wrote:

In my opinion, although this currently only shows up on RISC-V, it isn't conceptually RISC-V specific: if any target ever emits DT_RELA aliasing DT_JMPREL, skipping the duplicate read is the correct behavior there too.

https://github.com/llvm/llvm-project/pull/211201


More information about the llvm-commits mailing list