Skip to content

Commit 08e5f68

Browse files
committed
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. llvm-svn: 308406
1 parent 984f1dc commit 08e5f68

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

llvm/include/llvm/Object/COFFModuleDefinition.h

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace object {
2828
struct COFFModuleDefinition {
2929
std::vector<COFFShortExport> Exports;
3030
std::string OutputFile;
31+
std::string ImportName;
3132
uint64_t ImageBase = 0;
3233
uint64_t StackReserve = 0;
3334
uint64_t StackCommit = 0;

llvm/lib/Object/COFFModuleDefinition.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,17 @@ class Parser {
188188
std::string Name;
189189
if (Error Err = parseName(&Name, &Info.ImageBase))
190190
return Err;
191-
// Append the appropriate file extension if not already present.
192-
if (!sys::path::has_extension(Name))
193-
Name += IsDll ? ".dll" : ".exe";
191+
192+
Info.ImportName = Name;
194193

195194
// Set the output file, but don't override /out if it was already passed.
196-
if (Info.OutputFile.empty())
195+
if (Info.OutputFile.empty()) {
197196
Info.OutputFile = Name;
197+
// Append the appropriate file extension if not already present.
198+
if (!sys::path::has_extension(Name))
199+
Info.OutputFile += IsDll ? ".dll" : ".exe";
200+
}
201+
198202
return Error::success();
199203
}
200204
case KwVersion:

0 commit comments

Comments
 (0)