[llvm] 3406934 - [MC][COFF][AArch64] Fix the storage class for private linkage symbols.
Hiroshi Yamauchi via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 17 13:58:52 PDT 2023
Author: Hiroshi Yamauchi
Date: 2023-08-17T13:54:12-07:00
New Revision: 3406934e4db4bf95c230db072608ed062c13ad5b
URL: https://github.com/llvm/llvm-project/commit/3406934e4db4bf95c230db072608ed062c13ad5b
DIFF: https://github.com/llvm/llvm-project/commit/3406934e4db4bf95c230db072608ed062c13ad5b.diff
LOG: [MC][COFF][AArch64] Fix the storage class for private linkage symbols.
Use IMAGE_SYM_CLASS_STATIC like X86.
Differential Revision: https://reviews.llvm.org/D158122
Added:
llvm/test/CodeGen/AArch64/local-sym-storage-class.ll
llvm/test/CodeGen/X86/local-sym-storage-class.ll
Modified:
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 0dc32b618787d5..4d714df5bb7f60 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -138,9 +138,9 @@ class AArch64AsmPrinter : public AsmPrinter {
SetupMachineFunction(MF);
if (STI->isTargetCOFF()) {
- bool Internal = MF.getFunction().hasInternalLinkage();
- COFF::SymbolStorageClass Scl = Internal ? COFF::IMAGE_SYM_CLASS_STATIC
- : COFF::IMAGE_SYM_CLASS_EXTERNAL;
+ bool Local = MF.getFunction().hasLocalLinkage();
+ COFF::SymbolStorageClass Scl =
+ Local ? COFF::IMAGE_SYM_CLASS_STATIC : COFF::IMAGE_SYM_CLASS_EXTERNAL;
int Type =
COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT;
diff --git a/llvm/test/CodeGen/AArch64/local-sym-storage-class.ll b/llvm/test/CodeGen/AArch64/local-sym-storage-class.ll
new file mode 100644
index 00000000000000..a3b5a8c4e5850f
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/local-sym-storage-class.ll
@@ -0,0 +1,15 @@
+; RUN: llc -mtriple aarch64-unknown-windows-msvc %s -o - | FileCheck %s
+
+define internal void @internal() {
+ ret void
+}
+
+define private void @private() {
+ ret void
+}
+
+; Check that the internal and private linkage symbols have IMAGE_SYM_CLASS_STATIC (3).
+; CHECK: .def internal;
+; CHECK: .scl 3;
+; CHECK: .def .Lprivate;
+; CHECK: .scl 3;
diff --git a/llvm/test/CodeGen/X86/local-sym-storage-class.ll b/llvm/test/CodeGen/X86/local-sym-storage-class.ll
new file mode 100644
index 00000000000000..25df0c5a977790
--- /dev/null
+++ b/llvm/test/CodeGen/X86/local-sym-storage-class.ll
@@ -0,0 +1,15 @@
+; RUN: llc -mtriple x86_64-unknown-windows-msvc %s -o - | FileCheck %s
+
+define internal void @internal() {
+ ret void
+}
+
+define private void @private() {
+ ret void
+}
+
+; Check that the internal and private linkage symbols have IMAGE_SYM_CLASS_STATIC (3).
+; CHECK: .def internal;
+; CHECK: .scl 3;
+; CHECK: .def .Lprivate;
+; CHECK: .scl 3;
More information about the llvm-commits
mailing list