Skip to content

Commit bc72823

Browse files
authored
Native DLLs: only load imported DLLs from System32 (#112359)
1 parent 93dd799 commit bc72823

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

eng/native/configurecompiler.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ if (MSVC)
7070
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:CLR_EH_OPTION>>)
7171
add_link_options($<$<BOOL:$<TARGET_PROPERTY:CLR_CONTROL_FLOW_GUARD>>:/guard:cf>)
7272

73+
# Load all imported DLLs from the System32 directory.
74+
add_linker_flag(/DEPENDENTLOADFLAG:0x800)
75+
7376
# Linker flags
7477
#
7578
set (WINDOWS_SUBSYSTEM_VERSION 6.01)

eng/native/ijw/IJW.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ if (CLR_CMAKE_HOST_WIN32)
6464
remove_ijw_incompatible_options("${dirCompileOptions}" dirCompileOptions)
6565
set_directory_properties(PROPERTIES COMPILE_OPTIONS "${dirCompileOptions}")
6666

67+
# IJW tests needs to load DLLs from somewhere other than System32
68+
string(REPLACE "/DEPENDENTLOADFLAG:0x800" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
69+
string(REPLACE "/DEPENDENTLOADFLAG:0x800" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
70+
6771
set(CLR_SDK_REF_PACK_OUTPUT "")
6872
set(CLR_SDK_REF_PACK_DISCOVERY_ERROR "")
6973
set(CLR_SDK_REF_PACK_DISCOVERY_RESULT 0)

0 commit comments

Comments
 (0)