diff options
author | Gaurav Khanna <gkhanna@microsoft.com> | 2017-04-27 10:46:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-27 10:46:47 -0700 |
commit | c983bb86ddf46916206efc7cd5bc942ec8b834cb (patch) | |
tree | 9d3898bc06cabae6fd7207ccf197ce76892b7b38 | |
parent | 368ee30f34fda812d8d936dff4d59b91270453c1 (diff) | |
download | coreclr-c983bb86ddf46916206efc7cd5bc942ec8b834cb.tar.gz coreclr-c983bb86ddf46916206efc7cd5bc942ec8b834cb.tar.bz2 coreclr-c983bb86ddf46916206efc7cd5bc942ec8b834cb.zip |
[WIP] Enable binding to CoreLib as NI image (#11040)
Enable binding to CoreLib as NI image
-rw-r--r-- | build.cmd | 6 | ||||
-rwxr-xr-x | build.sh | 4 | ||||
-rw-r--r-- | src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props | 1 | ||||
-rw-r--r-- | src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props | 1 | ||||
-rw-r--r-- | src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props | 1 | ||||
-rw-r--r-- | src/binder/assemblybinder.cpp | 27 | ||||
-rw-r--r-- | src/build.proj | 8 | ||||
-rw-r--r-- | src/tools/crossgen/crossgen.cpp | 27 |
8 files changed, 28 insertions, 47 deletions
@@ -454,15 +454,15 @@ if %__BuildNativeCoreLib% EQU 1 ( set COMPlus_UseWindowsX86CoreLegacyJit=1 ) - echo "%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll" - "%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll" > "%__CrossGenCoreLibLog%" 2>&1 + echo "%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%"\IL /out "%__BinDir%\System.Private.CoreLib.dll" "%__BinDir%\IL\System.Private.CoreLib.dll" + "%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%"\IL /out "%__BinDir%\System.Private.CoreLib.dll" "%__BinDir%\IL\System.Private.CoreLib.dll" > "%__CrossGenCoreLibLog%" 2>&1 if NOT !errorlevel! == 0 ( echo %__MsgPrefix%Error: CrossGen System.Private.CoreLib build failed. Refer to %__CrossGenCoreLibLog% :: Put it in the same log, helpful for Jenkins type %__CrossGenCoreLibLog% goto CrossgenFailure ) - "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /CreatePdb "%__BinDir%\PDB" "%__BinDir%\System.Private.CoreLib.ni.dll" >> "%__CrossGenCoreLibLog%" 2>&1 + "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /CreatePdb "%__BinDir%\PDB" "%__BinDir%\System.Private.CoreLib.dll" >> "%__CrossGenCoreLibLog%" 2>&1 if NOT !errorlevel! == 0 ( echo %__MsgPrefix%Error: CrossGen /CreatePdb System.Private.CoreLib build failed. Refer to %__CrossGenCoreLibLog% :: Put it in the same log, helpful for Jenkins @@ -379,7 +379,7 @@ build_CoreLib_ni() { if [ $__SkipCoreCLR == 0 -a -e $__BinDir/crossgen ]; then echo "Generating native image for System.Private.CoreLib." - $__BinDir/crossgen $__IbcTuning $__BinDir/System.Private.CoreLib.dll + $__BinDir/crossgen /Platform_Assemblies_Paths $__BinDir/IL $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__BinDir/IL/System.Private.CoreLib.dll if [ $? -ne 0 ]; then echo "Failed to generate native image for System.Private.CoreLib." exit 1 @@ -387,7 +387,7 @@ build_CoreLib_ni() if [ "$__BuildOS" == "Linux" ]; then echo "Generating symbol file for System.Private.CoreLib." - $__BinDir/crossgen /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.ni.dll + $__BinDir/crossgen /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll if [ $? -ne 0 ]; then echo "Failed to generate symbol file for System.Private.CoreLib." exit 1 diff --git a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props index 4ad2538826..5c55497af9 100644 --- a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props +++ b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props @@ -17,7 +17,6 @@ <NativeBinary Include="$(BinDir)libsosplugin.so" /> <NativeBinary Include="$(BinDir)System.Globalization.Native.so" /> <NativeBinary Include="$(BinDir)sosdocsunix.txt" /> - <NativeBinary Condition="'$(_PlatformDoesNotSupportNiFiles)' != 'true'" Include="$(BinDir)System.Private.CoreLib.ni.dll" /> <ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" /> <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" /> <ArchitectureSpecificToolFile Include="$(BinDir)crossgen" /> diff --git a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props index b988a40745..1d16788c06 100644 --- a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props +++ b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props @@ -8,7 +8,6 @@ <NativeBinary Include="$(BinDir)libsos.dylib" /> <NativeBinary Include="$(BinDir)System.Globalization.Native.dylib" /> <NativeBinary Include="$(BinDir)sosdocsunix.txt" /> - <NativeBinary Include="$(BinDir)System.Private.CoreLib.ni.dll" /> <ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" /> <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" /> <ArchitectureSpecificToolFile Include="$(BinDir)crossgen" /> diff --git a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props index 436901ebd2..a7d855511f 100644 --- a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props +++ b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props @@ -19,7 +19,6 @@ <NativeBinary Include="$(BinDir)mscorrc.debug.dll" /> <NativeBinary Include="$(BinDir)mscorrc.dll" /> <NativeBinary Include="$(BinDir)sos.dll" /> - <NativeBinary Include="$(BinDir)System.Private.CoreLib.ni.dll" /> <NativeBinary Include="$(UniversalCRTSDKDir)Redist\ucrt\DLLs\$(BuildArch)\*.dll" Condition="'$(BuildType)'=='Release' AND '$(BuildArch)' != 'arm64'" /> <ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" /> <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" /> diff --git a/src/binder/assemblybinder.cpp b/src/binder/assemblybinder.cpp index a73f79fb65..bd5dd18cc9 100644 --- a/src/binder/assemblybinder.cpp +++ b/src/binder/assemblybinder.cpp @@ -685,26 +685,21 @@ namespace BINDER_SPACE StackSString sCoreLib; - // At run-time, System.Private.CoreLib.ni.dll is typically always available, and - // System.Private.CoreLib.dll is typically not. So check for the NI first. + // At run-time, System.Private.CoreLib.dll is expected to be the NI image. sCoreLib = sCoreLibDir; - sCoreLib.Append(CoreLibName_NI_W); - if (!fBindToNativeImage || FAILED(AssemblyBinder::GetAssembly(sCoreLib, - FALSE /* fInspectionOnly */, - TRUE /* fIsInGAC */, - TRUE /* fExplicitBindToNativeImage */, - &pSystemAssembly))) - { - // If System.Private.CoreLib.ni.dll is unavailable, look for System.Private.CoreLib.dll instead - sCoreLib = sCoreLibDir; - sCoreLib.Append(CoreLibName_IL_W); - IF_FAIL_GO(AssemblyBinder::GetAssembly(sCoreLib, + sCoreLib.Append(CoreLibName_IL_W); + BOOL fExplicitBindToNativeImage = (fBindToNativeImage == true)? TRUE:FALSE; +#if defined(FEATURE_PAL) && !defined(_TARGET_AMD64_) + // Non-Amd64 platforms on non-Windows do not support generating the NI image + // as CoreLib.dll. For those, we will bind as IL. + fExplicitBindToNativeImage = FALSE; +#endif // defined(FEATURE_PAL) && !defined(_TARGET_AMD64_) + IF_FAIL_GO(AssemblyBinder::GetAssembly(sCoreLib, FALSE /* fInspectionOnly */, TRUE /* fIsInGAC */, - FALSE /* fExplicitBindToNativeImage */, + fExplicitBindToNativeImage, &pSystemAssembly)); - } - + *ppSystemAssembly = pSystemAssembly.Extract(); Exit: diff --git a/src/build.proj b/src/build.proj index 5da94e44c1..7962d27e99 100644 --- a/src/build.proj +++ b/src/build.proj @@ -17,13 +17,21 @@ </Target> <ItemGroup> + <ILToCopy Include="$(BinDir)System.Private.CoreLib.dll"/> <PDBSToMove Include="$(BinDir)System.Private.CoreLib.pdb"/> </ItemGroup> <PropertyGroup> + <CoreLibPath>$(BinDir)System.Private.CoreLib.dll</CoreLibPath> <CoreLibPDBPath>$(BinDir)System.Private.CoreLib.pdb</CoreLibPDBPath> </PropertyGroup> + <Target Name="CopyCoreLib" AfterTargets="Build"> + <Copy Condition="Exists($(CoreLibPath))" + SourceFiles="@(ILToCopy)" + DestinationFolder="$(BinDir)IL" /> + </Target> + <Target Name="MovePDB" AfterTargets="Build"> <Move Condition="Exists($(CoreLibPDBPath))" SourceFiles="@(PDBSToMove)" diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp index 43e667bd25..954f4a46a8 100644 --- a/src/tools/crossgen/crossgen.cpp +++ b/src/tools/crossgen/crossgen.cpp @@ -311,35 +311,16 @@ void PopulateTPAList(SString path, LPCWSTR pwszMask, SString &refTPAList, bool f bool fAddDelimiter = (refTPAList.GetCount() > 0)?true:false; bool fAddFileToTPAList = true; LPCWSTR pwszFilename = folderEnumerator.GetFileName(); - if (fCompilingMscorlib) + + // No NIs are supported when creating NI images (other than NI of System.Private.CoreLib.dll). + if (!fCreatePDB) { - // When compiling CoreLib, no ".ni.dll" should be on the TPAList. + // Only CoreLib's ni.dll should be in the TPAList for the compilation of non-mscorlib assemblies. if (StringEndsWith((LPWSTR)pwszFilename, W(".ni.dll"))) { fAddFileToTPAList = false; } } - else - { - // When creating PDBs, we must ensure that .ni.dlls are in the TPAList - if (!fCreatePDB) - { - // Only CoreLib's ni.dll should be in the TPAList for the compilation of non-mscorlib assemblies. - if (StringEndsWith((LPWSTR)pwszFilename, W(".ni.dll"))) - { - if (!StringEndsWith((LPWSTR)pwszFilename, CoreLibName_NI_W)) - { - fAddFileToTPAList = false; - } - } - } - - // Ensure that CoreLib's IL version is also not on the TPAlist for this case. - if (StringEndsWith((LPWSTR)pwszFilename, CoreLibName_IL_W)) - { - fAddFileToTPAList = false; - } - } if (fAddFileToTPAList) { |