[llvm] 90a23d3 - [MC] Restore setOffset(0) in emitLabel

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 19:53:48 PDT 2024


Author: Fangrui Song
Date: 2024-06-12T19:53:43-07:00
New Revision: 90a23d3a5a843086124c4b9315ee6a7617965623

URL: https://github.com/llvm/llvm-project/commit/90a23d3a5a843086124c4b9315ee6a7617965623
DIFF: https://github.com/llvm/llvm-project/commit/90a23d3a5a843086124c4b9315ee6a7617965623.diff

LOG: [MC] Restore setOffset(0) in emitLabel

For bolt/test/runtime/X86/exceptions-pic.test, llvm-bolt seems to call
emitLabel twice and the assert will fail. Work around it after
2cc4bc132cbcc76c5552cbc128830943ea596b3e

Added: 
    

Modified: 
    llvm/lib/MC/MCObjectStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index ff0558b186936..bf1ce76cdc14b 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -300,7 +300,7 @@ void MCObjectStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
     // Assign all pending labels to offset 0 within the dummy "pending"
     // fragment. (They will all be reassigned to a real fragment in
     // flushPendingLabels())
-    assert(Symbol->getOffset() == 0);
+    Symbol->setOffset(0);
     addPendingLabel(Symbol);
   }
 


        


More information about the llvm-commits mailing list