[PATCH] D143673: [lld][RISCV] Implement GP relaxation for R_RISCV_HI20/R_RISCV_LO12_I/R_RISCV_LO12_S.

Joseph Faulls via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 09:24:01 PST 2023


Joe added inline comments.


================
Comment at: lld/ELF/Arch/RISCV.cpp:443
+    Defined *gp = ElfSym::riscvGlobalPointer;
+    int64_t displace = val - gp->getVA();
+    checkInt(loc, displace, 12, rel);
----------------
`val` is sign extended here, but gp VA is not. This would cause errors on 32 bit if the MSB of gp VA is set


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143673



More information about the llvm-commits mailing list