This is an archive of the discontinued LLVM Phabricator instance.

[clang-repl] Fix building with win32 dylibs
ClosedPublic

Authored by mstorsjo on Jul 31 2021, 1:05 PM.

Details

Summary

Use clang_target_link_libraries to avoid duplicate libraries when
the same symbol is provided both by a static library and a larger
dylib, fixing linking with win32 dylibs. This fixes errors like
these:

ld.lld: error: duplicate symbol: llvm::createStringError(std::__1::error_code, char const*)
>>> defined at libLLVMSupport.a(Error.cpp.obj)
>>> defined at libLLVM-14git.dll

This matches how other clang tools declare their dependencies.

Diff Detail

Event Timeline

mstorsjo created this revision.Jul 31 2021, 1:05 PM
mstorsjo requested review of this revision.Jul 31 2021, 1:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2021, 1:05 PM
v.g.vassilev accepted this revision.Aug 1 2021, 6:27 AM

Thanks!

This revision is now accepted and ready to land.Aug 1 2021, 6:27 AM

Forgot to mention that we may need to backport this patch to the llvm13 branch.

This revision was automatically updated to reflect the committed changes.

Forgot to mention that we may need to backport this patch to the llvm13 branch.

That might be good yes, especially if you intend to enable it by default there too. (I only noticed this after it was enabled by default).

Forgot to mention that we may need to backport this patch to the llvm13 branch.

That might be good yes, especially if you intend to enable it by default there too. (I only noticed this after it was enabled by default).

It should be enabled already for the llvm13 branch.

Forgot to mention that we may need to backport this patch to the llvm13 branch.

That might be good yes, especially if you intend to enable it by default there too. (I only noticed this after it was enabled by default).

It should be enabled already for the llvm13 branch.

Oh, I had missed that this was changed right before the branch (I did my last similar test build a couple days before the branch). Yes then it indeed needs to be backported. @tstellar ok to backport?