[all-commits] [llvm/llvm-project] 412ac0: clang-cl: Prefer /vctoolsdir, /winsdkdir over LIB ...

Nico Weber via All-commits all-commits at lists.llvm.org
Wed Jan 27 05:58:23 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 412ac0e53688364fe1295e864abd53e104eeb554
      https://github.com/llvm/llvm-project/commit/412ac0e53688364fe1295e864abd53e104eeb554
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M clang/lib/Driver/ToolChains/MSVC.cpp

  Log Message:
  -----------
  clang-cl: Prefer /vctoolsdir, /winsdkdir over LIB for link invocations

/vctoolsdir and /winsdkdir take precedence over the INCLUDE env var,
so they should also take precedence over LIB. It's not quite as neat
since LIB is still read by the linker and the linker just prefers
the -libpath: paths the driver now passes, but as long as all libraries
are present at /vctoolsdir and /winsdkdir, there's no harm in the linker
also looking at LIB later.

This fixes cl-options.c after a5d85cbe on Windows when LIB is set.
Another way to fix the test would be to prefix the clang-cl
line with `env --unset=LIB`, but I think it's better to fix the
flag to work as expected instead of making the test work around
the surprising behavior that LIB being set causes clang-cl to
not pass -libpath: flags to the linker when /vctoolsdir and
/winsdkdir are used.




More information about the All-commits mailing list