[llvm] 3d0846b - [MC] Explicitly mark MCSymbol for MO_ExternalSymbol (#108880)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 21:16:34 PDT 2024


Author: weiwei chen
Date: 2024-09-20T00:16:31-04:00
New Revision: 3d0846bedcd18d546fd3733c93c2e144f2faab09

URL: https://github.com/llvm/llvm-project/commit/3d0846bedcd18d546fd3733c93c2e144f2faab09
DIFF: https://github.com/llvm/llvm-project/commit/3d0846bedcd18d546fd3733c93c2e144f2faab09.diff

LOG: [MC] Explicitly mark MCSymbol for MO_ExternalSymbol (#108880)

- [x] Mark `MCSymbol` for `MO_ExternalSymbol` to be external when
created.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86MCInstLower.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index 55c237e2df2d2e..b6560f1cc60747 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -350,8 +350,12 @@ MCOperand X86MCInstLower::LowerMachineOperand(const MachineInstr *MI,
     return MCOperand::createImm(MO.getImm());
   case MachineOperand::MO_MachineBasicBlock:
   case MachineOperand::MO_GlobalAddress:
-  case MachineOperand::MO_ExternalSymbol:
     return LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
+  case MachineOperand::MO_ExternalSymbol: {
+    MCSymbol *Sym = GetSymbolFromOperand(MO);
+    Sym->setExternal(true);
+    return LowerSymbolOperand(MO, Sym);
+  }
   case MachineOperand::MO_MCSymbol:
     return LowerSymbolOperand(MO, MO.getMCSymbol());
   case MachineOperand::MO_JumpTableIndex:


        


More information about the llvm-commits mailing list