This is an archive of the discontinued LLVM Phabricator instance.

Tweaks for setting CMAKE_LINKER to lld-link
ClosedPublic

Authored by thakis on May 19 2019, 5:55 PM.

Details

Summary
  • Just look for "lld-link", not "lld-link.exe". llvm/cmake/platforms/WinMsvc.cmake for example sets CMAKE_LINKER to lld-link without .exe
  • Stop passing -gwarf to the compiler in sanitizer options when lld is enabled -- there's no reason to use different debug information keyed off the linker. (If this was for MinGW, we should check for that instead.)

Diff Detail

Event Timeline

thakis created this revision.May 19 2019, 5:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2019, 5:55 PM
rnk accepted this revision.May 20 2019, 2:27 PM

lgtm

That's old code... I guess nobody has tried building LLVM with asan on Windows in a while.

This revision is now accepted and ready to land.May 20 2019, 2:27 PM
This revision was automatically updated to reflect the committed changes.
smeenai added inline comments.
llvm/cmake/modules/HandleLLVMOptions.cmake
15

Not your diff, but is this just setting LINKER_IS_LLD_LINK to true when LLVM_ENABLE_LLD is true? That seems wrong?

thakis marked an inline comment as done.May 22 2019, 5:28 AM
thakis added inline comments.
llvm/cmake/modules/HandleLLVMOptions.cmake
15

You're saying that this should be OR (WIN32 AND (LLVM_USE_LINKER STREQUAL "lld" OR LLVM_ENABLE_LLD)), right?

I think this whole conditional is a bit shaky:

  • Since LLVM_ENABLE_LLD causes LLVM_USE_LINKER to be set, we should probably only look at the latter
  • On Windows, as far as I know cmake always calls (lld-)link.exe (it certainly does with the Ninja generator, which is what I use), so I think this should really only check CMAKE_LINKER (…which by default is ignored on non-Windows).

But after this change, LINKER_IS_LLD_LINK is only used in lto-related contexts, and I'm guessing nobody uses lto to build llvm on windows yet, so it probably doesn't matter all that much.

We're planning to look at thinlto for chromium's llvm builds "soon", so we might revisit this then.