forked from OSchip/llvm-project
[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 llvm-svn: 310991
This commit is contained in:
parent
58c9527eaf
commit
e1f120bbcb
|
@ -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
|
||||
|
|
|
@ -560,7 +560,7 @@ NewArchiveMember ObjectFactory::createWeakExternal(StringRef Sym,
|
|||
|
||||
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);
|
||||
|
@ -578,7 +578,7 @@ std::error_code writeImportLibrary(StringRef ImportName, StringRef Path,
|
|||
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;
|
||||
|
|
|
@ -171,7 +171,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
|
|||
}
|
||||
}
|
||||
|
||||
if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine))
|
||||
if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine, true))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue