From 5ea1f675d87f1ec9bc65611fee0e7eba8c3cdb0f Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 26 Feb 2025 21:39:17 -0800 Subject: [PATCH] Allow loading side-by-side dependent DLLs in the PGO-instrumented build This is needed to enable loading pgort140.dll from coreclr.dll in our PGO-instrumented runtime build. --- eng/native/configurecompiler.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 787eea52392c14..e8ad8615f6d4bd 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -70,8 +70,11 @@ if (MSVC) add_compile_options($<$:$>) add_link_options($<$>:/guard:cf>) - # Load all imported DLLs from the System32 directory. - add_linker_flag(/DEPENDENTLOADFLAG:0x800) + if (NOT CLR_CMAKE_PGO_INSTRUMENT) + # Load all imported DLLs from the System32 directory. + # Don't do this when instrumenting for PGO as a local DLL dependency is introduced by the instrumentation + add_linker_flag(/DEPENDENTLOADFLAG:0x800) + endif() # Linker flags #