Skip to content

Commit 3045806

Browse files
authored
[SYCL] Add delayloading for ze_loader (#11902)
Currently, on Windows, ze_loader is loaded using load-time linking and since the OS loads it we don't have any control over the search path. To control the search path add /DELAYLOAD link option for ze_loader to load it securely from the Sytem32 folder.
1 parent d53f123 commit 3045806

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sycl/plugins/level_zero/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ add_sycl_plugin(level_zero
9999
Threads::Threads
100100
${XPTI_LIBS}
101101
)
102-
103102
add_dependencies(pi_level_zero ze-api)
104103

104+
if (WIN32)
105+
target_link_libraries(pi_level_zero PRIVATE delayimp)
106+
target_link_options(pi_level_zero PRIVATE /DELAYLOAD:ze_loader.dll)
107+
endif()
108+
105109
if (SYCL_ENABLE_XPTI_TRACING)
106110
target_compile_definitions(pi_level_zero PRIVATE
107111
XPTI_ENABLE_INSTRUMENTATION

0 commit comments

Comments
 (0)