[PATCH] D158122: [MC][COFF][AArch64] Fix the storage class for private linkage symbols.

Hiroshi Yamauchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 17:42:59 PDT 2023


hjyamauchi updated this revision to Diff 550943.
hjyamauchi added a comment.

Moved the test to test/CodeGen and removed the `-filetype=asm` flag.

PTAL.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158122/new/

https://reviews.llvm.org/D158122

Files:
  llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
  llvm/test/CodeGen/AArch64/local-sym-storage-class.ll
  llvm/test/CodeGen/X86/local-sym-storage-class.ll


Index: llvm/test/CodeGen/X86/local-sym-storage-class.ll
===================================================================
--- /dev/null
+++ 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;
Index: llvm/test/CodeGen/AArch64/local-sym-storage-class.ll
===================================================================
--- /dev/null
+++ 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;
Index: llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -138,9 +138,9 @@
     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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158122.550943.patch
Type: text/x-patch
Size: 1984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230817/5e0a5e14/attachment.bin>


More information about the llvm-commits mailing list