Skip to content

Commit

Permalink
[OpenCL] Config dependent-load flag to exclude CWD from DLL search pa…
Browse files Browse the repository at this point in the history
…th (intel#13327)

This change is to avoid DLL hijacking security issue.
  • Loading branch information
cdai2 authored Apr 11, 2024
1 parent 00b210e commit 05644a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions opencl/opencl-aot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ set(OPENCL_AOT_PROJECT_NAME opencl-aot)

add_llvm_tool(${OPENCL_AOT_PROJECT_NAME} ${TARGET_SOURCES})

if (WIN32)
# 0x2000: exclude CWD from DLL loading path
target_link_options(${OPENCL_AOT_PROJECT_NAME} PRIVATE "/DEPENDENTLOADFLAG:0x2000")
endif()

if(NOT MSVC)
# FIXME: when built with clang it produces a warning.
target_compile_options(${OPENCL_AOT_PROJECT_NAME} PRIVATE "-Wno-unused-parameter")
Expand Down

0 comments on commit 05644a4

Please sign in to comment.