Skip to content

Commit eb9af19

Browse files
authoredOct 23, 2024··
[clang-repl][CMake][MSVC] Wrap /EXPORT linker option for ICX (#112867)
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 the `LINKER:` prefix for the `/EXPORT:` options in clang-repl, this expands to the correct flag for ICX and nothing for MSVC / clang-cl. RFC: https://discourse.llvm.org/t/rfc-cmake-linker-flags-need-wl-equivalent-for-intel-c-icx-on-windows/82446
1 parent ba19e98 commit eb9af19

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed
 

‎clang/tools/clang-repl/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ if(MSVC)
4848
endif()
4949

5050
# List to '/EXPORT:sym0 /EXPORT:sym1 /EXPORT:sym2 ...'
51-
foreach(sym ${clang_repl_exports})
52-
set(clang_repl_link_str "${clang_repl_link_str} /EXPORT:${sym}")
53-
endforeach(sym ${clang_repl_exports})
51+
list(TRANSFORM clang_repl_exports PREPEND "LINKER:/EXPORT:")
5452

55-
set_property(TARGET clang-repl APPEND_STRING PROPERTY LINK_FLAGS ${clang_repl_link_str})
53+
set_property(TARGET clang-repl APPEND PROPERTY LINK_OPTIONS ${clang_repl_exports})
5654

5755
endif(MSVC)
5856

‎clang/unittests/Interpreter/CMakeLists.txt

+2-5
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ if(MSVC)
6767
endif()
6868

6969
# List to '/EXPORT:sym0 /EXPORT:sym1 /EXPORT:sym2 ...'
70-
foreach(sym ${ClangReplInterpreterTests_exports})
71-
set(ClangReplInterpreterTests_link_str "${ClangReplInterpreterTests_link_str} /EXPORT:${sym}")
72-
endforeach(sym ${ClangReplInterpreterTests_exports})
73-
74-
set_property(TARGET ClangReplInterpreterTests APPEND_STRING PROPERTY LINK_FLAGS ${ClangReplInterpreterTests_link_str})
70+
list(TRANSFORM ClangReplInterpreterTests_exports PREPEND "LINKER:/EXPORT:")
71+
set_property(TARGET ClangReplInterpreterTests APPEND PROPERTY LINK_OPTIONS ${ClangReplInterpreterTests_exports})
7572

7673
endif(MSVC)

0 commit comments

Comments
 (0)
Please sign in to comment.