diff options
author | Mészáros Gergely <gergely.meszaros@intel.com> | 2024-10-23 13:03:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-23 13:03:25 +0200 |
commit | 7ab6d39a4d58416c960847458df8d0babea07615 (patch) | |
tree | 2e031a7ecdb6f367edd30367466e78b53fdb08a4 /llvm/lib/CodeGen/CodeGen.cpp | |
parent | 9b88792291c6441aae7c66c046a9460984ddc7d2 (diff) | |
download | llvm-7ab6d39a4d58416c960847458df8d0babea07615.zip llvm-7ab6d39a4d58416c960847458df8d0babea07615.tar.gz llvm-7ab6d39a4d58416c960847458df8d0babea07615.tar.bz2 |
[LLVM][CMake][MSVC] Wrap linker flags for ICX on Windows (#112680)
The Intel C++ Compiler (ICX) passes linker flags through the driver
unlike MSVC and clang-cl, and therefore needs them to be prefixed with
`/Qoption,link` (the equivalent of `-Wl,` for gcc on *nix).
Use `LINKER:` prefix wherever supported by cmake, when that's not
possible fall-back to `${CMAKE_CXX_LINKER_WRAPPER_FLAG}`. CMake replaces
these with `/Qoption,link` for ICX and with the empty string for MSVC
and clang-cl.
For `target_link_libraries` neither `LINKER:` (not supported prior to
CMake 3.32) nor `${CMAKE_CXX_LINKER_WRAPPER_FLAG}` (does not begin with
`-` would be taken as a library name) works, use `-Qoption,link`
directly within a conditional generator expression that we're linking
with ICX.
For MSVC and clang-cl no functional change is intended.
Tested by compiling with ICX and setting
`CMAKE_(EXE|SHARED|STATIC|MODULE)_LINKER_FLAGS_INIT` to
`-Werror=unknown-argument`.
RFC:
https://discourse.llvm.org/t/rfc-cmake-linker-flags-need-wl-equivalent-for-intel-c-icx-on-windows/82446
Diffstat (limited to 'llvm/lib/CodeGen/CodeGen.cpp')
0 files changed, 0 insertions, 0 deletions