Author: hans
Date: Thu Aug 17 10:04:53 2017
New Revision: 311100

URL: http://llvm.org/viewvc/llvm-project?rev=311100&view=rev
Log:
Merging r310991:
------------------------------------------------------------------------
r310991 | mstorsjo | 2017-08-15 22:22:49 -0700 (Tue, 15 Aug 2017) | 13 lines

[COFF] Make the weak aliases optional

When creating an import library from lld, the cases with
Name != ExtName shouldn't end up as a weak alias, but as a real
export of the new name, which is what actually is exported from
the DLL.

This restores the behaviour of renamed exports to what it was in
4.0.

The other half of this commit, including test, goes into lld.

Differential Revision: https://reviews.llvm.org/D36633
------------------------------------------------------------------------

Modified:
    llvm/branches/release_50/   (props changed)
    llvm/branches/release_50/include/llvm/Object/COFFImportFile.h
    llvm/branches/release_50/lib/Object/COFFImportFile.cpp
    llvm/branches/release_50/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp

Propchange: llvm/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 17 10:04:53 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,308483-308484,308503,308808,308813,308847,308891,308906,308950,308963,308978,308986,309044,309071,309113,309120,309122,309140,309227,309302,309321,309323,309325,309330,309343,309353,309355,309422,309481,309483,309495,309555,309561,309594,309614,309651,309744,309758,309849,309928,309930,309945,310071,310190,310240-310242,310250,310253,310267,310481,310492,310510,310534,310552,310604,310779,310784,310796,310842,310926,310939,310988
+/llvm/trunk:155241,308483-308484,308503,308808,308813,308847,308891,308906,308950,308963,308978,308986,309044,309071,309113,309120,309122,309140,309227,309302,309321,309323,309325,309330,309343,309353,309355,309422,309481,309483,309495,309555,309561,309594,309614,309651,309744,309758,309849,309928,309930,309945,310071,310190,310240-310242,310250,310253,310267,310481,310492,310510,310534,310552,310604,310779,310784,310796,310842,310926,310939,310988,310991

Modified: llvm/branches/release_50/include/llvm/Object/COFFImportFile.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_50/include/llvm/Object/COFFImportFile.h?rev=311100&r1=311099&r2=311100&view=diff
==============================================================================
--- llvm/branches/release_50/include/llvm/Object/COFFImportFile.h (original)
+++ llvm/branches/release_50/include/llvm/Object/COFFImportFile.h Thu Aug 17 
10:04:53 2017
@@ -99,7 +99,8 @@ struct COFFShortExport {
 std::error_code writeImportLibrary(StringRef ImportName,
                                    StringRef Path,
                                    ArrayRef<COFFShortExport> Exports,
-                                   COFF::MachineTypes Machine);
+                                   COFF::MachineTypes Machine,
+                                   bool MakeWeakAliases);
 
 } // namespace object
 } // namespace llvm

Modified: llvm/branches/release_50/lib/Object/COFFImportFile.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_50/lib/Object/COFFImportFile.cpp?rev=311100&r1=311099&r2=311100&view=diff
==============================================================================
--- llvm/branches/release_50/lib/Object/COFFImportFile.cpp (original)
+++ llvm/branches/release_50/lib/Object/COFFImportFile.cpp Thu Aug 17 10:04:53 
2017
@@ -557,7 +557,7 @@ NewArchiveMember ObjectFactory::createWe
 
 std::error_code writeImportLibrary(StringRef ImportName, StringRef Path,
                                    ArrayRef<COFFShortExport> Exports,
-                                   MachineTypes Machine) {
+                                   MachineTypes Machine, bool MakeWeakAliases) 
{
 
   std::vector<NewArchiveMember> Members;
   ObjectFactory OF(llvm::sys::path::filename(ImportName), Machine);
@@ -575,7 +575,7 @@ std::error_code writeImportLibrary(Strin
     if (E.Private)
       continue;
 
-    if (E.isWeak()) {
+    if (E.isWeak() && MakeWeakAliases) {
       Members.push_back(OF.createWeakExternal(E.Name, E.ExtName, false));
       Members.push_back(OF.createWeakExternal(E.Name, E.ExtName, true));
       continue;

Modified: 
llvm/branches/release_50/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_50/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp?rev=311100&r1=311099&r2=311100&view=diff
==============================================================================
--- llvm/branches/release_50/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp 
(original)
+++ llvm/branches/release_50/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp Thu 
Aug 17 10:04:53 2017
@@ -154,7 +154,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayR
   if (Path.empty())
     Path = getImplibPath(Def->OutputFile);
 
-  if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine))
+  if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine, true))
     return 1;
   return 0;
 }


_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to