Skip to content

Commit 3406934

Browse files
committed
[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
1 parent 8d3ff60 commit 3406934

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ class AArch64AsmPrinter : public AsmPrinter {
138138
SetupMachineFunction(MF);
139139

140140
if (STI->isTargetCOFF()) {
141-
bool Internal = MF.getFunction().hasInternalLinkage();
142-
COFF::SymbolStorageClass Scl = Internal ? COFF::IMAGE_SYM_CLASS_STATIC
143-
: COFF::IMAGE_SYM_CLASS_EXTERNAL;
141+
bool Local = MF.getFunction().hasLocalLinkage();
142+
COFF::SymbolStorageClass Scl =
143+
Local ? COFF::IMAGE_SYM_CLASS_STATIC : COFF::IMAGE_SYM_CLASS_EXTERNAL;
144144
int Type =
145145
COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT;
146146

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; RUN: llc -mtriple aarch64-unknown-windows-msvc %s -o - | FileCheck %s
2+
3+
define internal void @internal() {
4+
ret void
5+
}
6+
7+
define private void @private() {
8+
ret void
9+
}
10+
11+
; Check that the internal and private linkage symbols have IMAGE_SYM_CLASS_STATIC (3).
12+
; CHECK: .def internal;
13+
; CHECK: .scl 3;
14+
; CHECK: .def .Lprivate;
15+
; CHECK: .scl 3;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; RUN: llc -mtriple x86_64-unknown-windows-msvc %s -o - | FileCheck %s
2+
3+
define internal void @internal() {
4+
ret void
5+
}
6+
7+
define private void @private() {
8+
ret void
9+
}
10+
11+
; Check that the internal and private linkage symbols have IMAGE_SYM_CLASS_STATIC (3).
12+
; CHECK: .def internal;
13+
; CHECK: .scl 3;
14+
; CHECK: .def .Lprivate;
15+
; CHECK: .scl 3;

0 commit comments

Comments
 (0)