Skip to content

Commit

Permalink
[CMake][MSVC] Wrap more linker flags for IntelLLVM (#557)
Browse files Browse the repository at this point in the history
My previous pass missed some flags because I used
`-Werror=unknown-argument`, but `/D` and `/G` are accepted by clang
(even when only linking), but mean different things than intended for
`link.exe`.
Wrapping the linker with a script revealed these flags.

The approach I used to find these is documented as github gist here:
https://gist.github.com/Maetveis/00567488f0d6ff74095d91ed306fafc5
  • Loading branch information
Maetveis authored Dec 4, 2024
1 parent fccf468 commit 53d58dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ add_llvm_library(${TARGET_NAME} SHARED
if (WIN32)
# Enable compiler generation of Control Flow Guard security checks.
target_compile_options(${TARGET_NAME} PUBLIC "/guard:cf")
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY
LINK_FLAGS "/DYNAMICBASE /GUARD:CF")
set_property(TARGET ${TARGET_NAME} APPEND PROPERTY
LINK_OPTIONS "LINKER:/DYNAMICBASE" "LINKER:/GUARD:CF")

elseif(UNIX)
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY
Expand Down

0 comments on commit 53d58dd

Please sign in to comment.