This is an archive of the discontinued LLVM Phabricator instance.

clang-cl: Postpone Wmsvc-not-found emission until link.exe gets used.
ClosedPublic

Authored by thakis on Jul 16 2018, 1:02 PM.

Details

Reviewers
zturner
thakis
Summary

Wmsvc-not-found was added in r297851 to help diagnose why link.exe can't be executed. However, it's emitted even when using -fuse-ld=lld, and in cross builds there's no way to get rid of the warning other than disabling it.

Instead, emit it when we look up link.exe. That way, when passing -fuse-ld=lld it will never be printed.

(We might want to eventually default to lld one day, at least when running on a non-Win host, but that's for another day.)

Fixes PR38016.

Diff Detail

Event Timeline

thakis created this revision.Jul 16 2018, 1:02 PM
zturner added inline comments.Jul 16 2018, 1:10 PM
lib/Driver/ToolChains/MSVC.cpp
467–468

It looks like it's possible for this warning to be emitted even when FindVisualStudioExecutable succeeds (after looking in the install location it checks PATH). Would it make more sense to put this check after the call to FindVisualStudioExecutable, but only if it fails?

thakis added inline comments.Jul 17 2018, 7:20 AM
lib/Driver/ToolChains/MSVC.cpp
467–468

If we find link.exe on PATH but LIB isn't set, will link.exe do the right thing? Or is the warning still useful for that case?

I'll upload a patch that does what you suggest, but since I'm not sure what exactly the warning is supposed to catch, I find it difficult to say which version is better.

thakis updated this revision to Diff 155885.Jul 17 2018, 7:26 AM

address comment

Lgtm. I also have a hard time saying which is best, we’re basically trying
to help people who have already strayed from the path, so there’s probably
no objectively correct answer

thakis accepted this revision.Jul 17 2018, 8:12 AM

r337290, thanks!

This revision is now accepted and ready to land.Jul 17 2018, 8:12 AM
thakis closed this revision.Jul 17 2018, 8:12 AM