[llvm] 777391a - MCFixup: Improve location accuracy and remove MCFixup::Loc
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 4 12:06:33 PDT 2025
Author: Fangrui Song
Date: 2025-07-04T12:06:28-07:00
New Revision: 777391a2164b89d2030ca013562151ca3c3676d1
URL: https://github.com/llvm/llvm-project/commit/777391a2164b89d2030ca013562151ca3c3676d1
DIFF: https://github.com/llvm/llvm-project/commit/777391a2164b89d2030ca013562151ca3c3676d1.diff
LOG: MCFixup: Improve location accuracy and remove MCFixup::Loc
Remove the redundant MCFixup::Loc member and instead use MCExpr::Loc to
determine the location for fixups. Previously, many target MCCodeEmitter would
use the beginning of an instruction for fixup locations, which often
resulted in inaccurate column information.
```
// RISCVMCCodeEmitter::getImmOpValue
Fixups.push_back(MCFixup::create(0, Expr, FixupKind, MI.getLoc()));
// X86MCCodeEmitter::emitImmediate
Fixups.push_back(MCFixup::create(static_cast<uint32_t>(CB.size() - StartByte), Expr, FixupKind, Loc));
```
While MCExpr::Loc generally provides more meaningful location data,
tests should avoid over-relying on it. For instance, MCBinaryExpr's
location refers to its operator, and for operands with sigils (like
`$foo`), the location often omits the sigils.
https://llvm-compile-time-tracker.com/compare.php?from=8740ff822d462844506134bb7c425e1778518b95&to=831a11f75d22d64982b13dba132d656ac8567612&stat=instructions%3Au
I've also considered removing MCExpr::Loc (revert
https://reviews.llvm.org/D28861), but we'd lose too much information.
It's also difficult to carry location information to improve location
tracking in target MCCodeEmitter.
This change utilizes previous MCExpr::Loc improvement like
7e3e2e1b8c6ff21e68782a56164139cca334fcf3
7b517cf743f112f980cf6a4d6e6190c2a5b3e451
Added:
Modified:
llvm/include/llvm/MC/MCFixup.h
llvm/lib/MC/MCAssembler.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/test/MC/AArch64/coff-relocations-branch26.s
llvm/test/MC/AArch64/coff-relocations-diags.s
llvm/test/MC/AArch64/ilp32-diagnostics.s
llvm/test/MC/AMDGPU/max-branch-distance.s
llvm/test/MC/ARM/Windows/branch-reloc-offset.s
llvm/test/MC/ARM/Windows/invalid-relocation.s
llvm/test/MC/ARM/arm-memory-instructions-immediate.s
llvm/test/MC/ARM/lower-upper-errors-2.s
llvm/test/MC/ARM/pcrel-ldrd-diff-section.s
llvm/test/MC/ARM/pcrel-vldr-diff-section.s
llvm/test/MC/ARM/quad-relocation.s
llvm/test/MC/ARM/t2-modified-immediate-fixup-error1.s
llvm/test/MC/ARM/thumb1-relax-adr.s
llvm/test/MC/ARM/thumb1-relax-bcc.s
llvm/test/MC/ARM/thumb1-relax-br.s
llvm/test/MC/ARM/thumb1-relax-ldrlit.s
llvm/test/MC/ELF/bad-expr.s
llvm/test/MC/ELF/relocation-alias.s
llvm/test/MC/ELF/weakref.s
llvm/test/MC/LoongArch/Relocations/fixups-diagnostics.s
llvm/test/MC/Mips/reloc-directive-bad-obj.s
llvm/test/MC/Mips/unsupported-relocation.s
llvm/test/MC/RISCV/Relocations/data-directive-specifier.s
llvm/test/MC/RISCV/Relocations/expr-err.s
llvm/test/MC/RISCV/fixups-diagnostics.s
llvm/test/MC/RISCV/option-exact-long-jump-disable.s
llvm/test/MC/RISCV/pcrel-lo12-invalid.s
llvm/test/MC/RISCV/rv32-relaxation-xqci.s
llvm/test/MC/RISCV/xandesperf-fixups-diagnostics.s
llvm/test/MC/VE/data-reloc-error.s
llvm/test/MC/X86/macho-reloc-errors-x86.s
llvm/test/MC/X86/macho-reloc-errors-x86_64.s
llvm/test/MC/X86/pltoff.s
llvm/test/MC/Xtensa/Relocations/fixups-diagnostics.s
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCFixup.h b/llvm/include/llvm/MC/MCFixup.h
index ab2e47189fdb7..091d72eb129ea 100644
--- a/llvm/include/llvm/MC/MCFixup.h
+++ b/llvm/include/llvm/MC/MCFixup.h
@@ -81,8 +81,6 @@ class MCFixup {
/// Consider bit fields if we need more flags.
- /// The source location which gave rise to the fixup, if any.
- SMLoc Loc;
public:
static MCFixup create(uint32_t Offset, const MCExpr *Value,
MCFixupKind Kind, SMLoc Loc = SMLoc()) {
@@ -90,7 +88,6 @@ class MCFixup {
FI.Value = Value;
FI.Offset = Offset;
FI.Kind = Kind;
- FI.Loc = Loc;
return FI;
}
static MCFixup create(uint32_t Offset, const MCExpr *Value, unsigned Kind,
@@ -128,7 +125,7 @@ class MCFixup {
}
}
- SMLoc getLoc() const { return Loc; }
+ SMLoc getLoc() const;
};
namespace mc {
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index cc21cf41c2660..4b7845335d822 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -1240,3 +1240,9 @@ LLVM_DUMP_METHOD void MCAssembler::dump() const{
OS << "\n]\n";
}
#endif
+
+SMLoc MCFixup::getLoc() const {
+ if (auto *E = getValue())
+ return E->getLoc();
+ return {};
+}
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index f9df8d133e14a..ec6f4e2ae216e 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -6436,7 +6436,7 @@ bool ARMAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
return true;
const auto *ExprVal =
- MCSpecifierExpr::create(SubExprVal, Spec, getContext());
+ MCSpecifierExpr::create(SubExprVal, Spec, getContext(), S);
E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
Operands.push_back(ARMOperand::CreateImm(ExprVal, S, E, *this));
return false;
diff --git a/llvm/test/MC/AArch64/coff-relocations-branch26.s b/llvm/test/MC/AArch64/coff-relocations-branch26.s
index 4cd47032309ca..51bbb4932f231 100644
--- a/llvm/test/MC/AArch64/coff-relocations-branch26.s
+++ b/llvm/test/MC/AArch64/coff-relocations-branch26.s
@@ -61,7 +61,7 @@ main:
err:
nop
b .Lerr_target+4
-// ERR: [[#@LINE-1]]:5: error: cannot perform a PC-relative fixup with a non-zero symbol offset
+// ERR: [[#@LINE-1]]:19: error: cannot perform a PC-relative fixup with a non-zero symbol offset
.def .Lerr_target
.scl 3
diff --git a/llvm/test/MC/AArch64/coff-relocations-diags.s b/llvm/test/MC/AArch64/coff-relocations-diags.s
index e03ba377dc18b..41fdd03df8f3f 100644
--- a/llvm/test/MC/AArch64/coff-relocations-diags.s
+++ b/llvm/test/MC/AArch64/coff-relocations-diags.s
@@ -1,17 +1,17 @@
// RUN: not llvm-mc -triple aarch64-win32 -filetype=obj %s -o /dev/null 2>&1 | FileCheck %s
adrp x0, :got:symbol
- // CHECK: [[#@LINE-1]]:3: error: relocation specifier :got: unsupported on COFF targets
+ // CHECK: [[#@LINE-1]]:12: error: relocation specifier :got: unsupported on COFF targets
// CHECK-NEXT: adrp x0, :got:symbol
// CHECK-NEXT: ^
ldr x0, [x0, :got_lo12:symbol]
- // CHECK: [[#@LINE-1]]:3: error: relocation specifier :got_lo12: unsupported on COFF targets
+ // CHECK: [[#@LINE-1]]:16: error: relocation specifier :got_lo12: unsupported on COFF targets
// CHECK-NEXT: ldr x0, [x0, :got_lo12:symbol]
// CHECK-NEXT: ^
adrp x0, :tlsdesc:symbol
- // CHECK: [[#@LINE-1]]:3: error: relocation specifier :tlsdesc: unsupported on COFF targets
+ // CHECK: [[#@LINE-1]]:12: error: relocation specifier :tlsdesc: unsupported on COFF targets
// CHECK-NEXT: adrp x0, :tlsdesc:symbol
// CHECK-NEXT: ^
add x0, x0, :tlsdesc_lo12:symbol
diff --git a/llvm/test/MC/AArch64/ilp32-diagnostics.s b/llvm/test/MC/AArch64/ilp32-diagnostics.s
index 0679dea3135c0..aff01ed4c76aa 100644
--- a/llvm/test/MC/AArch64/ilp32-diagnostics.s
+++ b/llvm/test/MC/AArch64/ilp32-diagnostics.s
@@ -3,7 +3,7 @@
// RUN: FileCheck --check-prefix=ERROR %s --implicit-check-not=error: < %t2
.xword sym-.
-// ERROR: [[#@LINE-1]]:8: error: 8 byte PC relative data relocation is not supported in ILP32
+// ERROR: [[#@LINE-1]]:11: error: 8 byte PC relative data relocation is not supported in ILP32
.xword sym+16
// ERROR: [[#@LINE-1]]:[[#]]: error: 8 byte absolute data relocation is not supported in ILP32
@@ -15,7 +15,7 @@
// ERROR: [[#@LINE-1]]:[[#]]: error: 8 byte absolute data relocation is not supported in ILP32
movz x7, #:abs_g3:some_label
-// ERROR: [[#@LINE-1]]:1: error: absolute MOV relocation is not supported in ILP32
+// ERROR: [[#@LINE-1]]:11: error: absolute MOV relocation is not supported in ILP32
// ERROR: movz x7, #:abs_g3:some_label
movz x3, #:abs_g2:some_label
@@ -89,7 +89,7 @@ ldr x24, [x23, :gottprel_lo12:sym]
// ERROR: [[#@LINE-1]]:[[#]]: error: 64-bit load/store relocation is not supported in ILP32
ldr x24, :got_auth:sym
-// ERROR: [[#@LINE-1]]:1: error: LDR AUTH relocation is not supported in ILP32
+// ERROR: [[#@LINE-1]]:10: error: LDR AUTH relocation is not supported in ILP32
adr x24, :got_auth:sym
// ERROR: [[#@LINE-1]]:[[#]]: error: ADR AUTH relocation is not supported in ILP32
diff --git a/llvm/test/MC/AMDGPU/max-branch-distance.s b/llvm/test/MC/AMDGPU/max-branch-distance.s
index 0e3337a7e04b4..46aa524f7ab4f 100644
--- a/llvm/test/MC/AMDGPU/max-branch-distance.s
+++ b/llvm/test/MC/AMDGPU/max-branch-distance.s
@@ -1,5 +1,5 @@
// RUN: not llvm-mc -triple=amdgcn -filetype=obj -o /dev/null %s 2>&1 | FileCheck -check-prefix=ERROR %s
-// ERROR: max-branch-distance.s:7:3: error: branch size exceeds simm16
+// ERROR: max-branch-distance.s:7:12: error: branch size exceeds simm16
// fill v_nop
LBB0_0:
diff --git a/llvm/test/MC/ARM/Windows/branch-reloc-offset.s b/llvm/test/MC/ARM/Windows/branch-reloc-offset.s
index e7d59cdcf6d40..f5b2ea7040333 100644
--- a/llvm/test/MC/ARM/Windows/branch-reloc-offset.s
+++ b/llvm/test/MC/ARM/Windows/branch-reloc-offset.s
@@ -65,11 +65,11 @@ err:
// Test errors, if referencing a symbol with an offset
b .Lerr_target+4
-// ERR: [[#@LINE-1]]:5: error: cannot perform a PC-relative fixup with a non-zero symbol offset
+// ERR: [[#@LINE-1]]:19: error: cannot perform a PC-relative fixup with a non-zero symbol offset
bl .Lerr_target+4
-// ERR: [[#@LINE-1]]:5: error: cannot perform a PC-relative fixup with a non-zero symbol offset
+// ERR: [[#@LINE-1]]:20: error: cannot perform a PC-relative fixup with a non-zero symbol offset
blx .Lerr_target+4
-// ERR: [[#@LINE-1]]:5: error: cannot perform a PC-relative fixup with a non-zero symbol offset
+// ERR: [[#@LINE-1]]:21: error: cannot perform a PC-relative fixup with a non-zero symbol offset
// Test errors, if referencing a private label which lacks .def/.scl/.type/.endef, in another
// section, without an offset. Such symbols are omitted from the output symbol table, so the
@@ -77,7 +77,7 @@ err:
// section plus an offset, but such an offset is not supported with this relocation.
b .Lerr_target2
-// ERR: [[#@LINE-1]]:5: error: cannot perform a PC-relative fixup with a non-zero symbol offset
+// ERR: [[#@LINE-1]]:7: error: cannot perform a PC-relative fixup with a non-zero symbol offset
.def .Lerr_target
.scl 3
diff --git a/llvm/test/MC/ARM/Windows/invalid-relocation.s b/llvm/test/MC/ARM/Windows/invalid-relocation.s
index 821de8dd55604..01528614c11db 100644
--- a/llvm/test/MC/ARM/Windows/invalid-relocation.s
+++ b/llvm/test/MC/ARM/Windows/invalid-relocation.s
@@ -9,4 +9,4 @@
.thumb_func
adr r0, invalid_relocation+1
-# CHECK: 10:2: error: unsupported relocation type
+# CHECK: 10:28: error: unsupported relocation type
diff --git a/llvm/test/MC/ARM/arm-memory-instructions-immediate.s b/llvm/test/MC/ARM/arm-memory-instructions-immediate.s
index d72028edc9e21..23cf547226cc1 100644
--- a/llvm/test/MC/ARM/arm-memory-instructions-immediate.s
+++ b/llvm/test/MC/ARM/arm-memory-instructions-immediate.s
@@ -21,5 +21,5 @@ foo:
// CHECK-NEXT: strb r0, [r1, #1024]
.ifdef ERR
str r0, [r1, 1b]
-// ERR:[[#@LINE-1]]:5: error: unsupported relocation type
+// ERR:[[#@LINE-1]]:18: error: unsupported relocation type
.endif
diff --git a/llvm/test/MC/ARM/lower-upper-errors-2.s b/llvm/test/MC/ARM/lower-upper-errors-2.s
index 6561b0751930f..7b21b5a266cb2 100644
--- a/llvm/test/MC/ARM/lower-upper-errors-2.s
+++ b/llvm/test/MC/ARM/lower-upper-errors-2.s
@@ -8,11 +8,11 @@
// For errors that are reported earlier, when initially reading the
// instructions, see lower-upper-errors.s.
-// CHECK: [[@LINE+1]]:1: error: unsupported relocation
+// CHECK: [[@LINE+1]]:15: error: unsupported relocation
adds r0, r0, #foo
// CHECK: [[@LINE+1]]:[[#]]: error: unsupported relocation
add r9, r0, #foo
-// CHECK: [[@LINE+1]]:1: error: expected relocatable expression
+// CHECK: [[@LINE+1]]:11: error: expected relocatable expression
movs r11, :upper8_15:#foo
diff --git a/llvm/test/MC/ARM/pcrel-ldrd-
diff -section.s b/llvm/test/MC/ARM/pcrel-ldrd-
diff -section.s
index 0b745a97687d5..b235bde45e99c 100644
--- a/llvm/test/MC/ARM/pcrel-ldrd-
diff -section.s
+++ b/llvm/test/MC/ARM/pcrel-ldrd-
diff -section.s
@@ -16,8 +16,8 @@ bar:
ldrd r0, r1, foo1 @ arm_pcrel_10_unscaled
ldrd r0, r1, foo2-8 @ arm_pcrel_10_unscaled
.ifdef ERR
- @ ERR:[[#@LINE-3]]:5: error: unsupported relocation type
- @ ERR:[[#@LINE-3]]:5: error: unsupported relocation type
+ @ ERR:[[#@LINE-3]]:18: error: unsupported relocation type
+ @ ERR:[[#@LINE-3]]:22: error: unsupported relocation type
.endif
bx lr
diff --git a/llvm/test/MC/ARM/pcrel-vldr-
diff -section.s b/llvm/test/MC/ARM/pcrel-vldr-
diff -section.s
index 44b1032a8f63e..ce058fccdcba2 100644
--- a/llvm/test/MC/ARM/pcrel-vldr-
diff -section.s
+++ b/llvm/test/MC/ARM/pcrel-vldr-
diff -section.s
@@ -9,6 +9,6 @@ vldr s0, foo @ arm_pcrel_10 / t2_pcrel_10
vldr d0, foo @ arm_pcrel_10 / t2_pcrel_10
vldr.16 s0,foo @ arm_pcrel_9 / t2_pcrel_9
-@ CHECK: :[[#@LINE-4]]:1: error: unsupported relocation type
-@ CHECK: :[[#@LINE-4]]:1: error: unsupported relocation type
-@ CHECK: :[[#@LINE-4]]:1: error: unsupported relocation type
+@ CHECK: :[[#@LINE-4]]:10: error: unsupported relocation type
+@ CHECK: :[[#@LINE-4]]:10: error: unsupported relocation type
+@ CHECK: :[[#@LINE-4]]:12: error: unsupported relocation type
diff --git a/llvm/test/MC/ARM/quad-relocation.s b/llvm/test/MC/ARM/quad-relocation.s
index 50d8d82be5843..89c1653b957ac 100644
--- a/llvm/test/MC/ARM/quad-relocation.s
+++ b/llvm/test/MC/ARM/quad-relocation.s
@@ -3,7 +3,7 @@
.align 3
symbol:
-@ CHECK: :[[#@LINE+1]]:6: error: unsupported relocation type
+@ CHECK: :[[#@LINE+1]]:7: error: unsupported relocation type
.quad(symbol)
@ CHECK: :[[#@LINE+1]]:8: error: unsupported relocation type
.8byte symbol
diff --git a/llvm/test/MC/ARM/t2-modified-immediate-fixup-error1.s b/llvm/test/MC/ARM/t2-modified-immediate-fixup-error1.s
index 642484080b1c0..12b5eae77f75f 100644
--- a/llvm/test/MC/ARM/t2-modified-immediate-fixup-error1.s
+++ b/llvm/test/MC/ARM/t2-modified-immediate-fixup-error1.s
@@ -10,4 +10,4 @@
.equ sym0, 0x01abcdef
.L2:
mov r0, .L2
-@ CHECK: :[[#@LINE-1]]:5: error: unsupported relocation type
+@ CHECK: :[[#@LINE-1]]:13: error: unsupported relocation type
diff --git a/llvm/test/MC/ARM/thumb1-relax-adr.s b/llvm/test/MC/ARM/thumb1-relax-adr.s
index 97b566f4833e6..f5c78612395ff 100644
--- a/llvm/test/MC/ARM/thumb1-relax-adr.s
+++ b/llvm/test/MC/ARM/thumb1-relax-adr.s
@@ -4,4 +4,4 @@
.global func1
_func1:
adr r0, _func2
-@ CHECK-ERROR: :[[#@LINE-1]]:9: error: unsupported relocation type
+@ CHECK-ERROR: :[[#@LINE-1]]:17: error: unsupported relocation type
diff --git a/llvm/test/MC/ARM/thumb1-relax-bcc.s b/llvm/test/MC/ARM/thumb1-relax-bcc.s
index 78f3477c19710..7839334bc25da 100644
--- a/llvm/test/MC/ARM/thumb1-relax-bcc.s
+++ b/llvm/test/MC/ARM/thumb1-relax-bcc.s
@@ -5,7 +5,7 @@
.global func1
_func1:
-@ CHECK-ERROR: :[[#@LINE+1]]:9: error: unsupported relocation type
+@ CHECK-ERROR: :[[#@LINE+1]]:13: error: unsupported relocation type
bne _func2
@ CHECK-ELF: f47f affe bne.w {{.+}} @ imm = #-4
diff --git a/llvm/test/MC/ARM/thumb1-relax-br.s b/llvm/test/MC/ARM/thumb1-relax-br.s
index b58dd6c0b413c..618c4b631ff31 100644
--- a/llvm/test/MC/ARM/thumb1-relax-br.s
+++ b/llvm/test/MC/ARM/thumb1-relax-br.s
@@ -9,7 +9,7 @@ _func1:
@ There is no MachO relocation for Thumb1's unconditional branch, so
@ this is unrepresentable. FIXME: I think ELF could represent this.
b _func2
-@ CHECK-ERROR: :[[#@LINE-1]]:9: error: unsupported relocation type
+@ CHECK-ERROR: :[[#@LINE-1]]:11: error: unsupported relocation type
@ CHECK-MACHO: f7ff bffe b.w {{.+}} @ imm = #-4
@ CHECK-MACHO-NEXT: ARM_THUMB_RELOC_BR22
diff --git a/llvm/test/MC/ARM/thumb1-relax-ldrlit.s b/llvm/test/MC/ARM/thumb1-relax-ldrlit.s
index 8f455c89d41eb..261527ef00baa 100644
--- a/llvm/test/MC/ARM/thumb1-relax-ldrlit.s
+++ b/llvm/test/MC/ARM/thumb1-relax-ldrlit.s
@@ -3,5 +3,5 @@
.global func1
_func1:
-@ CHECK-ERROR: :[[#@LINE+1]]:9: error: unsupported relocation type
+@ CHECK-ERROR: :[[#@LINE+1]]:17: error: unsupported relocation type
ldr r0, _func2
diff --git a/llvm/test/MC/ELF/bad-expr.s b/llvm/test/MC/ELF/bad-expr.s
index 2346f5493b98a..e7b5f19521019 100644
--- a/llvm/test/MC/ELF/bad-expr.s
+++ b/llvm/test/MC/ELF/bad-expr.s
@@ -7,6 +7,6 @@ x:
// CHECK: [[@LINE+1]]:{{[0-9]+}}: error: symbol '__executable_start' can not be undefined in a subtraction expression
.quad x-__executable_start
-// CHECK: [[@LINE+1]]:7: error: expected relocatable expression
+// CHECK: [[@LINE+1]]:11: error: expected relocatable expression
.long bar - foo at got
foo:
diff --git a/llvm/test/MC/ELF/relocation-alias.s b/llvm/test/MC/ELF/relocation-alias.s
index d35e741a9449d..154ba460ba685 100644
--- a/llvm/test/MC/ELF/relocation-alias.s
+++ b/llvm/test/MC/ELF/relocation-alias.s
@@ -51,7 +51,7 @@ memcpy_spec1 = __GI_memcpy at PLT+1
.ifdef ERR
.text
## Note, GNU as emits a relocation for this erroneous fixup.
-# ERR: {{.*}}.s:[[#@LINE+2]]:1: error: expected relocatable expression
+# ERR: {{.*}}.s:[[#@LINE+2]]:6: error: expected relocatable expression
memcpy_plus_1 = __GI_memcpy+1
call memcpy_plus_1 at PLT
.endif
diff --git a/llvm/test/MC/ELF/weakref.s b/llvm/test/MC/ELF/weakref.s
index a861625269538..49508463f8c53 100644
--- a/llvm/test/MC/ELF/weakref.s
+++ b/llvm/test/MC/ELF/weakref.s
@@ -113,6 +113,6 @@ alias:
.weakref cycle1, cycle0
call cycle0
# ERR2: <unknown>:0: error: cyclic dependency detected for symbol 'cycle0'
-# ERR2: [[#@LINE-2]]:1: error: expected relocatable expression
+# ERR2: [[#@LINE-2]]:6: error: expected relocatable expression
.endif
diff --git a/llvm/test/MC/LoongArch/Relocations/fixups-diagnostics.s b/llvm/test/MC/LoongArch/Relocations/fixups-diagnostics.s
index c72eef7cd9916..c668729e44c91 100644
--- a/llvm/test/MC/LoongArch/Relocations/fixups-diagnostics.s
+++ b/llvm/test/MC/LoongArch/Relocations/fixups-diagnostics.s
@@ -1,20 +1,20 @@
# RUN: not llvm-mc --triple=loongarch64 --filetype=obj %s -o /dev/null 2>&1 | FileCheck %s
- beq $a0, $a1, unaligned # CHECK: :[[#@LINE]]:3: error: fixup value must be 4-byte aligned
- beqz $a0, unaligned # CHECK: :[[#@LINE]]:3: error: fixup value must be 4-byte aligned
- b unaligned # CHECK: :[[#@LINE]]:3: error: fixup value must be 4-byte aligned
+ beq $a0, $a1, unaligned # CHECK: :[[#@LINE]]:17: error: fixup value must be 4-byte aligned
+ beqz $a0, unaligned # CHECK: :[[#@LINE]]:13: error: fixup value must be 4-byte aligned
+ b unaligned # CHECK: :[[#@LINE]]:5: error: fixup value must be 4-byte aligned
.byte 0
unaligned:
.byte 0
.byte 0
.byte 0
- beq $a0, $a1, out_of_range_b18 # CHECK: :[[#@LINE]]:3: error: fixup value out of range [-131072, 131071]
+ beq $a0, $a1, out_of_range_b18 # CHECK: :[[#@LINE]]:17: error: fixup value out of range [-131072, 131071]
.space 1<<18
out_of_range_b18:
- beqz $a0, out_of_range_b23 # CHECK: :[[#@LINE]]:3: error: fixup value out of range [-4194304, 4194303]
+ beqz $a0, out_of_range_b23 # CHECK: :[[#@LINE]]:13: error: fixup value out of range [-4194304, 4194303]
.space 1<<23
out_of_range_b23:
- b out_of_range_b28 # CHECK: :[[#@LINE]]:3: error: fixup value out of range [-134217728, 134217727]
+ b out_of_range_b28 # CHECK: :[[#@LINE]]:5: error: fixup value out of range [-134217728, 134217727]
.space 1<<28
out_of_range_b28:
diff --git a/llvm/test/MC/Mips/reloc-directive-bad-obj.s b/llvm/test/MC/Mips/reloc-directive-bad-obj.s
index 38056badffca2..86d6d0cc66c57 100644
--- a/llvm/test/MC/Mips/reloc-directive-bad-obj.s
+++ b/llvm/test/MC/Mips/reloc-directive-bad-obj.s
@@ -1,9 +1,9 @@
-# RUN: not llvm-mc -triple mips-unknown-linux %s -show-encoding \
-# RUN: -target-abi=o32 -filetype=obj 2>&1 | FileCheck %s
+# RUN: not llvm-mc -triple mips-unknown-linux %s \
+# RUN: -target-abi=o32 -filetype=obj -o /dev/null 2>&1 | FileCheck %s
.text
nop
-.reloc foo, R_MIPS_32, .text # CHECK: :[[@LINE]]:1: error: unresolved relocation offset
+.reloc foo, R_MIPS_32, .text # CHECK: :[[@LINE]]:24: error: unresolved relocation offset
nop
nop
-.reloc bar, R_MIPS_32, .text # CHECK: :[[@LINE]]:1: error: unresolved relocation offset
+.reloc bar, R_MIPS_32, .text # CHECK: :[[@LINE]]:24: error: unresolved relocation offset
nop
diff --git a/llvm/test/MC/Mips/unsupported-relocation.s b/llvm/test/MC/Mips/unsupported-relocation.s
index 311c0c7d60f20..4cbcff2f168b7 100644
--- a/llvm/test/MC/Mips/unsupported-relocation.s
+++ b/llvm/test/MC/Mips/unsupported-relocation.s
@@ -10,4 +10,4 @@ foo:
.byte x
# CHECK: :[[@LINE-1]]:17: error: MIPS does not support one byte relocations
.byte x+1
-# CHECK: :[[@LINE-1]]:17: error: MIPS does not support one byte relocations
+# CHECK: :[[@LINE-1]]:18: error: MIPS does not support one byte relocations
diff --git a/llvm/test/MC/RISCV/Relocations/data-directive-specifier.s b/llvm/test/MC/RISCV/Relocations/data-directive-specifier.s
index 24fbccdb8abdb..2b97dca147bfe 100644
--- a/llvm/test/MC/RISCV/Relocations/data-directive-specifier.s
+++ b/llvm/test/MC/RISCV/Relocations/data-directive-specifier.s
@@ -28,21 +28,21 @@ data1:
.word %gotpcrel(extern+4), %gotpcrel(extern-5)
.ifdef ERR
-# ERR: [[#@LINE+1]]:7: error: %pltpcrel can only be used in a .word directive
+# ERR: [[#@LINE+1]]:8: error: %pltpcrel can only be used in a .word directive
.quad %pltpcrel(g)
-# ERR: [[#@LINE+1]]:7: error: expected relocatable expression
+# ERR: [[#@LINE+1]]:8: error: expected relocatable expression
.word %pltpcrel(g-.)
-# ERR: [[#@LINE+1]]:7: error: expected relocatable expression
+# ERR: [[#@LINE+1]]:8: error: expected relocatable expression
.word %pltpcrel(extern - und)
-# ERR: [[#@LINE+1]]:7: error: %gotpcrel can only be used in a .word directive
+# ERR: [[#@LINE+1]]:8: error: %gotpcrel can only be used in a .word directive
.quad %gotpcrel(g)
-# ERR: [[#@LINE+1]]:7: error: expected relocatable expression
+# ERR: [[#@LINE+1]]:8: error: expected relocatable expression
.word %gotpcrel(extern - .)
-# ERR: [[#@LINE+1]]:7: error: expected relocatable expression
+# ERR: [[#@LINE+1]]:8: error: expected relocatable expression
.word %gotpcrel(extern - und)
.endif
diff --git a/llvm/test/MC/RISCV/Relocations/expr-err.s b/llvm/test/MC/RISCV/Relocations/expr-err.s
index 72c33c7ff5eff..481a379321a20 100644
--- a/llvm/test/MC/RISCV/Relocations/expr-err.s
+++ b/llvm/test/MC/RISCV/Relocations/expr-err.s
@@ -4,25 +4,25 @@
.quad tls
lui a0, %hi(tls+0-.Ltmp1)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:10: error: expected relocatable expression
lw a0, %lo(tls+0-.Ltmp1)(t0)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:9: error: expected relocatable expression
lui a0, %tprel_hi(tls+0-.Ltmp1)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:10: error: expected relocatable expression
add a0, a0, tp, %tprel_add(tls+0-.Ltmp1)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:18: error: expected relocatable expression
addi a0, a0, %tprel_lo(tls+0-.Ltmp1)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:15: error: expected relocatable expression
auipc a0, %tls_ie_pcrel_hi(tls+0-.Ltmp1)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:12: error: expected relocatable expression
auipc a0, %tls_gd_pcrel_hi(tls+0-.Ltmp1)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:12: error: expected relocatable expression
auipc a0, %pcrel_hi(tls-.Ltmp1)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:12: error: expected relocatable expression
auipc a0, %got_pcrel_hi(tls-.Ltmp1)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:12: error: expected relocatable expression
addi a0, a0, %pcrel_lo(tls-.Ltmp1)
-# CHECK: :[[#@LINE-1]]:1: error: expected relocatable expression
+# CHECK: :[[#@LINE-1]]:15: error: expected relocatable expression
# tail tls+32
# tail tls-tls
diff --git a/llvm/test/MC/RISCV/fixups-diagnostics.s b/llvm/test/MC/RISCV/fixups-diagnostics.s
index 3c99673b81fc2..d19f4050d97e4 100644
--- a/llvm/test/MC/RISCV/fixups-diagnostics.s
+++ b/llvm/test/MC/RISCV/fixups-diagnostics.s
@@ -1,9 +1,9 @@
# RUN: not llvm-mc -triple riscv32 -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s
- jal a0, far_distant # CHECK: :[[@LINE]]:3: error: fixup value out of range
- jal a0, unaligned # CHECK: :[[@LINE]]:3: error: fixup value must be 2-byte aligned
+ jal a0, far_distant # CHECK: :[[@LINE]]:11: error: fixup value out of range
+ jal a0, unaligned # CHECK: :[[@LINE]]:11: error: fixup value must be 2-byte aligned
- blt t0, t1, unaligned # CHECK: :[[@LINE]]:3: error: fixup value must be 2-byte aligned
+ blt t0, t1, unaligned # CHECK: :[[@LINE]]:15: error: fixup value must be 2-byte aligned
.byte 0
unaligned:
diff --git a/llvm/test/MC/RISCV/option-exact-long-jump-disable.s b/llvm/test/MC/RISCV/option-exact-long-jump-disable.s
index 6e4b5fdd31e17..79ca919f8b9d5 100644
--- a/llvm/test/MC/RISCV/option-exact-long-jump-disable.s
+++ b/llvm/test/MC/RISCV/option-exact-long-jump-disable.s
@@ -40,12 +40,12 @@ bar:
.text
## Branches to defined out-of-range symbols should report an error
test_defined_out_of_range:
- bne a0, a1, 1f # CHECK: :[[#@LINE]]:3: error: fixup value out of range
+ bne a0, a1, 1f # CHECK: :[[#@LINE]]:15: error: fixup value out of range
.skip (1 << 12)
1:
- c.beqz a0, 1f # CHECK: :[[#@LINE]]:3: error: fixup value out of range
+ c.beqz a0, 1f # CHECK: :[[#@LINE]]:14: error: fixup value out of range
.skip (1 << 8)
1:
- c.j 1f # CHECK: :[[#@LINE]]:3: error: fixup value out of range
+ c.j 1f # CHECK: :[[#@LINE]]:7: error: fixup value out of range
.skip (1 << 11)
1:
diff --git a/llvm/test/MC/RISCV/pcrel-lo12-invalid.s b/llvm/test/MC/RISCV/pcrel-lo12-invalid.s
index 74a1f2fac9233..e6dce0d6c6981 100644
--- a/llvm/test/MC/RISCV/pcrel-lo12-invalid.s
+++ b/llvm/test/MC/RISCV/pcrel-lo12-invalid.s
@@ -2,6 +2,6 @@
# RUN: not llvm-mc -triple riscv32 -mattr=+relax -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s
1:
- addi a0, a0, %pcrel_lo(1b) # CHECK: :[[@LINE]]:3: error: could not find corresponding %pcrel_hi
- addi a0, a0, %pcrel_lo(0x123456) # CHECK: :[[@LINE]]:3: error: could not find corresponding %pcrel_hi
- addi a0, a0, %pcrel_lo(foo) # CHECK: :[[@LINE]]:3: error: could not find corresponding %pcrel_hi
+ addi a0, a0, %pcrel_lo(1b) # CHECK: :[[@LINE]]:17: error: could not find corresponding %pcrel_hi
+ addi a0, a0, %pcrel_lo(0x123456) # CHECK: :[[@LINE]]:17: error: could not find corresponding %pcrel_hi
+ addi a0, a0, %pcrel_lo(foo) # CHECK: :[[@LINE]]:17: error: could not find corresponding %pcrel_hi
diff --git a/llvm/test/MC/RISCV/rv32-relaxation-xqci.s b/llvm/test/MC/RISCV/rv32-relaxation-xqci.s
index 03c9914bb37d2..b38aa373c90f0 100644
--- a/llvm/test/MC/RISCV/rv32-relaxation-xqci.s
+++ b/llvm/test/MC/RISCV/rv32-relaxation-xqci.s
@@ -160,9 +160,9 @@ EXT_JUMP_NEGATIVE:
.space 0x1000
jal t1, EXT_JUMP
-# ERROR: [[@LINE-1]]:3: error: fixup value out of range
+# ERROR: [[@LINE-1]]:11: error: fixup value out of range
jal t1, EXT_JUMP_NEGATIVE
-# ERROR: [[@LINE-1]]:3: error: fixup value out of range
+# ERROR: [[@LINE-1]]:11: error: fixup value out of range
.space 0x1000
.space 0x100000
diff --git a/llvm/test/MC/RISCV/xandesperf-fixups-diagnostics.s b/llvm/test/MC/RISCV/xandesperf-fixups-diagnostics.s
index e52f8129129d7..2f799977f764f 100644
--- a/llvm/test/MC/RISCV/xandesperf-fixups-diagnostics.s
+++ b/llvm/test/MC/RISCV/xandesperf-fixups-diagnostics.s
@@ -1,7 +1,7 @@
# RUN: not llvm-mc -triple riscv32 -filetype obj -mattr=+xandesperf < %s -o /dev/null 2>&1 | FileCheck %s
- nds.bbc t0, 7, far_distant # CHECK: :[[@LINE]]:3: error: fixup value out of range
- nds.bbc t0, 7, unaligned # CHECK: :[[@LINE]]:3: error: fixup value must be 2-byte aligned
+ nds.bbc t0, 7, far_distant # CHECK: :[[@LINE]]:18: error: fixup value out of range
+ nds.bbc t0, 7, unaligned # CHECK: :[[@LINE]]:18: error: fixup value must be 2-byte aligned
.byte 0
unaligned:
diff --git a/llvm/test/MC/VE/data-reloc-error.s b/llvm/test/MC/VE/data-reloc-error.s
index e312ac4e02d1a..8c03a796e312a 100644
--- a/llvm/test/MC/VE/data-reloc-error.s
+++ b/llvm/test/MC/VE/data-reloc-error.s
@@ -15,12 +15,12 @@ a:
# CHECK: data-reloc-error.s:10:7: error: 1-byte data relocation is not supported
# CHECK-NEXT: .byte _GLOBAL_OFFSET_TABLE_
-# CHECK: data-reloc-error.s:11:7: error: 1-byte pc-relative data relocation is not supported
+# CHECK: data-reloc-error.s:11:29: error: 1-byte pc-relative data relocation is not supported
# CHECK-NEXT: .byte _GLOBAL_OFFSET_TABLE_ - .
# CHECK: data-reloc-error.s:12:8: error: 2-byte data relocation is not supported
# CHECK-NEXT: .2byte _GLOBAL_OFFSET_TABLE_
-# CHECK: data-reloc-error.s:13:8: error: 2-byte pc-relative data relocation is not supported
+# CHECK: data-reloc-error.s:13:30: error: 2-byte pc-relative data relocation is not supported
# CHECK-NEXT: .2byte _GLOBAL_OFFSET_TABLE_ - .
-# CHECK: data-reloc-error.s:14:8: error: 8-byte pc-relative data relocation is not supported
+# CHECK: data-reloc-error.s:14:30: error: 8-byte pc-relative data relocation is not supported
# CHECK-NEXT: .8byte _GLOBAL_OFFSET_TABLE_ - .
diff --git a/llvm/test/MC/X86/macho-reloc-errors-x86.s b/llvm/test/MC/X86/macho-reloc-errors-x86.s
index 4af202220073b..16c656dc472da 100644
--- a/llvm/test/MC/X86/macho-reloc-errors-x86.s
+++ b/llvm/test/MC/X86/macho-reloc-errors-x86.s
@@ -10,6 +10,6 @@ defined:
.section __DATA,__tim2
later:
-// CHECK-ERROR: 3:9: error: symbol 'thing' can not be undefined in a subtraction expression
-// CHECK-ERROR: 4:9: error: symbol 'thing2' can not be undefined in a subtraction expression
-// CHECK-ERROR: 5:9: error: Section too large, can't encode r_address (0x100000b) into 24 bits of scattered relocation entry.
+// CHECK-ERROR: 3:24: error: symbol 'thing' can not be undefined in a subtraction expression
+// CHECK-ERROR: 4:26: error: symbol 'thing2' can not be undefined in a subtraction expression
+// CHECK-ERROR: 5:24: error: Section too large, can't encode r_address (0x100000b) into 24 bits of scattered relocation entry.
diff --git a/llvm/test/MC/X86/macho-reloc-errors-x86_64.s b/llvm/test/MC/X86/macho-reloc-errors-x86_64.s
index daf84a7dbdc4f..040b66656dd25 100644
--- a/llvm/test/MC/X86/macho-reloc-errors-x86_64.s
+++ b/llvm/test/MC/X86/macho-reloc-errors-x86_64.s
@@ -9,11 +9,11 @@
jmp thing at PLT
mov %rax, thing at TLVP
-// CHECK-ERROR: 3:9: error: 32-bit absolute addressing is not supported in 64-bit mode
-// CHECK-ERROR: 4:9: error: expected relocatable expression
-// CHECK-ERROR: 5:9: error: unsupported pc-relative relocation of
diff erence
-// CHECK-ERROR: 6:9: error: unsupported relocation with identical base
-// CHECK-ERROR: 7:9: error: unsupported relocation with subtraction expression, symbol 'thing' can not be undefined in a subtraction expression
-// CHECK-ERROR: 8:9: error: unsupported symbol modifier in relocation
-// CHECK-ERROR: 9:9: error: unsupported symbol modifier in branch relocation
-// CHECK-ERROR: 10:9: error: TLVP symbol modifier should have been rip-rel
+// CHECK-ERROR: 3:19: error: 32-bit absolute addressing is not supported in 64-bit mode
+// CHECK-ERROR: 4:28: error: expected relocatable expression
+// CHECK-ERROR: 5:25: error: unsupported pc-relative relocation of
diff erence
+// CHECK-ERROR: 6:24: error: unsupported relocation with identical base
+// CHECK-ERROR: 7:24: error: unsupported relocation with subtraction expression, symbol 'thing' can not be undefined in a subtraction expression
+// CHECK-ERROR: 8:19: error: unsupported symbol modifier in relocation
+// CHECK-ERROR: 9:13: error: unsupported symbol modifier in branch relocation
+// CHECK-ERROR: 10:19: error: TLVP symbol modifier should have been rip-rel
diff --git a/llvm/test/MC/X86/pltoff.s b/llvm/test/MC/X86/pltoff.s
index a30ee6ccb0983..2f3551b6a8379 100644
--- a/llvm/test/MC/X86/pltoff.s
+++ b/llvm/test/MC/X86/pltoff.s
@@ -14,6 +14,6 @@ movabsq $puts at PLTOFF, %rax
movabsq $.text at PLTOFF, %rax
.ifdef ERR
-# ERR: {{.*}}.s:[[#@LINE+1]]:1: error: 64 bit reloc applied to a field with a
diff erent size
+# ERR: {{.*}}.s:[[#@LINE+1]]:7: error: 64 bit reloc applied to a field with a
diff erent size
movl $puts at PLTOFF, %eax
.endif
diff --git a/llvm/test/MC/Xtensa/Relocations/fixups-diagnostics.s b/llvm/test/MC/Xtensa/Relocations/fixups-diagnostics.s
index 9a81ade9fe284..0904e992a8a32 100644
--- a/llvm/test/MC/Xtensa/Relocations/fixups-diagnostics.s
+++ b/llvm/test/MC/Xtensa/Relocations/fixups-diagnostics.s
@@ -2,13 +2,13 @@
.align 4
- beq a0, a1, LBL1 # CHECK: :[[@LINE]]:3: error: fixup value out of range
+ beq a0, a1, LBL1 # CHECK: :[[@LINE]]:15: error: fixup value out of range
LBL0:
- beqz a0, LBL2 # CHECK: :[[@LINE]]:3: error: fixup value out of range
+ beqz a0, LBL2 # CHECK: :[[@LINE]]:12: error: fixup value out of range
- call0 LBL0 # CHECK: :[[@LINE]]:3: error: fixup value must be 4-byte aligned
+ call0 LBL0 # CHECK: :[[@LINE]]:9: error: fixup value must be 4-byte aligned
- loop a3, LBL0 # CHECK: :[[@LINE]]:3: error: loop fixup value out of range
+ loop a3, LBL0 # CHECK: :[[@LINE]]:12: error: loop fixup value out of range
.space 1<<8
LBL1:
More information about the llvm-commits
mailing list