Skip to content

Commit bba2507

Browse files
authored
[compiler-rt][MSVC][CMake] Wrap Linker flags for ICX (#118496)
RFC: https://discourse.llvm.org/t/rfc-cmake-linker-flags-need-wl-equivalent-for-intel-c-icx-on-windows/82446 My previous pass missed some flags because I used `-Werror=unknown-argument`, but `/D`, `/I` and `/O` are accepted by clang (even when only linking), but mean different things than intended for `link.exe`.
1 parent 2137ded commit bba2507

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler-rt/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ if (CMAKE_LINKER MATCHES "link.exe$")
768768
# it, but CMake doesn't seem to have a way to set linker flags for
769769
# individual static libraries, so we enable the suppression flag for
770770
# the whole compiler-rt project.
771-
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221")
771+
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${CMAKE_CXX_LINKER_WRAPPER_FLAG}/IGNORE:4221")
772772
endif()
773773

774774
add_subdirectory(include)

compiler-rt/lib/asan/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
141141
# LLVM turns /OPT:ICF back on when LLVM_ENABLE_PDBs is set
142142
# we _REALLY_ need to turn it back off for ASAN, because the way
143143
# asan emulates weak functions from DLLs requires NOICF
144-
append_list_if(MSVC "/DEBUG;/OPT:NOICF" ASAN_DYNAMIC_LINK_FLAGS)
144+
append_list_if(MSVC "LINKER:/DEBUG;LINKER:/OPT:NOICF" ASAN_DYNAMIC_LINK_FLAGS)
145145

146146
set(ASAN_DYNAMIC_LIBS
147147
${COMPILER_RT_UNWINDER_LINK_LIBS}

0 commit comments

Comments
 (0)