Skip to content

Commit b2db12a

Browse files
authored
[UR] Fix typo in cfi flags handling. (#17452)
Also remove a cfi exclusive KNOWN_FAILURE as it couldn't be reproduced across a few platforms. closes oneapi-src/unified-runtime#2647
1 parent 6f71198 commit b2db12a

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

unified-runtime/cmake/helpers.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ else()
8080
endif()
8181

8282
set(CFI_FLAGS "")
83-
if (CFI_HAS_CFI_SANITIZE)
83+
if (CXX_HAS_CFI_SANITIZE)
8484
# cfi-icall requires called functions in shared libraries to also be built with cfi-icall, which we can't
8585
# guarantee. -fsanitize=cfi depends on -flto
8686
set(CFI_FLAGS "-flto -fsanitize=cfi -fno-sanitize=cfi-icall -fsanitize-ignorelist=${PROJECT_SOURCE_DIR}/sanitizer-ignorelist.txt")
@@ -103,14 +103,17 @@ function(add_ur_target_compile_options name)
103103
-fstack-protector-strong
104104
-fvisibility=hidden
105105

106-
${CFI_FLAGS}
107106
$<$<BOOL:${CXX_HAS_FCF_PROTECTION_FULL}>:-fcf-protection=full>
108107
$<$<BOOL:${CXX_HAS_FSTACK_CLASH_PROTECTION}>:-fstack-clash-protection>
109108

110109
# Colored output
111110
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
112111
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-fcolor-diagnostics>
113112
)
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})
114117
if (UR_DEVELOPER_MODE)
115118
target_compile_options(${name} PRIVATE -Werror -Wextra)
116119
endif()
@@ -151,8 +154,7 @@ function(add_ur_target_link_options name)
151154
if(NOT MSVC)
152155
if (NOT APPLE)
153156
target_link_options(${name} PRIVATE
154-
${CFI_FLAGS}
155-
"LINKER:-z,relro,-z,now,-z,noexecstack"
157+
"LINKER:-z,relro,-z,now,-z,noexecstack ${CFI_FLAGS}"
156158
)
157159
if (UR_DEVELOPER_MODE)
158160
target_link_options(${name} PRIVATE -Werror -Wextra)

unified-runtime/test/conformance/enqueue/urEnqueueEventsWaitMultiDevice.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,6 @@ TEST_P(urEnqueueEventsWaitMultiDeviceMTTest, EnqueueWaitSingleQueueMultiOps) {
194194
}
195195

196196
TEST_P(urEnqueueEventsWaitMultiDeviceMTTest, EnqueueWaitOnAllQueues) {
197-
// Fails when -fsanitize=cfi
198-
#ifdef UR_USE_CFI
199-
if (getParam().value) {
200-
UUR_KNOWN_FAILURE_ON(uur::OpenCL{});
201-
}
202-
#endif
203-
204197
std::vector<uur::raii::Event> eventsRaii(devices.size());
205198
std::vector<ur_event_handle_t> events(devices.size());
206199
auto work = [this, &events, &eventsRaii](size_t i) {

0 commit comments

Comments
 (0)