[llvm] r308406 - Object: preserve more information about DEF file

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 19:01:22 PDT 2017


Author: compnerd
Date: Tue Jul 18 19:01:22 2017
New Revision: 308406

URL: http://llvm.org/viewvc/llvm-project?rev=308406&view=rev
Log:
Object: preserve more information about DEF file

Preserve the actual library name as provided by the user.  This is
required to properly replicate link's behaviour about the module import
name handling.  This requires an associated change to lld for updating
the tests for the proper behaviour for the import library module name
handling in various cases.

Associated tests will be part of the lld change.

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

Modified: llvm/trunk/include/llvm/Object/COFFModuleDefinition.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFFModuleDefinition.h?rev=308406&r1=308405&r2=308406&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFFModuleDefinition.h (original)
+++ llvm/trunk/include/llvm/Object/COFFModuleDefinition.h Tue Jul 18 19:01:22 2017
@@ -28,6 +28,7 @@ namespace object {
 struct COFFModuleDefinition {
   std::vector<COFFShortExport> Exports;
   std::string OutputFile;
+  std::string ImportName;
   uint64_t ImageBase = 0;
   uint64_t StackReserve = 0;
   uint64_t StackCommit = 0;

Modified: llvm/trunk/lib/Object/COFFModuleDefinition.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFModuleDefinition.cpp?rev=308406&r1=308405&r2=308406&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFModuleDefinition.cpp (original)
+++ llvm/trunk/lib/Object/COFFModuleDefinition.cpp Tue Jul 18 19:01:22 2017
@@ -188,13 +188,17 @@ private:
       std::string Name;
       if (Error Err = parseName(&Name, &Info.ImageBase))
         return Err;
-      // Append the appropriate file extension if not already present.
-      if (!sys::path::has_extension(Name))
-        Name += IsDll ? ".dll" : ".exe";
+
+      Info.ImportName = Name;
 
       // Set the output file, but don't override /out if it was already passed.
-      if (Info.OutputFile.empty())
+      if (Info.OutputFile.empty()) {
         Info.OutputFile = Name;
+        // Append the appropriate file extension if not already present.
+        if (!sys::path::has_extension(Name))
+          Info.OutputFile += IsDll ? ".dll" : ".exe";
+      }
+
       return Error::success();
     }
     case KwVersion:




More information about the llvm-commits mailing list