From 70b1b66e92b0d722a55798da3af6c4f06701df9b Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Wed, 10 May 2017 08:10:22 -0700 Subject: [PATCH] Allow users to enable automatic NI bind fallback via command-line (dotnet/coreclr#11485) * Add FEATURE_NI_BIND_FALLBACK support * Fix incorrect variable setup * Negate the check condition * Use WIN32 instead of FEATURE_PAL * Check WIN32 first, and FEATURE_NI_BIND_FALLBACK later Commit migrated from https://github.com/dotnet/coreclr/commit/17468288b4093efc8fea4748ee3c890bf82535bb --- src/coreclr/clrdefinitions.cmake | 3 +++ src/coreclr/clrfeatures.cmake | 8 ++++++++ src/coreclr/src/binder/assemblybinder.cpp | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake index 4dacae9..92b63a3 100644 --- a/src/coreclr/clrdefinitions.cmake +++ b/src/coreclr/clrdefinitions.cmake @@ -144,6 +144,9 @@ if(FEATURE_MERGE_JIT_AND_ENGINE) add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) endif(FEATURE_MERGE_JIT_AND_ENGINE) add_definitions(-DFEATURE_MULTICOREJIT) +if (FEATURE_NI_BIND_FALLBACK) + add_definitions(-DFEATURE_NI_BIND_FALLBACK) +endif(FEATURE_NI_BIND_FALLBACK) if(CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DFEATURE_PAL) add_definitions(-DFEATURE_PAL_SXS) diff --git a/src/coreclr/clrfeatures.cmake b/src/coreclr/clrfeatures.cmake index 9991b60..f047c91 100644 --- a/src/coreclr/clrfeatures.cmake +++ b/src/coreclr/clrfeatures.cmake @@ -25,3 +25,11 @@ endif(NOT DEFINED FEATURE_DBGIPC) if(NOT DEFINED FEATURE_INTERPRETER) set(FEATURE_INTERPRETER 0) endif(NOT DEFINED FEATURE_INTERPRETER) + +if(NOT WIN32) + if(NOT DEFINED FEATURE_NI_BIND_FALLBACK) + if(NOT CLR_CMAKE_TARGET_ARCH_AMD64 AND NOT CLR_CMAKE_TARGET_ARCH_ARM64) + set(FEATURE_NI_BIND_FALLBACK 1) + endif() + endif(NOT DEFINED FEATURE_NI_BIND_FALLBACK) +endif(NOT WIN32) diff --git a/src/coreclr/src/binder/assemblybinder.cpp b/src/coreclr/src/binder/assemblybinder.cpp index 1015b43..73ea025 100644 --- a/src/coreclr/src/binder/assemblybinder.cpp +++ b/src/coreclr/src/binder/assemblybinder.cpp @@ -689,11 +689,11 @@ namespace BINDER_SPACE sCoreLib = sCoreLibDir; sCoreLib.Append(CoreLibName_IL_W); BOOL fExplicitBindToNativeImage = (fBindToNativeImage == true)? TRUE:FALSE; -#if defined(FEATURE_PAL) && !defined(_TARGET_AMD64_) && !defined(_TARGET_ARM64_) +#ifdef FEATURE_NI_BIND_FALLBACK // Some non-Windows platforms do not automatically generate the NI image as CoreLib.dll. // If those platforms also do not support automatic fallback from NI to IL, bind as IL. fExplicitBindToNativeImage = FALSE; -#endif // defined(FEATURE_PAL) && !defined(_TARGET_AMD64_) && !defined(_TARGET_ARM64_) +#endif // FEATURE_NI_BIND_FALLBACK IF_FAIL_GO(AssemblyBinder::GetAssembly(sCoreLib, FALSE /* fInspectionOnly */, TRUE /* fIsInGAC */, -- 2.7.4