[llvm] [RISC-V] Add SMLoc info for fixup. [NFCI] (PR #142054)
Francesco Petrogalli via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 15:47:11 PDT 2025
https://github.com/fpetrogalli created https://github.com/llvm/llvm-project/pull/142054
This makes sure that potential error messages attached to the fixups being created are linked to the source code that triggered the split.
>From da2b7f7099307198ddee2ded102c5b61947e6e2f Mon Sep 17 00:00:00 2001
From: Francesco Petrogalli <francesco.petrogalli at apple.com>
Date: Thu, 29 May 2025 15:39:18 -0700
Subject: [PATCH] [RISC-V] Add SMLoc info for fixup. [NFCI]
This makes sure that potential error messages attached to the fixups
being created are linked to the source code that triggered the split.
---
llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
index 963501db118e7..7b15a01dcf9ec 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
@@ -645,8 +645,9 @@ bool RISCVAsmBackend::addReloc(const MCFragment &F, const MCFixup &Fixup,
}
MCValue A = MCValue::get(Target.getAddSym(), nullptr, Target.getConstant());
MCValue B = MCValue::get(Target.getSubSym());
- auto FA = MCFixup::create(Fixup.getOffset(), nullptr, TA);
- auto FB = MCFixup::create(Fixup.getOffset(), nullptr, TB);
+ const SMLoc Loc = Fixup.getLoc();
+ auto FA = MCFixup::create(Fixup.getOffset(), nullptr, TA, Loc);
+ auto FB = MCFixup::create(Fixup.getOffset(), nullptr, TB, Loc);
Asm->getWriter().recordRelocation(F, FA, A, FixedValueA);
Asm->getWriter().recordRelocation(F, FB, B, FixedValueB);
FixedValue = FixedValueA - FixedValueB;
More information about the llvm-commits
mailing list