Skip to content

Commit 7088910

Browse files
committed
MCAsmStreamer: Print relocation type number if applicable
The fixup output is a debug aid and should not be used to test target-specific relocation generation implementation. The llvm-mc -filetype=obj output is what truly matters.
1 parent 49dfd72 commit 7088910

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

llvm/lib/MC/MCAsmStreamer.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,12 +2399,16 @@ void MCAsmStreamer::AddEncodingComment(const MCInst &Inst,
23992399

24002400
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
24012401
MCFixup &F = Fixups[i];
2402-
const MCFixupKindInfo &Info =
2403-
getAssembler().getBackend().getFixupKindInfo(F.getKind());
24042402
OS << " fixup " << char('A' + i) << " - "
24052403
<< "offset: " << F.getOffset() << ", value: ";
24062404
F.getValue()->print(OS, MAI);
2407-
OS << ", kind: " << Info.Name << "\n";
2405+
auto Kind = F.getKind();
2406+
if (FirstRelocationKind <= Kind)
2407+
OS << ", relocation type: " << (Kind - FirstRelocationKind);
2408+
else
2409+
OS << ", kind: "
2410+
<< getAssembler().getBackend().getFixupKindInfo(Kind).Name;
2411+
OS << '\n';
24082412
}
24092413
}
24102414

llvm/test/MC/AArch64/tls-relocs.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@
389389
// CHECK: add x5, x4, :tlsdesc_lo12:var // encoding: [0x85,0bAAAAAA00,0b00AAAAAA,0x91]
390390
// CHECK: // fixup A - offset: 0, value: :tlsdesc_lo12:var, kind: fixup_aarch64_add_imm12
391391
// CHECK: .tlsdesccall var // encoding: []
392-
// CHECK-NEXT: // fixup A - offset: 0, value: var, kind: FK_NONE
392+
// CHECK-NEXT: // fixup A - offset: 0, value: var, relocation type: 569
393393
// CHECK: blr x3 // encoding: [0x60,0x00,0x3f,0xd6]
394394

395395
// CHECK-ELF-NEXT: 0x104 R_AARCH64_TLSDESC_ADR_PAGE21 [[VARSYM]]

0 commit comments

Comments
 (0)