[PATCH] D127611: [ELF] Relax R_RISCV_CALL and R_RISCV_CALL_PLT

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 3 09:46:27 PDT 2022


jrtc27 added inline comments.


================
Comment at: lld/ELF/Arch/RISCV.cpp:494
+  // For relocations[i], the actual type is relocTypes[i].
+  SmallVector<uint32_t, 0> relocTypes;
+  SmallVector<uint32_t, 0> writes;
----------------
RelType


================
Comment at: lld/ELF/Arch/RISCV.cpp:505
       sec->relaxAux->relocDeltas.resize(sec->relocations.size());
+      sec->relaxAux->relocTypes.resize(sec->relocations.size());
     }
----------------
Same comment as for relocDeltas in the other patch, really just want a pointer not a dynamically-resizable SmallVector


================
Comment at: lld/ELF/Arch/RISCV.cpp:544
+  const uint64_t dest =
+      (!sym.isPreemptible && (!sym.isGnuIFunc() || config->zIfuncNoplt)
+           ? sym.getVA()
----------------
Shouldn't we know from the relocation's expr which we picked? Repeating a version of that logic seems fragile.


================
Comment at: lld/ELF/Arch/RISCV.cpp:604
 
+      std::fill(aux.relocTypes.begin(), aux.relocTypes.end(), 0);
+      aux.writes.clear();
----------------
R_RISCV_NONE


================
Comment at: lld/ELF/Arch/RISCV.cpp:710
           }
+        } else if (uint32_t newType = aux.relocTypes[i]) {
+          const uint32_t insn = aux.writes[writesIdx++];
----------------
RelType (and maybe check != R_RISCV_NONE explicitly?)


================
Comment at: lld/ELF/Arch/RISCV.cpp:739
           rels[i].offset -= delta;
+          if (aux.relocTypes[i])
+            rels[i].type = aux.relocTypes[i];
----------------
(maybe != R_RISCV_NONE?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127611



More information about the llvm-commits mailing list