Skip to content

Commit e1b5826

Browse files
authored
[LLVM][CMake][MSVC] Wrap linker options for ICX with LLVM_BUILD_INSTUMENTED (#124573)
RFC: https://discourse.llvm.org/t/rfc-cmake-linker-flags-need-wl-equivalent-for-intel-c-icx-on-windows/82446 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). Previous PRs did not catch this because I did not try building with `LLVM_BUILD_INSTRUMENTED=ON`. `CMAKE_CXX_LINKER_WRAPPER_FLAG` is empty for plain clang-cl (icx on windows behaves as clang-cl), so this is NFC for clang-cl.
1 parent c0861e9 commit e1b5826

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ if (CLANG_CL AND (LLVM_BUILD_INSTRUMENTED OR LLVM_USE_SANITIZER))
12121212
endif()
12131213
file(TO_CMAKE_PATH "${clang_compiler_rt_file}" clang_compiler_rt_file)
12141214
get_filename_component(clang_runtime_dir "${clang_compiler_rt_file}" DIRECTORY)
1215-
prepend("/libpath:\"${clang_runtime_dir}\""
1215+
prepend("${CMAKE_CXX_LINKER_WRAPPER_FLAG}/libpath:\"${clang_runtime_dir}\""
12161216
CMAKE_EXE_LINKER_FLAGS
12171217
CMAKE_MODULE_LINKER_FLAGS
12181218
CMAKE_SHARED_LINKER_FLAGS)

0 commit comments

Comments
 (0)