[all-commits] [llvm/llvm-project] 7ab6d3: [LLVM][CMake][MSVC] Wrap linker flags for ICX on W...

Mészáros Gergely via All-commits all-commits at lists.llvm.org
Wed Oct 23 04:03:47 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7ab6d39a4d58416c960847458df8d0babea07615
      https://github.com/llvm/llvm-project/commit/7ab6d39a4d58416c960847458df8d0babea07615
  Author: Mészáros Gergely <gergely.meszaros at intel.com>
  Date:   2024-10-23 (Wed, 23 Oct 2024)

  Changed paths:
    M llvm/cmake/modules/AddLLVM.cmake
    M llvm/cmake/modules/HandleLLVMOptions.cmake
    M llvm/cmake/platforms/WinMsvc.cmake
    M llvm/lib/Support/CMakeLists.txt
    M llvm/tools/llvm-shlib/CMakeLists.txt

  Log Message:
  -----------
  [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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list