[PATCH] D106392: ThinLTO: Fix promotion aliases with MSVC name mangling

Sami Tolvanen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 13:12:09 PDT 2021


samitolvanen created this revision.
Herald added subscribers: ormris, jeroen.dobbelaere, pengfei, steven_wu, hiraditya, inglorion.
samitolvanen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Use quotes around function names in module inline assembly to
fix promotion aliases with x86_64-pc-windows-msvc, which uses
MSVC compatible name mangling.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106392

Files:
  llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
  llvm/test/Transforms/ThinLTOBitcodeWriter/cfi-icall-static-inline-asm.ll


Index: llvm/test/Transforms/ThinLTOBitcodeWriter/cfi-icall-static-inline-asm.ll
===================================================================
--- llvm/test/Transforms/ThinLTOBitcodeWriter/cfi-icall-static-inline-asm.ll
+++ llvm/test/Transforms/ThinLTOBitcodeWriter/cfi-icall-static-inline-asm.ll
@@ -3,7 +3,7 @@
 
 target triple = "x86_64-unknown-linux-gnu"
 
-; CHECK: module asm ".set a,a.[[HASH:[0-9a-f]+]]"
+; CHECK: module asm ".set \22a\22,\22a.[[HASH:[0-9a-f]+]]\22"
 
 define void @b() {
   %f = alloca void ()*, align 8
Index: llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
===================================================================
--- llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
+++ llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
@@ -74,7 +74,7 @@
     if (isa<Function>(&ExportGV)) {
       // Create a local alias with the original name to avoid breaking
       // references from inline assembly.
-      std::string Alias = ".set " + OldName + "," + NewName + "\n";
+      std::string Alias = ".set \"" + OldName + "\",\"" + NewName + "\"\n";
       ExportM.appendModuleInlineAsm(Alias);
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106392.360250.patch
Type: text/x-patch
Size: 1138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210720/0e35744c/attachment.bin>


More information about the llvm-commits mailing list