[lld] [ELF] Implement R_RISCV_TLSDESC for RISC-V (PR #79239)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 14:34:24 PST 2024


================
@@ -102,6 +104,26 @@ static uint32_t setLO12_S(uint32_t insn, uint32_t imm) {
          (extractBits(imm, 4, 0) << 7);
 }
 
+namespace {
+struct SymbolAnchor {
+  uint64_t offset;
+  Defined *d;
+  bool end; // true for the anchor of st_value+st_size
+};
+} // namespace
+
+struct elf::RISCVRelaxAux {
+  // This records symbol start and end offsets which will be adjusted according
+  // to the nearest relocDeltas element.
+  SmallVector<SymbolAnchor, 0> anchors;
+  // For relocations[i], the actual offset is r_offset - (i ? relocDeltas[i-1] :
+  // 0).
----------------
ilovepi wrote:

```suggestion
  // For relocations[i], the actual offset is:
  //   r_offset - (i ? relocDeltas[i-1] : 0).
```

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


More information about the llvm-commits mailing list