[llvm] [RISCV] Track Linker Relaxable through Assembly Relaxation (PR #152602)
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 8 14:26:02 PDT 2025
================
@@ -803,6 +803,41 @@ void RISCVAsmBackend::maybeAddVendorReloc(const MCFragment &F,
Asm->getWriter().recordRelocation(F, VendorFixup, VendorTarget, VendorValue);
}
+static bool fixupGetsRelaxRelocation(const MCFixupKind Kind) {
+ switch (Kind) {
----------------
lenary wrote:
I added more to the linker-relaxation-pr150071.s test which will fail if this either always returns `true` or `false`.
The problem is about the over-approximation of `RelaxCandidate = true` in the MCCodeEmitter. Now, many more relocations are marked as linkerrelaxable, which is good, but those might be pc-relative resolvable, like a jump over non-relaxable data. In these cases we want to allow the fixup itself to resolve if possible (these will only be left if they are in range, when xqcilb is enabled).
And then we want to make sure, if a fixup is not resolved, that only fixups expecting R_RISCV_RELAX get that relocation, even if the fixup is marked linker relaxable.
https://github.com/llvm/llvm-project/pull/152602
More information about the llvm-commits
mailing list