diff options
author | SaeHie Park <saehie.park@gmail.com> | 2017-04-21 10:46:30 +0900 |
---|---|---|
committer | Dan Moseley <danmose@microsoft.com> | 2017-04-20 18:46:30 -0700 |
commit | d40200d77e47294b4228545d85b89d2558cfe5f7 (patch) | |
tree | 11765021d13367a5c0990f2c710ce2c5fcbce6ab /src/coreclr | |
parent | ec9976a46c9d8683a75e7f4ce6664426ecb043d7 (diff) | |
download | coreclr-d40200d77e47294b4228545d85b89d2558cfe5f7.tar.gz coreclr-d40200d77e47294b4228545d85b89d2558cfe5f7.tar.bz2 coreclr-d40200d77e47294b4228545d85b89d2558cfe5f7.zip |
Enable corerun to select Globalization Invariant mode (#11097)
* Enable corerun to select Globalization Invariant mode
* Support 'true' also
Diffstat (limited to 'src/coreclr')
-rw-r--r-- | src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp b/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp index 52ffda8bb5..df4c93f427 100644 --- a/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp +++ b/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp @@ -35,6 +35,10 @@ // disabled. Server GC is off by default. static const char* serverGcVar = "CORECLR_SERVER_GC"; +// Name of environment variable to control "System.Globalization.Invariant" +// Set to 1 for Globalization Invariant mode to be true. Default is false. +static const char* globalizationInvariantVar = "CORECLR_GLOBAL_INVARIANT"; + #if defined(__linux__) #define symlinkEntrypointExecutable "/proc/self/exe" #elif !defined(__APPLE__) @@ -260,6 +264,17 @@ void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList) closedir(dir); } +const char* GetEnvValueBoolean(const char* envVariable) +{ + const char* envValue = std::getenv(envVariable); + if (envValue == nullptr) + { + envValue = "0"; + } + // CoreCLR expects strings "true" and "false" instead of "1" and "0". + return (std::strcmp(envValue, "1") == 0 || strcasecmp(envValue, "true") == 0) ? "true" : "false"; +} + int ExecuteManagedAssembly( const char* currentExeAbsolutePath, const char* clrFilesAbsolutePath, @@ -338,14 +353,10 @@ int ExecuteManagedAssembly( else { // Check whether we are enabling server GC (off by default) - const char* useServerGc = std::getenv(serverGcVar); - if (useServerGc == nullptr) - { - useServerGc = "0"; - } + const char* useServerGc = GetEnvValueBoolean(serverGcVar); - // CoreCLR expects strings "true" and "false" instead of "1" and "0". - useServerGc = std::strcmp(useServerGc, "1") == 0 ? "true" : "false"; + // Check Globalization Invariant mode (false by default) + const char* globalizationInvariant = GetEnvValueBoolean(globalizationInvariantVar); // Allowed property names: // APPBASE @@ -369,6 +380,7 @@ int ExecuteManagedAssembly( "APP_NI_PATHS", "NATIVE_DLL_SEARCH_DIRECTORIES", "System.GC.Server", + "System.Globalization.Invariant", }; const char *propertyValues[] = { // TRUSTED_PLATFORM_ASSEMBLIES @@ -381,6 +393,8 @@ int ExecuteManagedAssembly( nativeDllSearchDirs.c_str(), // System.GC.Server useServerGc, + // System.Globalization.Invariant + globalizationInvariant, }; void* hostHandle; |