[lld] [llvm] [MC] Explicitly mark MCSymbol for MO_ExternalSymbol (PR #108880)
weiwei chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 20:50:53 PDT 2024
https://github.com/weiweichen updated https://github.com/llvm/llvm-project/pull/108880
>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 1/2] 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:
>From f353d11fd2417f9e65fa5efbbfea6c6196b5d30e Mon Sep 17 00:00:00 2001
From: Weiwei Chen <weiwei.chen at modular.com>
Date: Tue, 17 Sep 2024 03:50:22 +0000
Subject: [PATCH 2/2] Fix load-hidden.ll
---
lld/test/MachO/load-hidden.ll | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lld/test/MachO/load-hidden.ll b/lld/test/MachO/load-hidden.ll
index 110b96ae5cf5a6..1e92acce18d110 100644
--- a/lld/test/MachO/load-hidden.ll
+++ b/lld/test/MachO/load-hidden.ll
@@ -6,7 +6,7 @@
; RUN: %lld -dylib -lSystem %t/obj.o -load_hidden %t/archive.a -o %t/test.dylib
; RUN: llvm-nm %t/test.dylib | FileCheck %s
-; CHECK: t _foo
+; CHECK: T _foo
;--- archive.ll
target triple = "x86_64-apple-macosx10.15.0"
More information about the llvm-commits
mailing list