[lld] [RISCV] Compress unrelaxable lui when RVC attribute is present (PR #74715)

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 09:04:47 PST 2023


================
@@ -650,8 +650,36 @@ static void relaxHi20Lo12(const InputSection &sec, size_t i, uint64_t loc,
   if (!gp)
     return;
 
+  bool noRelaxation = false;
   if (!isInt<12>(r.sym->getVA(r.addend) - gp->getVA()))
+    noRelaxation = true;
+
+  if (noRelaxation) {
+    if (r.type != R_RISCV_HI20 || !(config->eflags & EF_RISCV_RVC) ||
----------------
nemanjai wrote:

The second condition needs to change to something like the above updated way of determining if RVC is enabled:
`!(getEFlags(sec.file) & EF_RISCV_RVC)`

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


More information about the llvm-commits mailing list