diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index 85ddf1b6da283..7f2bfefa5578a 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -756,7 +756,7 @@ static void relaxCall(Ctx &ctx, const InputSection &sec, size_t i, uint64_t loc, // When the caller specifies the old value of `remove`, disallow its // increment. - if (remove >= 6 && rvc && isInt<12>(displace) && rd == 0) { + if (remove >= 6 && rvc && isInt<12>(displace) && rd == X_X0) { sec.relaxAux->relocTypes[i] = R_RISCV_RVC_JUMP; sec.relaxAux->writes.push_back(0xa001); // c.j remove = 6;