[llvm] [RISCV] Track Linker Relaxable through Assembly Relaxation (PR #152602)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 9 12:25:43 PDT 2025
================
@@ -576,8 +576,21 @@ uint64_t RISCVMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNo,
"getImmOpValue expects only expressions or immediates");
const MCExpr *Expr = MO.getExpr();
MCExpr::ExprKind Kind = Expr->getKind();
- unsigned FixupKind = RISCV::fixup_riscv_invalid;
+
+ // `RelaxCandidate` must be set to `true` in two cases:
+ // - The fixup's relocation gets a R_RISCV_RELAX relocation
+ // - The underlying instruction may be relaxed to an instruction that gets a
+ // `R_RISCV_RELAX` relocation.
+ //
+ // The actual emission of `R_RISCV_RELAX` will be handled in
+ // `RISCVAsmBackend`.
----------------
MaskRay wrote:
RISCVAsmBackend::applyFixup
(make it clearer)
https://github.com/llvm/llvm-project/pull/152602
More information about the llvm-commits
mailing list