[llvm] 2661d59 - MC: Remove post-relaxation and Symbol printing from mc-dump output

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 28 22:47:43 PDT 2025


Author: Fangrui Song
Date: 2025-06-28T22:47:38-07:00
New Revision: 2661d595793c422fa98fa320cc6a7838d2c0e09c

URL: https://github.com/llvm/llvm-project/commit/2661d595793c422fa98fa320cc6a7838d2c0e09c
DIFF: https://github.com/llvm/llvm-project/commit/2661d595793c422fa98fa320cc6a7838d2c0e09c.diff

LOG: MC: Remove post-relaxation and Symbol printing from mc-dump output

The "Symbol" stanza includes symbol names with all zero indexes. which
are not useful.

The "assembler backend - post-relaxation" part is not useful. Only
Hexagon (and X86 when x86-pad-for-align is set) might change the layout
between "post-relaxation" and "final-layout". From my experience
debugging the two passes requires more dumping code not served by the
output.

Added: 
    

Modified: 
    llvm/lib/MC/MCAssembler.cpp
    llvm/test/MC/ELF/mc-dump.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index a331ec8fe0eb4..1d6b1f0302bf6 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -848,10 +848,6 @@ void MCAssembler::layout() {
     if (getContext().hadError())
       return;
 
-  DEBUG_WITH_TYPE("mc-dump", {
-      errs() << "assembler backend - post-relaxation\n--\n";
-      dump(); });
-
   // Some targets might want to adjust fragment offsets. If so, perform another
   // layout iteration.
   if (getBackend().finishLayout(*this))
@@ -1275,25 +1271,10 @@ LLVM_DUMP_METHOD void MCAssembler::dump() const{
   raw_ostream &OS = errs();
 
   OS << "Sections:[";
-  bool First = true;
   for (const MCSection &Sec : *this) {
     OS << '\n';
     Sec.dump();
   }
   OS << "\n]\n";
-  OS << "Symbols:[\n";
-
-  First = true;
-  for (const MCSymbol &Sym : symbols()) {
-    if (First)
-      First = false;
-    else
-      OS << "\n";
-    OS << "(";
-    Sym.dump();
-    OS << ", Index:" << Sym.getIndex() << ", ";
-    OS << ")";
-  }
-  OS << "\n]\n";
 }
 #endif

diff  --git a/llvm/test/MC/ELF/mc-dump.s b/llvm/test/MC/ELF/mc-dump.s
index e7b018f9dad25..1b101a3ea863a 100644
--- a/llvm/test/MC/ELF/mc-dump.s
+++ b/llvm/test/MC/ELF/mc-dump.s
@@ -22,9 +22,6 @@
 # CHECK-NEXT:4 Fill Value:0 ValueSize:1 NumValues:1
 # CHECK-NEXT:5 LEB Value:.Ltmp1-.Ltmp0 Signed:0
 # CHECK-NEXT:]
-# CHECK-NEXT:Symbols:[
-# CHECK-NEXT:(.text, Index:0, )
-# CHECK-NEXT:(.Ltmp0, Index:0, )
 
 0:
 .org 3


        


More information about the llvm-commits mailing list