@@ -83,7 +83,7 @@ set(CFI_FLAGS "")
83
83
if (CXX_HAS_CFI_SANITIZE )
84
84
# cfi-icall requires called functions in shared libraries to also be built with cfi-icall, which we can't
85
85
# guarantee. -fsanitize=cfi depends on -flto
86
- set (CFI_FLAGS "-flto -fsanitize=cfi -fno-sanitize=cfi-icall -fsanitize-ignorelist=${PROJECT_SOURCE_DIR} /sanitizer-ignorelist.txt" )
86
+ set (CFI_FLAGS "-flto; -fsanitize=cfi; -fno-sanitize=cfi-icall; -fsanitize-ignorelist=${PROJECT_SOURCE_DIR} /sanitizer-ignorelist.txt" )
87
87
endif ()
88
88
89
89
function (add_ur_target_compile_options name )
@@ -103,17 +103,15 @@ function(add_ur_target_compile_options name)
103
103
-fstack-protector-strong
104
104
-fvisibility=hidden
105
105
106
+ ${CFI_FLAGS}
107
+
106
108
$< $< BOOL:${CXX_HAS_FCF_PROTECTION_FULL} > :-fcf-protection=full>
107
109
$< $< BOOL:${CXX_HAS_FSTACK_CLASH_PROTECTION} > :-fstack-clash-protection>
108
110
109
111
# Colored output
110
112
$< $< CXX_COMPILER_ID:GNU> :-fdiagnostics-color=always>
111
113
$< $< CXX_COMPILER_ID:Clang,AppleClang> :-fcolor-diagnostics>
112
114
)
113
- # Cmake can't handle mixing strings without quotes as the options above
114
- # are and strings with quotes like ${CFI_FLAGS} is, so this needs a
115
- # separate call.
116
- target_compile_options (${name} PRIVATE ${CFI_FLAGS} )
117
115
if (UR_DEVELOPER_MODE )
118
116
target_compile_options (${name} PRIVATE -Werror -Wextra )
119
117
endif ()
@@ -154,7 +152,8 @@ function(add_ur_target_link_options name)
154
152
if (NOT MSVC )
155
153
if (NOT APPLE )
156
154
target_link_options (${name} PRIVATE
157
- "LINKER:-z,relro,-z,now,-z,noexecstack ${CFI_FLAGS} "
155
+ ${CFI_FLAGS}
156
+ "LINKER:-z,relro,-z,now,-z,noexecstack"
158
157
)
159
158
if (UR_DEVELOPER_MODE )
160
159
target_link_options (${name} PRIVATE -Werror -Wextra )
0 commit comments