[llvm] r310988 - [COFF] Add SymbolName as a distinct field in COFFImportFile

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 22:13:16 PDT 2017


Author: mstorsjo
Date: Tue Aug 15 22:13:16 2017
New Revision: 310988

URL: http://llvm.org/viewvc/llvm-project?rev=310988&view=rev
Log:
[COFF] Add SymbolName as a distinct field in COFFImportFile

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

Modified:
    llvm/trunk/include/llvm/Object/COFFImportFile.h
    llvm/trunk/lib/Object/COFFImportFile.cpp

Modified: llvm/trunk/include/llvm/Object/COFFImportFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFFImportFile.h?rev=310988&r1=310987&r2=310988&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFFImportFile.h (original)
+++ llvm/trunk/include/llvm/Object/COFFImportFile.h Tue Aug 15 22:13:16 2017
@@ -73,6 +73,7 @@ private:
 struct COFFShortExport {
   std::string Name;
   std::string ExtName;
+  std::string SymbolName;
 
   uint16_t Ordinal = 0;
   bool Noname = false;

Modified: llvm/trunk/lib/Object/COFFImportFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFImportFile.cpp?rev=310988&r1=310987&r2=310988&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFImportFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFImportFile.cpp Tue Aug 15 22:13:16 2017
@@ -590,7 +590,7 @@ std::error_code writeImportLibrary(Strin
     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




More information about the llvm-commits mailing list