[llvm] r310991 - [COFF] Make the weak aliases optional

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 10:05:58 PDT 2017


Merged to 5.0 in r311100.

On Tue, Aug 15, 2017 at 10:22 PM, Martin Storsjo via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: mstorsjo
> Date: Tue Aug 15 22:22:49 2017
> New Revision: 310991
>
> URL: http://llvm.org/viewvc/llvm-project?rev=310991&view=rev
> Log:
> [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/trunk/include/llvm/Object/COFFImportFile.h
>     llvm/trunk/lib/Object/COFFImportFile.cpp
>     llvm/trunk/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
>
> Modified: llvm/trunk/include/llvm/Object/COFFImportFile.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFFImportFile.h?rev=310991&r1=310990&r2=310991&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/COFFImportFile.h (original)
> +++ llvm/trunk/include/llvm/Object/COFFImportFile.h Tue Aug 15 22:22:49 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/trunk/lib/Object/COFFImportFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFImportFile.cpp?rev=310991&r1=310990&r2=310991&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Object/COFFImportFile.cpp (original)
> +++ llvm/trunk/lib/Object/COFFImportFile.cpp Tue Aug 15 22:22:49 2017
> @@ -560,7 +560,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);
> @@ -578,7 +578,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/trunk/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp?rev=310991&r1=310990&r2=310991&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp (original)
> +++ llvm/trunk/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp Tue Aug 15 22:22:49 2017
> @@ -171,7 +171,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayR
>      }
>    }
>
> -  if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine))
> +  if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine, true))
>      return 1;
>    return 0;
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list