Skip to content

Commit 1746828

Browse files
parjonggkhanna79
authored andcommitted
Allow users to enable automatic NI bind fallback via command-line (dotnet#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
1 parent aa82eb3 commit 1746828

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

clrdefinitions.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ if(FEATURE_MERGE_JIT_AND_ENGINE)
144144
add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
145145
endif(FEATURE_MERGE_JIT_AND_ENGINE)
146146
add_definitions(-DFEATURE_MULTICOREJIT)
147+
if (FEATURE_NI_BIND_FALLBACK)
148+
add_definitions(-DFEATURE_NI_BIND_FALLBACK)
149+
endif(FEATURE_NI_BIND_FALLBACK)
147150
if(CLR_CMAKE_PLATFORM_UNIX)
148151
add_definitions(-DFEATURE_PAL)
149152
add_definitions(-DFEATURE_PAL_SXS)

clrfeatures.cmake

+8
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,11 @@ endif(NOT DEFINED FEATURE_DBGIPC)
2525
if(NOT DEFINED FEATURE_INTERPRETER)
2626
set(FEATURE_INTERPRETER 0)
2727
endif(NOT DEFINED FEATURE_INTERPRETER)
28+
29+
if(NOT WIN32)
30+
if(NOT DEFINED FEATURE_NI_BIND_FALLBACK)
31+
if(NOT CLR_CMAKE_TARGET_ARCH_AMD64 AND NOT CLR_CMAKE_TARGET_ARCH_ARM64)
32+
set(FEATURE_NI_BIND_FALLBACK 1)
33+
endif()
34+
endif(NOT DEFINED FEATURE_NI_BIND_FALLBACK)
35+
endif(NOT WIN32)

src/binder/assemblybinder.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,11 @@ namespace BINDER_SPACE
689689
sCoreLib = sCoreLibDir;
690690
sCoreLib.Append(CoreLibName_IL_W);
691691
BOOL fExplicitBindToNativeImage = (fBindToNativeImage == true)? TRUE:FALSE;
692-
#if defined(FEATURE_PAL) && !defined(_TARGET_AMD64_) && !defined(_TARGET_ARM64_)
692+
#ifdef FEATURE_NI_BIND_FALLBACK
693693
// Some non-Windows platforms do not automatically generate the NI image as CoreLib.dll.
694694
// If those platforms also do not support automatic fallback from NI to IL, bind as IL.
695695
fExplicitBindToNativeImage = FALSE;
696-
#endif // defined(FEATURE_PAL) && !defined(_TARGET_AMD64_) && !defined(_TARGET_ARM64_)
696+
#endif // FEATURE_NI_BIND_FALLBACK
697697
IF_FAIL_GO(AssemblyBinder::GetAssembly(sCoreLib,
698698
FALSE /* fInspectionOnly */,
699699
TRUE /* fIsInGAC */,

0 commit comments

Comments
 (0)