[PATCH] D109624: [clang] Make the driver not diagnose errors on nonexistent linker inputs
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 13 15:42:42 PDT 2021
thakis added a comment.
In D109624#2998550 <https://reviews.llvm.org/D109624#2998550>, @saghir wrote:
> Hi, this change also breaks Power PC bots:
>
> 1. https://lab.llvm.org/buildbot/#/builders/19/builds/6451/steps/24/logs/stdio
> 2. https://lab.llvm.org/buildbot/#/builders/18/builds/2443/steps/23/logs/stdio
>
> It fails consistently on our bots. Can you please take a look?
>
> Thanks!
That's a more interesting failure. It fails because:
clang-13: error: /wd4146: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-13: error: /wd4291: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-13: error: /wd4391: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-13: error: /wd4722: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-13: error: /wd4800: 'linker' input unused [-Werror,-Wunused-command-line-argument]
compiler-rt\cmake\config-ix.cmake does `check_cxx_compiler_flag(/wd4800 COMPILER_RT_HAS_WD4800_FLAG)` etc. I suppose this patch does have the effect of making flags only warnings if no linking is happening:
>out\gn\bin\clang-cl --driver-mode=gcc /wd1245 -c main.cc
clang-cl: warning: /wd1245: 'linker' input unused [-Wunused-command-line-argument]
That breaks `check_cxx_compiler_flag()` since it doesn't do its checks with `-Werror`. I guess that's an argument to keeping this an error for the gcc-style driver. On the other hand, it's a bit weird to use `cmake:check_cxx_compiler_flag` to check for MSVC-style flags since MSVC itself only emits a warning on unknown flags. (On the third hand, this behavior between gcc and cl seems to be used to detect cl in practice :) ).
Just using `-wd...` instead of `/wd...` would inside `check_cxx_compiler_flag` would make things go, and we don't use this often currently:
>git grep check_.*compiler_flag(\/
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/MT COMPILER_RT_HAS_MT_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/Oy COMPILER_RT_HAS_Oy_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/Zi COMPILER_RT_HAS_Zi_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/wd4146 COMPILER_RT_HAS_WD4146_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/wd4291 COMPILER_RT_HAS_WD4291_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/wd4221 COMPILER_RT_HAS_WD4221_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/wd4391 COMPILER_RT_HAS_WD4391_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG)
compiler-rt/cmake/config-ix.cmake:check_cxx_compiler_flag(/wd4800 COMPILER_RT_HAS_WD4800_FLAG)
openmp/runtime/cmake/config-ix.cmake: check_cxx_compiler_flag(/EHsc LIBOMP_HAVE_EHSC_FLAG)
openmp/runtime/cmake/config-ix.cmake: check_cxx_compiler_flag(/GS LIBOMP_HAVE_GS_FLAG)
openmp/runtime/cmake/config-ix.cmake: check_cxx_compiler_flag(/Oy- LIBOMP_HAVE_Oy__FLAG)
openmp/runtime/cmake/config-ix.cmake: check_cxx_compiler_flag(/arch:SSE2 LIBOMP_HAVE_ARCH_SSE2_FLAG)
openmp/runtime/cmake/config-ix.cmake: check_cxx_compiler_flag(/Qsafeseh LIBOMP_HAVE_QSAFESEH_FLAG)
openmp/runtime/cmake/config-ix.cmake: check_cxx_compiler_flag(/Qlong_double LIBOMP_HAVE_LONG_DOUBLE_FLAG)
openmp/runtime/cmake/config-ix.cmake: check_cxx_compiler_flag(/Qdiag-disable:177 LIBOMP_HAVE_DIAG_DISABLE_177_FLAG)
openmp/runtime/cmake/config-ix.cmake: check_cxx_compiler_flag(/Qinline-min-size=1 LIBOMP_HAVE_INLINE_MIN_SIZE_FLAG)
But I think it's better to undo this for the gcc-style driver instead. I'll land a change for that.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109624/new/
https://reviews.llvm.org/D109624
More information about the cfe-commits
mailing list