[llvm] [MC] Explicitly mark MCSymbol for MO_ExternalSymbol (PR #108880)
weiwei chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 13:39:25 PDT 2024
https://github.com/weiweichen created https://github.com/llvm/llvm-project/pull/108880
- [x] Mark `MCSymbol` for `MO_ExternalSymbol` to be external when created.
>From 8bf3c85978b774c0606e5d1be7cbd3415f036259 Mon Sep 17 00:00:00 2001
From: Weiwei Chen <weiwei.chen at modular.com>
Date: Mon, 16 Sep 2024 20:37:30 +0000
Subject: [PATCH] Explicitly mark MCSymbol for MO_ExternalSymbol
---
llvm/lib/Target/X86/X86MCInstLower.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index 77ddd2366e629e..949711f35aa584 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -350,8 +350,11 @@ 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