]> granicus.if.org Git - llvm/commitdiff
[COFF] Add SymbolName as a distinct field in COFFImportFile
authorMartin Storsjo <martin@martin.st>
Wed, 16 Aug 2017 05:13:16 +0000 (05:13 +0000)
committerMartin Storsjo <martin@martin.st>
Wed, 16 Aug 2017 05:13:16 +0000 (05:13 +0000)
The previous Name and ExtName aren't enough to convey all the nuances
between weak aliases and stdcall decorated function names.

A test for this will be added in LLD.

Differential Revision: https://reviews.llvm.org/D36544

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310988 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/COFFImportFile.h
lib/Object/COFFImportFile.cpp

index 8e215b565fc4181c2fabcf4534a4b6eae235dcfc..f6db943c2de860fdb6b42c56a43c298ad55added 100644 (file)
@@ -73,6 +73,7 @@ private:
 struct COFFShortExport {
   std::string Name;
   std::string ExtName;
+  std::string SymbolName;
 
   uint16_t Ordinal = 0;
   bool Noname = false;
index 670c4bb7dd1ee2103c95e630fd3762381239953d..8d0f82e2b92f8cdbe3de7964e406362849e7b094 100644 (file)
@@ -590,7 +590,7 @@ std::error_code writeImportLibrary(StringRef ImportName, StringRef Path,
     if (E.Constant)
       ImportType = IMPORT_CONST;
 
-    StringRef SymbolName = E.isWeak() ? E.ExtName : E.Name;
+    StringRef SymbolName = E.SymbolName.empty() ? E.Name : E.SymbolName;
     ImportNameType NameType = getNameType(SymbolName, E.Name, Machine);
     Expected<std::string> Name = E.ExtName.empty()
                                      ? SymbolName