This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Suppress unknown argument warning when linking with lld-link
AbandonedPublic

Authored by russell.gallop on Oct 16 2019, 5:06 AM.

Details

Reviewers
rnk
thakis
ruiu
Summary

Linking with lld-link produced a lot of messages:
lld-link: warning: ignoring unknown argument '-fuse-ld=lld'

For example on the bot: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc

This avoids adding that argument when using lld-link.

Diff Detail

Event Timeline

russell.gallop created this revision.Oct 16 2019, 5:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2019, 5:06 AM
thakis accepted this revision.Oct 16 2019, 11:27 AM

Hm, we don't see these warnings. We use CMAKE_LINKER=C:/b/s/w/ir/cache/builder/src/third_party/llvm-bootstrap-install/bin/lld-link.exe to make cmake use lld-link. It looks like the bot you link to explicitly sets -DLLVM_USE_LINKER=lld which I always figured translates to "pass this -fuse-ld" flag. So I'd say the bot configuration is maybe not quite right? I'd fix that instead.

Maybe we should have a "LLVM_USE_LINKER" and CMAKE_LINKER can't be set at the same time" warning instead?

But if this change helps you somehow, I don't see a problem with landing it either.

(But again, for the bot you link to, I'd argue a better fix is to make it set fewer cmake settings.)

This revision is now accepted and ready to land.Oct 16 2019, 11:27 AM
russell.gallop added a comment.EditedOct 17 2019, 3:56 AM

Hm, we don't see these warnings. We use CMAKE_LINKER=C:/b/s/w/ir/cache/builder/src/third_party/llvm-bootstrap-install/bin/lld-link.exe to make cmake use lld-link. It looks like the bot you link to explicitly sets -DLLVM_USE_LINKER=lld which I always figured translates to "pass this -fuse-ld" flag. So I'd say the bot configuration is maybe not quite right? I'd fix that instead.

Ah, I got the settings from the bot, but that makes sense.

Maybe we should have a "LLVM_USE_LINKER" and CMAKE_LINKER can't be set at the same time" warning instead?

Hmm, I think that makes sense. CMake defaults to using the compiler for linking. Is there a case where you'd want to specify a different compiler with CMAKE_LINKER then add LLVM_USE_LINKER?

But if this change helps you somehow, I don't see a problem with landing it either.

I think that landing this might confuse the usage (even more). I think that warning against this would help clarify the situation.

Scanned through the bot configuration and it is just:
clang-x64-windows-msvc
sanitizer-windows

that use that combination. I'll put up review to change that*, then look at adding a warning.

russell.gallop abandoned this revision.Dec 4 2019, 7:13 AM

Agreed that this usage shouldn't be encouraged so abandoning review.

then look at adding a warning.

Also couldn't obviously see how to add an appropriate warning.