[PATCH] D113365: [LLD][COFF] Support GNU style == aliases

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 08:29:10 PST 2021


mstorsjo added a comment.

In D113365#3121497 <https://reviews.llvm.org/D113365#3121497>, @aykevl wrote:

> In D113365#3116356 <https://reviews.llvm.org/D113365#3116356>, @mstorsjo wrote:
>
>> - While this works for creating an import library out of a def file only, analoguously to llvm-dlltool, one can't create similar aliases while actually linking (doing that requires a couple more tweaks in a couple places, at least).
>
> Can you elaborate? With this fix I was able to link Windows binaries that referenced these aliases (using the MinWG lld driver). The linker was able to resolve them to the correct, non-weak versions.

I’m not talking about linking against the created import library, I’m talking about linking the actual dll that the import library is for.

Example:

  $ cat mylib.c 
  void func1(void) {}
  $ cat mylib.def 
  EXPORTS
  func1
  aliasname == func1
  $ clang -c mylib.c
  $ lld-link mylib.o -out:mylib.dll -dll -noentry -def:mylib.def -implib:mylib.lib
  lld-link: error: <root>: undefined symbol: aliasname
  $ lld-link -def:mylib.def -implib:mylib.lib -machine:x64 

Thus, the def with an alias works when you create an implib from the def file only, but you can't use the same def file when you actually produce your DLL.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113365/new/

https://reviews.llvm.org/D113365



More information about the llvm-commits mailing list