You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.69
Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
parent
d8f8abd549
commit
e2950ec768
@@ -1,25 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<!--
|
||||
This project is servicing the purpose of restoring some nuget packages which has the implementation assemblies
|
||||
like System.Collections, System.Resources.ResourceManager…etc.
|
||||
like System.Collections, System.Runtime.Extensions, etc.
|
||||
The restored implementation assemblies will be used as references for compiling some of the System.Private.*
|
||||
projects like System.Private.Threading.
|
||||
projects like System.Private.Interop.
|
||||
-->
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.0.0.0</AssemblyVersion>
|
||||
<OutputType>Library</OutputType>
|
||||
<OutputPath>$(AotPackageReferencePath)</OutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<NuGetTargetMoniker>UAP,Version=v10.1</NuGetTargetMoniker>
|
||||
<NuGetRuntimeIdentifier>win8-aot</NuGetRuntimeIdentifier>
|
||||
<TargetFramework>uap10.1</TargetFramework>
|
||||
<RuntimeIdentifiers>win10-x64-aot</RuntimeIdentifiers>
|
||||
<RidSpecificAssets>true</RidSpecificAssets>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Private.CoreFx.UAP">
|
||||
<Version>$(CoreFxUapVersion)</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FileToInclude Include="System.Runtime" />
|
||||
<FileToInclude Include="System.Runtime.Extensions" />
|
||||
<FileToInclude Include="System.Collections" />
|
||||
<FileToInclude Include="System.Console" />
|
||||
<FileToInclude Include="System.IO" />
|
||||
<FileToInclude Include="System.Private.Reflection.Metadata.Ecma335" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.2.0-beta-24906-01",
|
||||
"System.Runtime": "4.4.0-beta-24906-01",
|
||||
"System.Reflection.Primitives":"4.4.0-beta-24906-01",
|
||||
"System.Runtime.Extensions": "4.4.0-beta-24906-01",
|
||||
"System.Collections": "4.4.0-beta-24906-01",
|
||||
"System.Resources.ResourceManager": "4.4.0-beta-24906-01",
|
||||
"System.Console": "4.4.0-beta-24906-01",
|
||||
|
||||
"System.Threading.Tasks": "4.4.0-beta-24906-01",
|
||||
"System.Text.Encoding.Extensions": "4.4.0-beta-24906-01",
|
||||
"System.Reflection.TypeExtensions": "4.4.0-beta-24906-01",
|
||||
"System.Runtime.InteropServices": "4.4.0-beta-24906-01",
|
||||
"System.Private.Uri": "4.4.0-beta-24906-01",
|
||||
"System.IO": "4.4.0-beta-24906-01",
|
||||
"System.Globalization": "4.4.0-beta-24906-01",
|
||||
"System.ObjectModel": "4.4.0-beta-24906-01",
|
||||
"System.Collections.Concurrent": "4.4.0-beta-24906-01",
|
||||
"System.Reflection.Metadata": "1.4.2",
|
||||
"System.Collections.Immutable": "1.3.1"
|
||||
},
|
||||
"frameworks": {
|
||||
"uap10.1": { }
|
||||
},
|
||||
"runtimes" : {
|
||||
"win8-aot": { }
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,24 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="CreateLib" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="CreateLib" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<IlcCompileDependsOn>BuildOneFrameworkLibrary</IlcCompileDependsOn>
|
||||
<IlcCompileDependsOn>ComputeIlcCompileInputs;BuildOneFrameworkLibrary</IlcCompileDependsOn>
|
||||
<CreateLibDependsOn>BuildAllFrameworkLibrariesAsSingleLib</CreateLibDependsOn>
|
||||
<IlcMultiModule>true</IlcMultiModule>
|
||||
<NativeIntermediateOutputPath Condition="'$(FrameworkObjPath)' != ''">$(FrameworkObjPath)\</NativeIntermediateOutputPath>
|
||||
<BuildingFrameworkLibrary>true</BuildingFrameworkLibrary>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="Microsoft.NETCore.Native.targets" />
|
||||
<!-- Part of workaround for lack of secondary build artifact import - https://github.com/Microsoft/msbuild/issues/2807 -->
|
||||
<Import Project="$(MSBuildThisFileDirectory)\Microsoft.DotNet.ILCompiler.targets" Condition="'$(IlcCalledViaPackage)' == 'true'"/>
|
||||
<Import Project="Microsoft.NETCore.Native.targets" Condition="'$(IlcCalledViaPackage)' == ''"/>
|
||||
|
||||
<Target Name="BuildAllFrameworkLibraries"
|
||||
Inputs="@(IlcReference)"
|
||||
Outputs="@(IlcReference->'$(NativeIntermediateOutputPath)\%(Filename)$(NativeObjectExt)')">
|
||||
Inputs="@(DefaultFrameworkAssemblies)"
|
||||
Outputs="@(DefaultFrameworkAssemblies->'$(NativeIntermediateOutputPath)\%(Filename)$(NativeObjectExt)')">
|
||||
<ItemGroup>
|
||||
<ProjectToBuild Include="$(MSBuildProjectFullPath)">
|
||||
<AdditionalProperties>
|
||||
LibraryToCompile=%(IlcReference.Identity)
|
||||
LibraryToCompile=%(DefaultFrameworkAssemblies.Identity)
|
||||
</AdditionalProperties>
|
||||
</ProjectToBuild>
|
||||
</ItemGroup>
|
||||
|
||||
18
external/corert/src/BuildIntegration/BuildIntegration.proj
vendored
Normal file
18
external/corert/src/BuildIntegration/BuildIntegration.proj
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<OutputPath>$(BaseOutputPath)$(OSPlatformConfig)/build</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="*.*" Exclude="$(MSBuildProjectFile)" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Build">
|
||||
<Copy SourceFiles="@(Content)" DestinationFolder="$(OutputPath)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="Restore" />
|
||||
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
32
external/corert/src/BuildIntegration/Microsoft.DotNet.ILCompiler.targets
vendored
Normal file
32
external/corert/src/BuildIntegration/Microsoft.DotNet.ILCompiler.targets
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<Project
|
||||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<DeployAppHost>false</DeployAppHost>
|
||||
|
||||
<!-- Part of workaround for lack of secondary build artifact import - https://github.com/Microsoft/msbuild/issues/2807 -->
|
||||
<!-- Define the name of the runtime specific compiler package to import -->
|
||||
<RuntimeIlcPackageName Condition="'$(RuntimeIdentifier)' != ''">runtime.$(RuntimeIdentifier).Microsoft.DotNet.ILCompiler</RuntimeIlcPackageName>
|
||||
<IlcCalledViaPackage>true</IlcCalledViaPackage>
|
||||
|
||||
<!-- If CoreRT is being consumed via its package, runtime-specific properties must be set before compilation can proceed -->
|
||||
<ImportRuntimeIlcPackageTargetDependsOn>RunResolvePackageDependencies</ImportRuntimeIlcPackageTargetDependsOn>
|
||||
<IlcSetupPropertiesDependsOn>ImportRuntimeIlcPackageTarget</IlcSetupPropertiesDependsOn>
|
||||
<IlcDynamicBuildPropertyDependencies>SetupProperties</IlcDynamicBuildPropertyDependencies>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Part of workaround for lack of secondary build artifact import - https://github.com/Microsoft/msbuild/issues/2807 -->
|
||||
<!-- Locate the runtime package according to the current target runtime -->
|
||||
<Target Name="ImportRuntimeIlcPackageTarget" Condition="'$(BuildingFrameworkLibrary)' != 'true' AND $(IlcCalledViaPackage) == 'true'" DependsOnTargets="$(ImportRuntimeIlcPackageTargetDependsOn)" BeforeTargets="Publish">
|
||||
<!-- CoreRT SDK and Framework Assemblies need to be defined to avoid CoreCLR implementations being set as compiler inputs -->
|
||||
<Error Condition="'@(PackageDefinitions)' == ''" Text="The PackageDefinitions ItemGroup is required for target ImportRuntimeIlcPackageTarget" />
|
||||
<ItemGroup>
|
||||
<RuntimePackage Include="@(PackageDefinitions)" Condition="'%(PackageDefinitions.Name)' == '$(RuntimeIlcPackageName)'" />
|
||||
</ItemGroup>
|
||||
<CreateProperty Value="%(RuntimePackage.ResolvedPath)">
|
||||
<Output TaskParameter="Value" PropertyName="RuntimePackagePath"/>
|
||||
</CreateProperty>
|
||||
</Target>
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)\Microsoft.NETCore.Native.targets" />
|
||||
</Project>
|
||||
66
external/corert/src/BuildIntegration/Microsoft.NETCore.Native.Publish.targets
vendored
Normal file
66
external/corert/src/BuildIntegration/Microsoft.NETCore.Native.Publish.targets
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<IlcBuildTasksPath Condition="'$(IlcBuildTasksPath)' == ''">$(MSBuildThisFileDirectory)..\tools\ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
|
||||
|
||||
<!--
|
||||
Prevent dotnet CLI from deploying the CoreCLR shim executable since we produce
|
||||
a native executable.
|
||||
-->
|
||||
<DeployAppHost>false</DeployAppHost>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="_ComputeIlcCompileInputs"
|
||||
BeforeTargets="ComputeIlcCompileInputs"
|
||||
DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
|
||||
<ItemGroup>
|
||||
<IlcReference Include="@(_ManagedResolvedAssembliesToPublish)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
This target hooks into the dotnet CLI publish pipeline. That pipeline has
|
||||
a target called ComputeFilesToPublish which produces the ItemGroup
|
||||
ResolvedFileToPublish based on the inputs of @(IntermediateAssembly)
|
||||
and @(ResolvedAssembliesToPublish). We modify those two item groups
|
||||
to control what gets published after CoreRT optimizes the application.
|
||||
-->
|
||||
<Target Name="ComputeLinkedFilesToPublish"
|
||||
BeforeTargets="ComputeFilesToPublish"
|
||||
DependsOnTargets="_ComputeAssembliesToCompileToNative;LinkNative">
|
||||
|
||||
<ItemGroup>
|
||||
<ResolvedAssembliesToPublish Remove="@(_AssembliesToSkipPublish)" />
|
||||
<ResolvedAssembliesToPublish Include="@(_LinkedResolvedAssemblies)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_NativeIntermediateAssembly Include="@(IntermediateAssembly->'$(NativeOutputPath)%(Filename)$(NativeBinaryExt)')" />
|
||||
<IntermediateAssembly Remove="@(IntermediateAssembly)" />
|
||||
<IntermediateAssembly Include="@(_NativeIntermediateAssembly)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
Filter the input publish file list selecting managed assemblies for compilation.
|
||||
Also produces _AssembliesToSkipPublish which chops out things from the publish
|
||||
pipeline we don't want to see in the output (native images, CoreCLR artifacts)
|
||||
until we get a proper AOT NetCore app package.
|
||||
-->
|
||||
<UsingTask TaskName="ComputeManagedAssemblies" AssemblyFile="$(IlcBuildTasksPath)" />
|
||||
<Target Name="_ComputeAssembliesToCompileToNative" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
|
||||
|
||||
<!-- CoreRT SDK and Framework Assemblies need to be defined to avoid CoreCLR implementations being set as compiler inputs -->
|
||||
<Error Condition="'@(PrivateSdkAssemblies)' == ''" Text="The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative" />
|
||||
<Error Condition="'@(FrameworkAssemblies)' == ''" Text="The FrameworkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative" />
|
||||
|
||||
<ComputeManagedAssemblies Assemblies="@(ResolvedAssembliesToPublish)"
|
||||
DotNetAppHostExecutableName="$(_DotNetAppHostExecutableName)" DotNetHostFxrLibraryName="$(_DotNetHostFxrLibraryName)" DotNetHostPolicyLibraryName="$(_DotNetHostPolicyLibraryName)"
|
||||
SdkAssemblies="@(PrivateSdkAssemblies)" FrameworkAssemblies="@(FrameworkAssemblies)">
|
||||
<Output TaskParameter="ManagedAssemblies" ItemName="_ManagedResolvedAssembliesToPublish" />
|
||||
<Output TaskParameter="AssembliesToSkipPublish" ItemName="_AssembliesToSkipPublish" />
|
||||
</ComputeManagedAssemblies>
|
||||
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
***********************************************************************************************
|
||||
Microsoft.NETCore.Native.Unix.props
|
||||
@@ -14,7 +13,7 @@ The .NET Foundation licenses this file to you under the MIT license.
|
||||
See the LICENSE file in the project root for more information.
|
||||
***********************************************************************************************
|
||||
-->
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == '' and '$(TargetOS)' == 'OSX'">clang</CppCompilerAndLinker>
|
||||
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang-3.9</CppCompilerAndLinker>
|
||||
@@ -22,40 +21,70 @@ See the LICENSE file in the project root for more information.
|
||||
<CppLinker>$(CppCompilerAndLinker)</CppLinker>
|
||||
<CppLibCreator>ar</CppLibCreator>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Part of workaround for lack of secondary build artifact import - https://github.com/Microsoft/msbuild/issues/2807 -->
|
||||
<!-- Ensure that runtime-specific paths have already been set -->
|
||||
<PropertyGroup>
|
||||
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == '' and '$(TargetOS)' == 'OSX'">clang</CppCompilerAndLinker>
|
||||
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang-3.9</CppCompilerAndLinker>
|
||||
<CppCompiler>$(CppCompilerAndLinker)</CppCompiler>
|
||||
<CppLinker>$(CppCompilerAndLinker)</CppLinker>
|
||||
<CppLibCreator>ar</CppLibCreator>
|
||||
</PropertyGroup>
|
||||
<Target Name="SetupOSSpecificProps" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
|
||||
|
||||
<ItemGroup>
|
||||
<CppCompilerAndLinkerArg Include="-I $(IlcPath)/inc" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(Configuration)' == 'Debug'" Include="-g -O0" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(Configuration)' != 'Debug'" Include="-O2" />
|
||||
<CppCompilerAndLinkerArg Include="-c -Wno-invalid-offsetof" />
|
||||
<CppCompilerAndLinkerArg Include="$(AdditionalCppCompilerFlags)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CppCompilerAndLinkerArg Include="-I $(IlcPath)/inc" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(Configuration)' == 'Debug'" Include="-g -O0" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(Configuration)' != 'Debug'" Include="-O2" />
|
||||
<CppCompilerAndLinkerArg Include="-c -Wno-invalid-offsetof" />
|
||||
<CppCompilerAndLinkerArg Include="$(AdditionalCppCompilerFlags)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<NativeLibrary Condition="'$(IlcMultiModule)' == 'true' and $(NativeCodeGen) == ''" Include="$(SharedLibrary)" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)/sdk/libbootstrapper.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)/sdk/libRuntime.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)/sdk/libbootstrappercpp.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)/sdk/libPortableRuntime.a" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<NativeLibrary Condition="'$(IlcMultiModule)' == 'true' and $(NativeCodeGen) == ''" Include="$(SharedLibrary)" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) == ''" Include="$(IlcPath)/sdk/libbootstrapper.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) != ''" Include="$(IlcPath)/sdk/libbootstrapperdll.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)/sdk/libRuntime.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)/sdk/libbootstrappercpp.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)/sdk/libPortableRuntime.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'wasm'" Include="$(IlcPath)/sdk/libbootstrappercpp.a" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'wasm'" Include="$(IlcPath)/sdk/libPortableRuntime.a" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/sdk/libSystem.Private.CoreLib.Native.a" />
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/framework/System.Native.a" />
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/framework/libSystem.Globalization.Native.a" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/sdk/libSystem.Private.CoreLib.Native.a" />
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/framework/System.Native.a" />
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/framework/System.Globalization.Native.a" />
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/framework/System.IO.Compression.Native.a" />
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/framework/System.Net.Http.Native.a" />
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/framework/System.Net.Security.Native.a" />
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/framework/System.Security.Cryptography.Native.Apple.a" Condition="'$(TargetOS)' == 'OSX'"/>
|
||||
<AdditionalNativeLibrary Include="$(IlcPath)/framework/System.Security.Cryptography.Native.OpenSsl.a" Condition="'$(TargetOS)' != 'OSX'"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<LinkerArg Include="@(NativeLibrary)" />
|
||||
<LinkerArg Include="@(AdditionalNativeLibrary)" />
|
||||
<LinkerArg Include="-g" />
|
||||
<LinkerArg Include="-Wl,-rpath,'$ORIGIN'" />
|
||||
<LinkerArg Include="-pthread" />
|
||||
<LinkerArg Include="-lstdc++" />
|
||||
<LinkerArg Include="-ldl" />
|
||||
<LinkerArg Include="-lm" />
|
||||
<LinkerArg Include="-luuid" Condition="'$(TargetOS)' != 'OSX'" />
|
||||
<LinkerArg Include="-lrt" Condition="'$(TargetOS)' != 'OSX'" />
|
||||
<LinkerArg Include="-licucore" Condition="'$(TargetOS)' == 'OSX'" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<LinkerArg Include="@(NativeLibrary)" />
|
||||
<LinkerArg Include="@(AdditionalNativeLibrary)" />
|
||||
<LinkerArg Include="-g" />
|
||||
<LinkerArg Include="-Wl,-rpath,'$ORIGIN'" />
|
||||
<LinkerArg Include="-pthread" />
|
||||
<LinkerArg Include="-lstdc++" />
|
||||
<LinkerArg Include="-ldl" />
|
||||
<LinkerArg Include="-lm" />
|
||||
<LinkerArg Include="-lcurl" />
|
||||
<LinkerArg Include="-lz" />
|
||||
<LinkerArg Include="-luuid" Condition="'$(TargetOS)' != 'OSX'" />
|
||||
<LinkerArg Include="-lrt" Condition="'$(TargetOS)' != 'OSX'" />
|
||||
<LinkerArg Include="-licucore" Condition="'$(TargetOS)' == 'OSX'" />
|
||||
<LinkerArg Include="-dynamiclib" Condition="'$(TargetOS)' == 'OSX' and '$(NativeLib)' == 'Shared'" />
|
||||
<LinkerArg Include="-shared" Condition="'$(TargetOS)' != 'OSX' and '$(NativeLib)' == 'Shared'" />
|
||||
</ItemGroup>
|
||||
|
||||
<Exec Command="command -v $(CppLinker)" IgnoreExitCode="true">
|
||||
<Output TaskParameter="ExitCode" PropertyName="_WhereLinker"/>
|
||||
</Exec>
|
||||
<Error Condition="'$(_WhereLinker)' != '0' and '$(TargetOS)' == 'OSX'" Text="Platform linker ('$(CppLinker)') not found. Try installing Xcode to resolve the problem." />
|
||||
<Error Condition="'$(_WhereLinker)' != '0' and '$(TargetOS)' != 'OSX'" Text="Platform linker ('$(CppLinker)') not found. Try installing $(CppLinker) or the appropriate package for your platform to resolve the problem." />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
***********************************************************************************************
|
||||
Microsoft.NETCore.Native.Windows.props
|
||||
@@ -14,62 +13,73 @@ The .NET Foundation licenses this file to you under the MIT license.
|
||||
See the LICENSE file in the project root for more information.
|
||||
***********************************************************************************************
|
||||
-->
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<CppCompiler>cl</CppCompiler>
|
||||
<CppLinker>link</CppLinker>
|
||||
<CppLibCreator>lib</CppLibCreator>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Part of workaround for lack of secondary build artifact import - https://github.com/Microsoft/msbuild/issues/2807 -->
|
||||
<!-- Ensure that runtime-specific paths have already been set -->
|
||||
<Target Name="SetupOSSpecificProps" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
|
||||
<ItemGroup>
|
||||
<CppCompilerAndLinkerArg Include="/I$(IlcPath)\inc" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(Configuration)' == 'Debug'" Include="/Od" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(Configuration)' != 'Debug'" Include="/O2" />
|
||||
<CppCompilerAndLinkerArg Include="/c /nologo /W3 /GS /DCPPCODEGEN /EHs /Zi /bigobj" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(UseDebugCrt)' == 'true'" Include="/MTd" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(UseDebugCrt)' != 'true'" Include="/MT" />
|
||||
<CppCompilerAndLinkerArg Include="$(AdditionalCppCompilerFlags)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<CppCompilerAndLinkerArg Include="/I$(IlcPath)\inc" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(Configuration)' == 'Debug'" Include="/Od" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(Configuration)' != 'Debug'" Include="/O2" />
|
||||
<CppCompilerAndLinkerArg Include="/c /nologo /W3 /GS /DCPPCODEGEN /EHs /Zi /bigobj" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(UseDebugCrt)' == 'true'" Include="/MTd" />
|
||||
<CppCompilerAndLinkerArg Condition="'$(UseDebugCrt)' != 'true'" Include="/MT" />
|
||||
<CppCompilerAndLinkerArg Include="$(AdditionalCppCompilerFlags)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)\sdk\bootstrapper.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)\sdk\Runtime.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\bootstrappercpp.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\PortableRuntime.lib" />
|
||||
<NativeLibrary Condition="'$(IlcMultiModule)' == 'true' and $(NativeCodeGen) == ''" Include="$(SharedLibrary)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalNativeLibrary Include="kernel32.lib" />
|
||||
<AdditionalNativeLibrary Include="user32.lib" />
|
||||
<AdditionalNativeLibrary Include="gdi32.lib" />
|
||||
<AdditionalNativeLibrary Include="winspool.lib" />
|
||||
<AdditionalNativeLibrary Include="comdlg32.lib" />
|
||||
<AdditionalNativeLibrary Include="advapi32.lib" />
|
||||
<AdditionalNativeLibrary Include="shell32.lib" />
|
||||
<AdditionalNativeLibrary Include="ole32.lib" />
|
||||
<AdditionalNativeLibrary Include="oleaut32.lib" />
|
||||
<AdditionalNativeLibrary Include="uuid.lib" />
|
||||
<AdditionalNativeLibrary Include="bcrypt.lib" />
|
||||
<AdditionalNativeLibrary Include="normaliz.lib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<LinkerArg Include="@(NativeLibrary)" />
|
||||
<LinkerArg Include="@(AdditionalNativeLibrary)" />
|
||||
<LinkerArg Include="/NOLOGO /DEBUG /MANIFEST:NO" />
|
||||
<!-- The runtime is not compatible with jump stubs inserted by incremental linking. -->
|
||||
<LinkerArg Include="/INCREMENTAL:NO" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- TODO <LinkerArg Include="/MACHINE:X64" /> -->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Configuration)' != 'Debug'">
|
||||
<LinkerArg Include="/OPT:REF" />
|
||||
<LinkerArg Include="/OPT:ICF" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) == ''" Include="$(IlcPath)\sdk\bootstrapper.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) != ''" Include="$(IlcPath)\sdk\bootstrapperdll.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)\sdk\Runtime.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\bootstrappercpp.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\PortableRuntime.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'wasm'" Include="$(IlcPath)\sdk\bootstrappercpp.lib" />
|
||||
<NativeLibrary Condition="$(NativeCodeGen) == 'wasm'" Include="$(IlcPath)\sdk\PortableRuntime.lib" />
|
||||
<NativeLibrary Condition="'$(IlcMultiModule)' == 'true' and $(NativeCodeGen) == ''" Include="$(SharedLibrary)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalNativeLibrary Include="kernel32.lib" />
|
||||
<AdditionalNativeLibrary Include="user32.lib" />
|
||||
<AdditionalNativeLibrary Include="gdi32.lib" />
|
||||
<AdditionalNativeLibrary Include="winspool.lib" />
|
||||
<AdditionalNativeLibrary Include="comdlg32.lib" />
|
||||
<AdditionalNativeLibrary Include="advapi32.lib" />
|
||||
<AdditionalNativeLibrary Include="shell32.lib" />
|
||||
<AdditionalNativeLibrary Include="ole32.lib" />
|
||||
<AdditionalNativeLibrary Include="oleaut32.lib" />
|
||||
<AdditionalNativeLibrary Include="uuid.lib" />
|
||||
<AdditionalNativeLibrary Include="bcrypt.lib" />
|
||||
<AdditionalNativeLibrary Include="normaliz.lib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<LinkerArg Condition="$(NativeLib) == 'Shared'" Include="/DLL" />
|
||||
<LinkerArg Include="@(NativeLibrary)" />
|
||||
<LinkerArg Include="@(AdditionalNativeLibrary)" />
|
||||
<LinkerArg Include="/NOLOGO /DEBUG /MANIFEST:NO" />
|
||||
<!-- The runtime is not compatible with jump stubs inserted by incremental linking. -->
|
||||
<LinkerArg Include="/INCREMENTAL:NO" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- TODO <LinkerArg Include="/MACHINE:X64" /> -->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Configuration)' != 'Debug'">
|
||||
<LinkerArg Include="/OPT:REF" />
|
||||
<LinkerArg Include="/OPT:ICF" />
|
||||
</ItemGroup>
|
||||
|
||||
<Exec Command="where /Q $(CppLinker)" IgnoreExitCode="true">
|
||||
<Output TaskParameter="ExitCode" PropertyName="_WhereLinker"/>
|
||||
</Exec>
|
||||
<Error Condition="'$(_WhereLinker)' != '0'" Text="Platform linker not found. Make sure to publish from a x64 Native Tools Command Prompt for VS 2017 with C++ tools installed." />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
***********************************************************************************************
|
||||
Microsoft.NETCore.Native.targets
|
||||
@@ -14,74 +13,127 @@ The .NET Foundation licenses this file to you under the MIT license.
|
||||
See the LICENSE file in the project root for more information.
|
||||
***********************************************************************************************
|
||||
-->
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- Set defaults for unspecified properties -->
|
||||
<PropertyGroup>
|
||||
<NativeIntermediateOutputPath Condition="'$(NativeIntermediateOutputPath)' == ''">$(IntermediateOutputPath)native\</NativeIntermediateOutputPath>
|
||||
<NativeOutputPath Condition="'$(NativeOutputPath)' == ''">$(OutputPath)native\</NativeOutputPath>
|
||||
<NativeCompilationDuringPublish Condition="'$(NativeCompilationDuringPublish)' == ''">true</NativeCompilationDuringPublish>
|
||||
<!-- Workaround for lack of current host OS detection - https://github.com/Microsoft/msbuild/issues/539 -->
|
||||
<TargetOS Condition="'$(TargetOS)' == '' and '$(OS)' == 'Unix' and Exists('/Applications')">OSX</TargetOS>
|
||||
<!-- The correct OS detection code. Uncomment once CI machines are upgraded to the latest version of MSBuild -->
|
||||
<!-- <TargetOS Condition="'$([MSBuild]::IsOSPlatform(OSX))' == 'true'">OSX</TargetOS> -->
|
||||
<TargetOS Condition="'$(TargetOS)' == ''">$(OS)</TargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NativeObjectExt Condition="'$(TargetOS)' == 'Windows_NT'">.obj</NativeObjectExt>
|
||||
<NativeObjectExt Condition="'$(TargetOS)' != 'Windows_NT'">.o</NativeObjectExt>
|
||||
<NativeObjectExt Condition="'$(NativeCodeGen)' == 'wasm'">.bc</NativeObjectExt>
|
||||
|
||||
<LibFileExt Condition="'$(TargetOS)' == 'Windows_NT'">.lib</LibFileExt>
|
||||
<LibFileExt Condition="'$(TargetOS)' != 'Windows_NT'">.a</LibFileExt>
|
||||
|
||||
<IlcOutputFileExt>$(NativeObjectExt)</IlcOutputFileExt>
|
||||
<IlcOutputFileExt Condition="$(NativeCodeGen) == 'cpp'">.cpp</IlcOutputFileExt>
|
||||
<IlcOutputFileExt Condition="'$(NativeCodeGen)' == 'wasm'">.bc</IlcOutputFileExt>
|
||||
|
||||
|
||||
<NativeBinaryExt Condition="'$(OutputType)' == 'Exe' and '$(TargetOS)' == 'Windows_NT'">.exe</NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(OutputType)' == 'Exe' and '$(TargetOS)' != 'Windows_NT'"></NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' == 'Windows_NT'">.dll</NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' == 'OSX'">.dylib</NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' != 'Windows_NT' and '$(TargetOS)' != 'OSX'">.so</NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' == 'Windows_NT' and $(NativeLib) == 'Shared'">.dll</NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' == 'OSX' and $(NativeLib) == 'Shared'">.dylib</NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' != 'Windows_NT' and '$(TargetOS)' != 'OSX' and $(NativeLib) == 'Shared'">.so</NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' == 'Windows_NT' and $(NativeLib) == 'Static'">.lib</NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' != 'Windows_NT' and $(NativeLib) == 'Static'">.a</NativeBinaryExt>
|
||||
<NativeBinaryExt Condition="'$(NativeCodeGen)' == 'wasm'">.html</NativeBinaryExt>
|
||||
|
||||
<ExportsFileExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' == 'Windows_NT' and '$(NativeLib)' == 'Shared'">.def</ExportsFileExt>
|
||||
<ExportsFileExt Condition="'$(OutputType)' != 'Exe' and '$(TargetOS)' != 'Windows_NT' and '$(NativeLib)' == 'Shared'">.exports</ExportsFileExt>
|
||||
|
||||
<NativeObject>$(NativeIntermediateOutputPath)$(TargetName)$(NativeObjectExt)</NativeObject>
|
||||
<NativeBinary>$(NativeOutputPath)$(TargetName)$(NativeBinaryExt)</NativeBinary>
|
||||
<ExportsFile Condition="$(NativeLib) == 'Shared' and $(ExportsFile) == ''">$(NativeIntermediateOutputPath)$(TargetName)$(ExportsFileExt)</ExportsFile>
|
||||
|
||||
<IlcCompileOutput Condition="$(NativeCodeGen) == ''">$(NativeObject)</IlcCompileOutput>
|
||||
<IlcCompileOutput Condition="$(NativeCodeGen) == 'cpp'">$(NativeIntermediateOutputPath)$(TargetName).cpp</IlcCompileOutput>
|
||||
|
||||
<LinkNativeDependsOn Condition="$(NativeCodeGen) == ''">IlcCompile</LinkNativeDependsOn>
|
||||
<LinkNativeDependsOn Condition="$(NativeCodeGen) == 'cpp'">CppCompile</LinkNativeDependsOn>
|
||||
<LinkNativeDependsOn Condition="$(NativeCodeGen) == 'wasm'">IlcCompile</LinkNativeDependsOn>
|
||||
|
||||
<FrameworkLibPath Condition="'$(FrameworkLibPath)' == ''">$(NativeOutputPath)</FrameworkLibPath>
|
||||
<FrameworkObjPath Condition="'$(FrameworkObjPath)' == ''">$(NativeIntermediateOutputPath)</FrameworkObjPath>
|
||||
|
||||
<SharedLibrary Condition="'$(OS)' == 'Windows_NT'">$(FrameworkLibPath)\Framework$(LibFileExt)</SharedLibrary>
|
||||
<SharedLibrary Condition="'$(OS)' != 'Windows_NT'">$(FrameworkLibPath)\libframework$(LibFileExt)</SharedLibrary>
|
||||
<IlcDynamicBuildPropertyDependencies Condition="'$(IlcCalledViaPackage)' == 'true'">SetupProperties</IlcDynamicBuildPropertyDependencies>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="$(BuildingFrameworkLibrary) != 'true'">
|
||||
<ManagedBinary Include="$(IntermediateOutputPath)$(TargetName)$(TargetExt)" />
|
||||
<PropertyGroup Condition="'$(IlcCompileDependsOn)'=='' and '$(NativeCompilationDuringPublish)' != 'false'">
|
||||
<IlcCompileDependsOn Condition="'$(BuildingFrameworkLibrary)' != 'true'">Compile;ComputeIlcCompileInputs</IlcCompileDependsOn>
|
||||
<IlcCompileDependsOn Condition="'$(IlcMultiModule)' == 'true' and '$(BuildingFrameworkLibrary)' != 'true'">$(IlcCompileDependsOn);BuildFrameworkLib</IlcCompileDependsOn>
|
||||
<IlcCompileDependsOn>$(IlcCompileDependsOn);SetupOSSpecificProps</IlcCompileDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PrivateSdkAssemblies Include="$(IlcPath)\sdk\*.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FrameworkAssemblies Include="$(IlcPath)\framework\*.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<IlcCompileInput Include="@(ManagedBinary)" />
|
||||
<IlcReference Include="$(IlcPath)\sdk\*.dll" />
|
||||
<IlcReference Include="$(IlcPath)\framework\*.dll" />
|
||||
<DefaultFrameworkAssemblies Include="@(FrameworkAssemblies)" />
|
||||
<DefaultFrameworkAssemblies Include="@(PrivateSdkAssemblies)" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(IlcCompileDependsOn)'==''">
|
||||
<IlcCompileDependsOn Condition="'$(BuildingFrameworkLibrary)' != 'true'">Compile</IlcCompileDependsOn>
|
||||
<IlcCompileDependsOn Condition="'$(IlcMultiModule)' == 'true' and '$(BuildingFrameworkLibrary)' != 'true'">$(IlcCompileDependsOn);BuildFrameworkLib</IlcCompileDependsOn>
|
||||
</PropertyGroup>
|
||||
<!-- Part of workaround for lack of secondary build artifact import - https://github.com/Microsoft/msbuild/issues/2807 -->
|
||||
<!-- The properties below need to be defined only after we've found the correct runtime package reference -->
|
||||
<Target Name="SetupProperties" DependsOnTargets="$(IlcSetupPropertiesDependsOn)" BeforeTargets="Publish">
|
||||
<PropertyGroup>
|
||||
<!-- Define paths used in build targets to point to the runtime-specific ILCompiler implementation -->
|
||||
<IlcPath Condition="'$(IlcPath)' == ''">$(RuntimePackagePath)</IlcPath>
|
||||
<IlcBuildTasksPath>$(RuntimePackagePath)\tools\ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
|
||||
<!-- Set defaults for unspecified properties -->
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- If running from a package these values need to be set again with the resolved IlcPath -->
|
||||
<ItemGroup>
|
||||
<PrivateSdkAssemblies Include="$(IlcPath)\sdk\*.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FrameworkAssemblies Include="$(IlcPath)\framework\*.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DefaultFrameworkAssemblies Include="@(FrameworkAssemblies)" />
|
||||
<DefaultFrameworkAssemblies Include="@(PrivateSdkAssemblies)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="ComputeIlcCompileInputs" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)" BeforeTargets="Publish">
|
||||
<ItemGroup>
|
||||
<ManagedBinary Condition="$(BuildingFrameworkLibrary) != 'true'" Include="$(IntermediateOutputPath)$(TargetName)$(TargetExt)" />
|
||||
<IlcCompileInput Include="@(ManagedBinary)" />
|
||||
<IlcReference Include="@(DefaultFrameworkAssemblies)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
BuildFrameworkLib is invoked before IlcCompile in multi-module builds to
|
||||
produce the shared framework library on demand
|
||||
-->
|
||||
<Target Name="BuildFrameworkLib" Condition="'$(DisableFrameworkLibGeneration)' != 'true'">
|
||||
<Target Name="BuildFrameworkLib" Condition="'$(DisableFrameworkLibGeneration)' != 'true'" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
|
||||
<ItemGroup>
|
||||
<ProjectToBuild Include="$(MSBuildThisFileDirectory)\BuildFrameworkNativeObjects.proj">
|
||||
<AdditionalProperties>
|
||||
<!-- This builds the project with the ILC implementation in the identified runtime package to avoid resolving it again -->
|
||||
<ProjectToBuild Include="$(MSBuildThisFileDirectory)BuildFrameworkNativeObjects.proj">
|
||||
<AdditionalProperties>
|
||||
IntermediateOutputPath=$(IntermediateOutputPath);
|
||||
FrameworkLibPath=$(FrameworkLibPath);
|
||||
FrameworkObjPath=$(FrameworkObjPath)
|
||||
FrameworkObjPath=$(FrameworkObjPath);
|
||||
RuntimePackagePath=$(RuntimePackagePath)
|
||||
</AdditionalProperties>
|
||||
</ProjectToBuild>
|
||||
</ItemGroup>
|
||||
@@ -102,6 +154,11 @@ See the LICENSE file in the project root for more information.
|
||||
<IlcArg Condition="$(IlcMultiModule) == 'true'" Include="--multifile" />
|
||||
<IlcArg Condition="$(Optimize) == 'true'" Include="-O" />
|
||||
<IlcArg Condition="$(DebugSymbols) == 'true'" Include="-g" />
|
||||
<IlcArg Condition="$(IlcGenerateMapFile) == 'true'" Include="--map:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).map.xml" />
|
||||
<IlcArg Condition="$(RdXmlFile) != ''" Include="--rdxml:$(RdXmlFile)" />
|
||||
<IlcArg Condition="$(OutputType) == 'Library' and $(NativeLib) != ''" Include="--nativelib" />
|
||||
<IlcArg Condition="$(ExportsFile) != ''" Include="--exportsfile:$(ExportsFile)" />
|
||||
<ILcArg Condition="'$(Platform)' == 'wasm'" Include="--wasm" />
|
||||
</ItemGroup>
|
||||
|
||||
<MakeDir Directories="$(NativeIntermediateOutputPath)" />
|
||||
@@ -109,18 +166,13 @@ See the LICENSE file in the project root for more information.
|
||||
|
||||
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(NativeObject)))" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TestHost Condition="'$(OS)' == 'Windows_NT'">CoreRun.exe</TestHost>
|
||||
<TestHost Condition="'$(OS)' != 'Windows_NT'">corerun</TestHost>
|
||||
</PropertyGroup>
|
||||
|
||||
<Exec Command=""$(IlcPath)\$(TestHost)" "$(IlcPath)\ilc.dll" @"$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).ilc.rsp"">
|
||||
</Exec>
|
||||
<Message Text="Generating native code" Importance="high" />
|
||||
|
||||
<Exec Command=""$(IlcPath)\tools\ilc" @"$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).ilc.rsp"" />
|
||||
</Target>
|
||||
|
||||
<Import Project="Microsoft.NETCore.Native.Windows.props" Condition="'$(TargetOS)' == 'Windows_NT'" />
|
||||
<Import Project="Microsoft.NETCore.Native.Unix.props" Condition="'$(TargetOS)' != 'Windows_NT'" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NETCore.Native.Windows.props" Condition="'$(TargetOS)' == 'Windows_NT'" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NETCore.Native.Unix.props" Condition="'$(TargetOS)' != 'Windows_NT'" />
|
||||
|
||||
<Target Name="CppCompile"
|
||||
Inputs="$(IlcCompileOutput)"
|
||||
@@ -139,7 +191,7 @@ See the LICENSE file in the project root for more information.
|
||||
<WriteLinesToFile File="$(NativeIntermediateOutputPath)cl.rsp" Lines="@(CompilerArg)" Overwrite="true" Condition="'$(OS)' == 'Windows_NT'"/>
|
||||
<Exec Command="$(CppCompiler) @"$(NativeIntermediateOutputPath)cl.rsp"" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="LinkNative"
|
||||
Inputs="$(NativeObject);@(NativeLibrary)"
|
||||
Outputs="$(NativeBinary)"
|
||||
@@ -149,28 +201,57 @@ See the LICENSE file in the project root for more information.
|
||||
<CustomLinkerArg Include="$(NativeObject)" />
|
||||
<CustomLinkerArg Include="-o $(NativeBinary)" Condition="'$(OS)' != 'Windows_NT'" />
|
||||
<CustomLinkerArg Include="/OUT:$(NativeBinary)" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
<CustomLinkerArg Include="/DEF:$(ExportsFile)" Condition="'$(OS)' == 'Windows_NT' and $(ExportsFile) != ''" />
|
||||
<CustomLinkerArg Include="-exported_symbols_list $(ExportsFile)" Condition="'$(OS)' != 'Windows_NT' and $(ExportsFile) != ''" />
|
||||
<CustomLinkerArg Include="@(LinkerArg)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<CustomLibArg Include="-crs $(NativeBinary)" Condition="'$(OS)' != 'Windows_NT'" />
|
||||
<CustomLibArg Include="/OUT:$(NativeBinary)" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
<CustomLibArg Include="$(NativeObject)" />
|
||||
</ItemGroup>
|
||||
|
||||
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(NativeBinary)))" />
|
||||
<Exec Command="$(CppLinker) @(CustomLinkerArg, ' ')" Condition="'$(OS)' != 'Windows_NT'" />
|
||||
<WriteLinesToFile File="$(NativeIntermediateOutputPath)link.rsp" Lines="@(CustomLinkerArg)" Overwrite="true" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
<Exec Command="$(CppLinker) @"$(NativeIntermediateOutputPath)link.rsp"" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
|
||||
<Exec Command="$(CppLinker) @(CustomLinkerArg, ' ')" Condition="'$(OS)' != 'Windows_NT' and '$(NativeLib)' != 'Static'" />
|
||||
<Exec Command="$(CppLibCreator) @(CustomLibArg, ' ')" Condition="'$(OS)' != 'Windows_NT' and '$(NativeLib)' == 'Static'" />
|
||||
|
||||
<WriteLinesToFile File="$(NativeIntermediateOutputPath)link.rsp" Lines="@(CustomLinkerArg)" Overwrite="true" Condition="'$(OS)' == 'Windows_NT' and '$(NativeLib)' != 'Static'" />
|
||||
<Exec Command="$(CppLinker) @"$(NativeIntermediateOutputPath)link.rsp"" Condition="'$(OS)' == 'Windows_NT' and '$(NativeLib)' != 'Static' and '$(NativeCodeGen)' != 'wasm'" />
|
||||
<WriteLinesToFile File="$(NativeIntermediateOutputPath)lib.rsp" Lines="@(CustomLibArg)" Overwrite="true" Condition="'$(OS)' == 'Windows_NT' and '$(NativeLib)' == 'Static'" />
|
||||
<Exec Command="$(CppLibCreator) @"$(NativeIntermediateOutputPath)lib.rsp"" Condition="'$(OS)' == 'Windows_NT' and '$(NativeLib)' == 'Static' and '$(NativeCodeGen)' != 'wasm'" />
|
||||
|
||||
<PropertyGroup>
|
||||
<EmccArgs>"$(NativeObject)" -o "$(NativeBinary)" -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 </EmccArgs>
|
||||
<EmccArgs Condition="'$(Platform)'=='wasm'">$(EmccArgs) "$(IlcPath)\sdk\libPortableRuntime.bc" "$(IlcPath)\sdk\libbootstrappercpp.bc" </EmccArgs>
|
||||
<EmccArgs Condition="'$(Configuration)'=='Release'">$(EmccArgs) -O2 --llvm-lto 2</EmccArgs>
|
||||
<EmccArgs Condition="'$(Configuration)'=='Debug'">$(EmccArgs) -g3</EmccArgs>
|
||||
</PropertyGroup>
|
||||
|
||||
<Exec Command=""$(EMSCRIPTEN)\emcc.bat" $(EmccArgs)" Condition="'$(NativeCodeGen)' == 'wasm' and '$(EMSCRIPTEN)' != ''" />
|
||||
<Message Text="Emscripten not found, not linking WebAssembly. To enable WebAssembly linking, install Emscripten and ensure the EMSCRIPTEN environment variable points to the directory containing emcc.bat"
|
||||
Condition="'$(NativeCodeGen)' == 'wasm' and '$(EMSCRIPTEN)' == ''" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CreateLib"
|
||||
Inputs="@(LibInputs)"
|
||||
Outputs="$(SharedLibrary)"
|
||||
DependsOnTargets="$(CreateLibDependsOn)">
|
||||
DependsOnTargets="$(CreateLibDependsOn);$(IlcDynamicBuildPropertyDependencies)"
|
||||
>
|
||||
|
||||
<ItemGroup>
|
||||
<CustomLibArg Include="/out:$(SharedLibrary)" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
<CustomLibArg Include="-crs $(SharedLibrary)" Condition="'$(OS)' != 'Windows_NT'" />
|
||||
<CustomLibArg Include="@(LibInputs->'%(Identity)')" />
|
||||
</ItemGroup>
|
||||
|
||||
<MakeDir Directories="$(NativeIntermediateOutputPath)" />
|
||||
<WriteLinesToFile File="$(NativeIntermediateOutputPath)lib.rsp" Lines="@(CustomLibArg)" Overwrite="true" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(SharedLibrary)))" />
|
||||
<Exec Command="$(CppLibCreator) @"$(NativeIntermediateOutputPath)lib.rsp"" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
<Exec Command="$(CppLibCreator) @(CustomLibArg, ' ')" Condition="'$(OS)' != 'Windows_NT'" />
|
||||
</Target>
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NETCore.Native.Publish.targets" Condition="'$(NativeCompilationDuringPublish)' != 'false'" />
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{EE99759F-C776-4F0E-8B06-E65E833B2059}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NativeFormatGen</RootNamespace>
|
||||
|
||||
@@ -174,7 +174,7 @@ class ReaderGen : CsWriter
|
||||
|
||||
private void EmitCollection(string collectionTypeName, string elementTypeName)
|
||||
{
|
||||
OpenScope($"public partial struct {collectionTypeName} : IReadOnlyCollection<{elementTypeName}>");
|
||||
OpenScope($"public partial struct {collectionTypeName}");
|
||||
|
||||
WriteLine("private NativeReader _reader;");
|
||||
WriteLine("private uint _offset;");
|
||||
@@ -196,15 +196,7 @@ class ReaderGen : CsWriter
|
||||
WriteLine($"return new Enumerator(_reader, _offset);");
|
||||
CloseScope("GetEnumerator");
|
||||
|
||||
OpenScope($"IEnumerator<{elementTypeName}> IEnumerable<{elementTypeName}>.GetEnumerator()");
|
||||
WriteLine($"return new Enumerator(_reader, _offset);");
|
||||
CloseScope("GetEnumerator");
|
||||
|
||||
OpenScope($"System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()");
|
||||
WriteLine("return new Enumerator(_reader, _offset);");
|
||||
CloseScope("GetEnumerator");
|
||||
|
||||
OpenScope($"public struct Enumerator : IEnumerator<{elementTypeName}>");
|
||||
OpenScope($"public struct Enumerator");
|
||||
|
||||
WriteLine("private NativeReader _reader;");
|
||||
WriteLine("private uint _offset;");
|
||||
@@ -223,12 +215,6 @@ class ReaderGen : CsWriter
|
||||
CloseScope();
|
||||
CloseScope("Current");
|
||||
|
||||
OpenScope("object System.Collections.IEnumerator.Current");
|
||||
OpenScope("get");
|
||||
WriteLine("return _current;");
|
||||
CloseScope();
|
||||
CloseScope("Current");
|
||||
|
||||
OpenScope("public bool MoveNext()");
|
||||
WriteLine("if (_remaining == 0)");
|
||||
WriteLine(" return false;");
|
||||
@@ -237,10 +223,6 @@ class ReaderGen : CsWriter
|
||||
WriteLine("return true;");
|
||||
CloseScope("MoveNext");
|
||||
|
||||
OpenScope("void System.Collections.IEnumerator.Reset()");
|
||||
WriteLine("throw new NotSupportedException();");
|
||||
CloseScope("Reset");
|
||||
|
||||
OpenScope("public void Dispose()");
|
||||
CloseScope("Dispose");
|
||||
|
||||
|
||||
@@ -26,25 +26,23 @@ public enum RecordDefFlags
|
||||
[Flags]
|
||||
public enum MemberDefFlags
|
||||
{
|
||||
Map = 0x0001, // => Dictionary<string, RecordType> for MetadataWriter
|
||||
// => List<RecordType> for MetadataReader
|
||||
List = 0x0002, // => List<RecordType>
|
||||
Array = 0x0004, // => RecordType[]
|
||||
Map = 0x0001, // => List<RecordType> for writer
|
||||
List = 0x0002, // => List<RecordType> for writer
|
||||
Array = 0x0004, // => RecordType[] for writer
|
||||
|
||||
Collection = MemberDefFlags.Map | MemberDefFlags.List | MemberDefFlags.Array,
|
||||
Sequence = MemberDefFlags.List | MemberDefFlags.Array,
|
||||
|
||||
RecordRef = 0x0008, // => RecordTypeHandle
|
||||
|
||||
Ref = MemberDefFlags.RecordRef,
|
||||
RecordRef = 0x0008,
|
||||
|
||||
Child = 0x0010, // Member instance is logically defined and owned by record;
|
||||
// otherwise instance may be shared (such as a TypeRef).
|
||||
Name = 0x0020, // May be used as the member"s simple name for diagnostics.
|
||||
Name = 0x0020, // May be used as the member's simple name for diagnostics.
|
||||
NotPersisted = 0x0040, // Indicates member is not written to or read from metadata.
|
||||
Compare = 0x0080, // Indicates member should be used for equality functionality.
|
||||
EnumerateForHashCode = 0x0100, // Indicates that the collection is safe to be enumerated in GetHashCode
|
||||
// without causing reentrancy
|
||||
CustomCompare = 0x0200, // Indicates that this member uses a custom comparer
|
||||
}
|
||||
|
||||
public enum MemberTypeKind
|
||||
@@ -86,14 +84,14 @@ public class MemberDef
|
||||
else
|
||||
{
|
||||
typeName = (kind == MemberTypeKind.WriterField) ?
|
||||
(TypeName != null ? (string)TypeName : "MetadataRecord"): $"{ TypeName}Handle";
|
||||
(TypeName != null ? (string)TypeName : "MetadataRecord"): $"{TypeName}Handle";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
typeName = (string)TypeName;
|
||||
}
|
||||
if ((Flags & (MemberDefFlags.Array | MemberDefFlags.List | MemberDefFlags.Map)) != 0)
|
||||
if ((Flags & MemberDefFlags.Collection) != 0)
|
||||
{
|
||||
if (kind == MemberTypeKind.WriterField)
|
||||
{
|
||||
@@ -119,10 +117,7 @@ public class MemberDef
|
||||
if (typeSet == null)
|
||||
return null;
|
||||
|
||||
string result = "One of: " + typeSet[0];
|
||||
for (int i = 1; i < typeSet.Length; i++)
|
||||
result += ", " + typeSet[i];
|
||||
return result;
|
||||
return "One of: " + String.Join(", ", typeSet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,14 +156,16 @@ public class EnumType
|
||||
|
||||
public class PrimitiveType
|
||||
{
|
||||
public PrimitiveType(string name, string typeName)
|
||||
public PrimitiveType(string name, string typeName, bool customCompare = false)
|
||||
{
|
||||
Name = name;
|
||||
TypeName = typeName;
|
||||
CustomCompare = customCompare;
|
||||
}
|
||||
|
||||
readonly public string Name;
|
||||
readonly public string TypeName;
|
||||
readonly public bool CustomCompare;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -208,8 +205,8 @@ class SchemaDef
|
||||
new PrimitiveType("uint", "UInt32"),
|
||||
new PrimitiveType("long", "Int64"),
|
||||
new PrimitiveType("ulong", "UInt64"),
|
||||
new PrimitiveType("float", "Single"),
|
||||
new PrimitiveType("double", "Double"),
|
||||
new PrimitiveType("float", "Single", customCompare: true),
|
||||
new PrimitiveType("double", "Double", customCompare: true),
|
||||
};
|
||||
|
||||
// These enums supplement those defined by System.Reflection.Primitives.
|
||||
@@ -292,7 +289,8 @@ class SchemaDef
|
||||
new RecordDef(
|
||||
name: "Constant" + primitiveType.TypeName + "Value",
|
||||
members: new MemberDef[] {
|
||||
new MemberDef(name: "Value", typeName: primitiveType.Name)
|
||||
new MemberDef(name: "Value", typeName: primitiveType.Name,
|
||||
flags: primitiveType.CustomCompare ? MemberDefFlags.CustomCompare : 0)
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -326,7 +324,8 @@ class SchemaDef
|
||||
new RecordDef(
|
||||
name: "Constant" + primitiveType.TypeName + "Array",
|
||||
members: new MemberDef[] {
|
||||
new MemberDef(name: "Value", flags: MemberDefFlags.Array, typeName: primitiveType.TypeName)
|
||||
new MemberDef(name: "Value", typeName: primitiveType.TypeName,
|
||||
flags: MemberDefFlags.Array | (primitiveType.CustomCompare ? MemberDefFlags.CustomCompare : 0))
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -782,9 +781,7 @@ class SchemaDef
|
||||
from member in r.Members
|
||||
let memberTypeName = member.TypeName as string
|
||||
where memberTypeName != null &&
|
||||
((member.Flags & MemberDefFlags.Array) != 0 ||
|
||||
(member.Flags & MemberDefFlags.List) != 0 ||
|
||||
(member.Flags & MemberDefFlags.Map) != 0) &&
|
||||
(member.Flags & MemberDefFlags.Collection) != 0 &&
|
||||
!PrimitiveTypes.Any(pt => pt.TypeName == memberTypeName)
|
||||
select memberTypeName
|
||||
).Concat(new[] { "ScopeDefinition" }).Distinct().ToArray();
|
||||
|
||||
@@ -61,14 +61,7 @@ class WriterGen : CsWriter
|
||||
if ((member.Flags & MemberDefFlags.RecordRef) == 0)
|
||||
continue;
|
||||
|
||||
if ((member.Flags & (MemberDefFlags.Map | MemberDefFlags.Sequence)) != 0)
|
||||
{
|
||||
WriteLine($"{member.Name} = visitor.Visit(this, {member.Name});");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteLine($"{member.Name} = visitor.Visit(this, {member.Name});");
|
||||
}
|
||||
WriteLine($"{member.Name} = visitor.Visit(this, {member.Name});");
|
||||
}
|
||||
CloseScope("Visit");
|
||||
|
||||
@@ -94,17 +87,20 @@ class WriterGen : CsWriter
|
||||
|
||||
if ((member.Flags & MemberDefFlags.Sequence) != 0)
|
||||
{
|
||||
WriteLine($"if (!{member.Name}.SequenceEqual(other.{member.Name})) return false;");
|
||||
if ((member.Flags & MemberDefFlags.CustomCompare) != 0)
|
||||
WriteLine($"if (!{member.Name}.SequenceEqual(other.{member.Name}, {member.TypeName}Comparer.Instance)) return false;");
|
||||
else
|
||||
WriteLine($"if (!{member.Name}.SequenceEqual(other.{member.Name})) return false;");
|
||||
}
|
||||
else
|
||||
if ((member.Flags & (MemberDefFlags.List | MemberDefFlags.Map)) != 0)
|
||||
if ((member.Flags & (MemberDefFlags.Map | MemberDefFlags.RecordRef)) != 0)
|
||||
{
|
||||
WriteLine($"if (!Object.Equals({member.Name}, other.{member.Name})) return false;");
|
||||
}
|
||||
else
|
||||
if ((member.Flags & MemberDefFlags.RecordRef) != 0)
|
||||
if ((member.Flags & MemberDefFlags.CustomCompare) != 0)
|
||||
{
|
||||
WriteLine($"if (!Object.Equals({member.Name}, other.{member.Name})) return false;");
|
||||
WriteLine($"if (!CustomComparer.Equals({member.Name}, other.{member.Name})) return false;");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -133,7 +129,7 @@ class WriterGen : CsWriter
|
||||
|
||||
// Compute hash seed using stable hashcode
|
||||
byte[] nameBytes = System.Text.Encoding.UTF8.GetBytes(record.Name);
|
||||
byte[] hashBytes = new System.Security.Cryptography.SHA1Managed().ComputeHash(nameBytes);
|
||||
byte[] hashBytes = System.Security.Cryptography.SHA256.Create().ComputeHash(nameBytes);
|
||||
int hashSeed = System.BitConverter.ToInt32(hashBytes, 0);
|
||||
WriteLine($"int hash = {hashSeed};");
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
edbe004dc24c8e36fd4c4e3d8a77a35239b98821
|
||||
f068f31f9511fd44c80c628a2a5951841d2da89c
|
||||
@@ -144,10 +144,12 @@ namespace Internal.Metadata.NativeFormat
|
||||
|
||||
internal int _value;
|
||||
|
||||
#if DEBUG
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{1} : {0,8:X8}", _value, Enum.GetName(typeof(HandleType), this.HandleType));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public static class NativeFormatReaderExtensions
|
||||
@@ -196,7 +198,7 @@ namespace Internal.Metadata.NativeFormat
|
||||
/// Used as the root entrypoint for metadata, this is where all top-down
|
||||
/// structural walks of metadata must start.
|
||||
/// </summary>
|
||||
public IEnumerable<ScopeDefinitionHandle> ScopeDefinitions
|
||||
public ScopeDefinitionHandleCollection ScopeDefinitions
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
@@ -390,7 +390,7 @@ namespace Internal.NativeFormat
|
||||
}
|
||||
set
|
||||
{
|
||||
Debug.Assert(value >= 0 && value < _reader.Size);
|
||||
Debug.Assert(value < _reader.Size);
|
||||
_offset = value;
|
||||
}
|
||||
}
|
||||
@@ -414,6 +414,13 @@ namespace Internal.NativeFormat
|
||||
return value;
|
||||
}
|
||||
|
||||
public ulong GetUnsignedLong()
|
||||
{
|
||||
ulong value;
|
||||
_offset = _reader.DecodeUnsignedLong(_offset, out value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public int GetSigned()
|
||||
{
|
||||
int value;
|
||||
|
||||
12
external/corert/src/Common/src/Internal/Runtime/CanonTypeKind.cs
vendored
Normal file
12
external/corert/src/Common/src/Internal/Runtime/CanonTypeKind.cs
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Internal.Runtime
|
||||
{
|
||||
public enum CanonTypeKind
|
||||
{
|
||||
NormalCanon,
|
||||
UniversalCanon,
|
||||
}
|
||||
}
|
||||
@@ -13,15 +13,20 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
[McgIntrinsics]
|
||||
public static partial class StartupCodeHelpers
|
||||
{
|
||||
public static IntPtr[] OSModules
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
/// <summary>
|
||||
/// Initial module array allocation used when adding modules dynamically.
|
||||
/// </summary>
|
||||
private const int InitialModuleCount = 8;
|
||||
|
||||
public static TypeManagerHandle[] Modules
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
/// <summary>
|
||||
/// Table of logical modules. Only the first s_moduleCount elements of the array are in use.
|
||||
/// </summary>
|
||||
private static TypeManagerHandle[] s_modules;
|
||||
|
||||
/// <summary>
|
||||
/// Number of valid elements in the logical module table.
|
||||
/// </summary>
|
||||
private static int s_moduleCount;
|
||||
|
||||
[NativeCallable(EntryPoint = "InitializeModules", CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static unsafe void InitializeModules(IntPtr osModule, IntPtr* pModuleHeaders, int count, IntPtr* pClasslibFunctions, int nClasslibFunctions)
|
||||
@@ -36,8 +41,18 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
|
||||
// We are now at a stage where we can use GC statics - publish the list of modules
|
||||
// so that the eager constructors can access it.
|
||||
Modules = modules;
|
||||
OSModules = new IntPtr[] { osModule };
|
||||
if (s_modules != null)
|
||||
{
|
||||
for (int i = 0; i < modules.Length; i++)
|
||||
{
|
||||
AddModule(modules[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s_modules = modules;
|
||||
s_moduleCount = modules.Length;
|
||||
}
|
||||
|
||||
// These two loops look funny but it's important to initialize the global tables before running
|
||||
// the first class constructor to prevent them calling into another uninitialized module
|
||||
@@ -47,6 +62,46 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the number of registered logical modules; optionally copy them into an array.
|
||||
/// </summary>
|
||||
/// <param name="outputModules">Array to copy logical modules to, null = only return logical module count</param>
|
||||
internal static int GetLoadedModules(TypeManagerHandle[] outputModules)
|
||||
{
|
||||
if (outputModules != null)
|
||||
{
|
||||
int copyLimit = (s_moduleCount < outputModules.Length ? s_moduleCount : outputModules.Length);
|
||||
for (int copyIndex = 0; copyIndex < copyLimit; copyIndex++)
|
||||
{
|
||||
outputModules[copyIndex] = s_modules[copyIndex];
|
||||
}
|
||||
}
|
||||
return s_moduleCount;
|
||||
}
|
||||
|
||||
private static void AddModule(TypeManagerHandle newModuleHandle)
|
||||
{
|
||||
if (s_modules == null || s_moduleCount >= s_modules.Length)
|
||||
{
|
||||
// Reallocate logical module array
|
||||
int newModuleLength = 2 * s_moduleCount;
|
||||
if (newModuleLength < InitialModuleCount)
|
||||
{
|
||||
newModuleLength = InitialModuleCount;
|
||||
}
|
||||
|
||||
TypeManagerHandle[] newModules = new TypeManagerHandle[newModuleLength];
|
||||
for (int copyIndex = 0; copyIndex < s_moduleCount; copyIndex++)
|
||||
{
|
||||
newModules[copyIndex] = s_modules[copyIndex];
|
||||
}
|
||||
s_modules = newModules;
|
||||
}
|
||||
|
||||
s_modules[s_moduleCount] = newModuleHandle;
|
||||
s_moduleCount++;
|
||||
}
|
||||
|
||||
private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, IntPtr* pModuleHeaders, int count, IntPtr* pClasslibFunctions, int nClasslibFunctions)
|
||||
{
|
||||
// Count the number of modules so we can allocate an array to hold the TypeManager objects.
|
||||
@@ -86,7 +141,15 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
section->TypeManager = typeManager;
|
||||
section->ModuleIndex = moduleIndex;
|
||||
|
||||
#if CORERT
|
||||
// Initialize Mrt import address tables
|
||||
IntPtr mrtImportSection = RuntimeImports.RhGetModuleSection(typeManager, ReadyToRunSectionType.ImportAddressTables, out length);
|
||||
if (mrtImportSection != IntPtr.Zero)
|
||||
{
|
||||
Debug.Assert(length % IntPtr.Size == 0);
|
||||
InitializeImports(mrtImportSection, length);
|
||||
}
|
||||
|
||||
#if !PROJECTN
|
||||
// Initialize statics if any are present
|
||||
IntPtr staticsSection = RuntimeImports.RhGetModuleSection(typeManager, ReadyToRunSectionType.GCStaticRegion, out length);
|
||||
if (staticsSection != IntPtr.Zero)
|
||||
@@ -141,7 +204,66 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
}
|
||||
}
|
||||
|
||||
#if CORERT
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
unsafe struct MrtExportsV1
|
||||
{
|
||||
public int ExportsVersion; // Currently only version 1 is supported
|
||||
public int SymbolsCount;
|
||||
public int FirstDataItemAsRelativePointer; // Index 1
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
unsafe struct MrtImportsV1
|
||||
{
|
||||
public int ImportVersion; // Currently only version 1 is supported
|
||||
public int ImportCount; // Count of imports
|
||||
public MrtExportsV1** ExportTable; // Pointer to pointer to Export table
|
||||
public IntPtr FirstImportEntry;
|
||||
}
|
||||
|
||||
private static unsafe void InitializeImports(IntPtr importsRegionStart, int length)
|
||||
{
|
||||
IntPtr importsRegionEnd = (IntPtr)((byte*)importsRegionStart + length);
|
||||
|
||||
for (MrtImportsV1** importTablePtr = (MrtImportsV1**)importsRegionStart; importTablePtr < (MrtImportsV1**)importsRegionEnd; importTablePtr++)
|
||||
{
|
||||
MrtImportsV1* importTable = *importTablePtr;
|
||||
if (importTable->ImportVersion != 1)
|
||||
RuntimeExceptionHelpers.FailFast("Mrt Import table version");
|
||||
|
||||
MrtExportsV1* exportTable = *importTable->ExportTable;
|
||||
if (exportTable->ExportsVersion != 1)
|
||||
RuntimeExceptionHelpers.FailFast("Mrt Export table version");
|
||||
|
||||
if (importTable->ImportCount < 0)
|
||||
{
|
||||
RuntimeExceptionHelpers.FailFast("Mrt Import Count");
|
||||
}
|
||||
|
||||
int* firstExport = &exportTable->FirstDataItemAsRelativePointer;
|
||||
IntPtr* firstImport = &importTable->FirstImportEntry;
|
||||
for (int import = 0; import < importTable->ImportCount; import++)
|
||||
{
|
||||
// Get 1 based ordinal from import table
|
||||
int importOrdinal = (int)firstImport[import];
|
||||
|
||||
if ((importOrdinal < 1) || (importOrdinal > exportTable->SymbolsCount))
|
||||
RuntimeExceptionHelpers.FailFast("Mrt import ordinal");
|
||||
|
||||
// Get entry in export table
|
||||
int* exportTableEntry = &firstExport[importOrdinal - 1];
|
||||
|
||||
// Get pointer from export table
|
||||
int relativeOffsetFromExportTableEntry = *exportTableEntry;
|
||||
byte* actualPointer = ((byte*)exportTableEntry) + relativeOffsetFromExportTableEntry + sizeof(int);
|
||||
|
||||
// Update import table with imported value
|
||||
firstImport[import] = new IntPtr(actualPointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !PROJECTN
|
||||
private static unsafe void InitializeStatics(IntPtr gcStaticRegionStart, int length)
|
||||
{
|
||||
IntPtr gcStaticRegionEnd = (IntPtr)((byte*)gcStaticRegionStart + length);
|
||||
@@ -172,7 +294,7 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CORERT
|
||||
#endif // !PROJECTN
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
||||
@@ -43,9 +43,9 @@ namespace Internal.Runtime
|
||||
HasPointersFlag = 0x0020,
|
||||
|
||||
/// <summary>
|
||||
/// This type instance was allocated at runtime (rather than being embedded in a module image).
|
||||
/// Type implements ICastable to allow dynamic resolution of interface casts.
|
||||
/// </summary>
|
||||
RuntimeAllocatedFlag = 0x0040,
|
||||
ICastableFlag = 0x0040,
|
||||
|
||||
/// <summary>
|
||||
/// This type is generic and one or more of its type parameters is co- or contra-variant. This
|
||||
@@ -118,7 +118,7 @@ namespace Internal.Runtime
|
||||
/// <summary>
|
||||
/// Type implements ICastable to allow dynamic resolution of interface casts.
|
||||
/// </summary>
|
||||
ICastableFlag = 0x00000002,
|
||||
UNUSED1 = 0x00000002,
|
||||
|
||||
/// <summary>
|
||||
/// Type is an instantiation of Nullable<T>.
|
||||
@@ -141,11 +141,9 @@ namespace Internal.Runtime
|
||||
HasCctorFlag = 0x0000020,
|
||||
|
||||
/// <summary>
|
||||
/// This EEType has sealed vtable entries (note that this flag is only used for
|
||||
/// dynamically created types because they always have an optional field (hence the
|
||||
/// very explicit flag name).
|
||||
/// Old unused flag
|
||||
/// </summary>
|
||||
IsDynamicTypeWithSealedVTableEntriesFlag = 0x00000040,
|
||||
UNUSED2 = 0x00000040,
|
||||
|
||||
/// <summary>
|
||||
/// This EEType was constructed from a universal canonical template, and has
|
||||
@@ -160,8 +158,6 @@ namespace Internal.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// This EEType has sealed vtable entries
|
||||
/// This is for statically generated types - we need two different flags because
|
||||
/// the sealed vtable entries are reached in different ways in the static and dynamic case
|
||||
/// </summary>
|
||||
HasSealedVTableEntriesFlag = 0x00000200,
|
||||
|
||||
|
||||
@@ -595,7 +595,7 @@ namespace Internal.Runtime
|
||||
{
|
||||
get
|
||||
{
|
||||
return (RareFlags & EETypeRareFlags.ICastableFlag) != 0;
|
||||
return ((_usFlags & (UInt16)EETypeFlags.ICastableFlag) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,16 +609,17 @@ namespace Internal.Runtime
|
||||
Debug.Assert(IsICastable);
|
||||
|
||||
byte* optionalFields = OptionalFieldsPtr;
|
||||
Debug.Assert(optionalFields != null);
|
||||
|
||||
const UInt16 NoSlot = 0xFFFF;
|
||||
UInt16 uiSlot = (UInt16)OptionalFieldsReader.GetInlineField(optionalFields, EETypeOptionalFieldTag.ICastableIsInstSlot, NoSlot);
|
||||
if (uiSlot != NoSlot)
|
||||
if(optionalFields != null)
|
||||
{
|
||||
if (uiSlot < NumVtableSlots)
|
||||
return GetVTableStartAddress()[uiSlot];
|
||||
else
|
||||
return GetSealedVirtualSlot((UInt16)(uiSlot - NumVtableSlots));
|
||||
const UInt16 NoSlot = 0xFFFF;
|
||||
UInt16 uiSlot = (UInt16)OptionalFieldsReader.GetInlineField(optionalFields, EETypeOptionalFieldTag.ICastableIsInstSlot, NoSlot);
|
||||
if (uiSlot != NoSlot)
|
||||
{
|
||||
if (uiSlot < NumVtableSlots)
|
||||
return GetVTableStartAddress()[uiSlot];
|
||||
else
|
||||
return GetSealedVirtualSlot((UInt16)(uiSlot - NumVtableSlots));
|
||||
}
|
||||
}
|
||||
|
||||
EEType* baseType = BaseType;
|
||||
@@ -640,16 +641,17 @@ namespace Internal.Runtime
|
||||
Debug.Assert(IsICastable);
|
||||
|
||||
byte* optionalFields = OptionalFieldsPtr;
|
||||
Debug.Assert(optionalFields != null);
|
||||
|
||||
const UInt16 NoSlot = 0xFFFF;
|
||||
UInt16 uiSlot = (UInt16)OptionalFieldsReader.GetInlineField(optionalFields, EETypeOptionalFieldTag.ICastableGetImplTypeSlot, NoSlot);
|
||||
if (uiSlot != NoSlot)
|
||||
if(optionalFields != null)
|
||||
{
|
||||
if (uiSlot < NumVtableSlots)
|
||||
return GetVTableStartAddress()[uiSlot];
|
||||
else
|
||||
return GetSealedVirtualSlot((UInt16)(uiSlot - NumVtableSlots));
|
||||
const UInt16 NoSlot = 0xFFFF;
|
||||
UInt16 uiSlot = (UInt16)OptionalFieldsReader.GetInlineField(optionalFields, EETypeOptionalFieldTag.ICastableGetImplTypeSlot, NoSlot);
|
||||
if (uiSlot != NoSlot)
|
||||
{
|
||||
if (uiSlot < NumVtableSlots)
|
||||
return GetVTableStartAddress()[uiSlot];
|
||||
else
|
||||
return GetSealedVirtualSlot((UInt16)(uiSlot - NumVtableSlots));
|
||||
}
|
||||
}
|
||||
|
||||
EEType* baseType = BaseType;
|
||||
@@ -746,16 +748,6 @@ namespace Internal.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
// Mark or determine that a type instance was allocated at runtime (currently only used for unification of
|
||||
// generic instantiations). This is sometimes important for memory management or debugging purposes.
|
||||
internal bool IsRuntimeAllocated
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((_usFlags & (UInt16)EETypeFlags.RuntimeAllocatedFlag) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
internal EEInterfaceInfo* InterfaceMap
|
||||
{
|
||||
get
|
||||
@@ -1005,6 +997,7 @@ namespace Internal.Runtime
|
||||
internal IntPtr GetSealedVirtualSlot(UInt16 slotNumber)
|
||||
{
|
||||
Debug.Assert(!IsNullable);
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.HasSealedVTableEntriesFlag) != 0);
|
||||
|
||||
fixed (EEType* pThis = &this)
|
||||
{
|
||||
@@ -1045,10 +1038,6 @@ namespace Internal.Runtime
|
||||
if (!HasOptionalFields)
|
||||
return null;
|
||||
|
||||
// Runtime allocated EETypes don't copy over optional fields. We should be careful to avoid operations
|
||||
// that require them on paths that can handle such cases.
|
||||
Debug.Assert(!IsRuntimeAllocated);
|
||||
|
||||
UInt32 cbOptionalFieldsOffset = GetFieldOffset(EETypeField.ETF_OptionalFieldsPtr);
|
||||
fixed (EEType* pThis = &this)
|
||||
{
|
||||
@@ -1195,7 +1184,7 @@ namespace Internal.Runtime
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // CORERT
|
||||
#endif // EETYPE_TYPE_MANAGER
|
||||
|
||||
internal unsafe EETypeRareFlags RareFlags
|
||||
{
|
||||
@@ -1230,33 +1219,6 @@ namespace Internal.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
internal static UInt32 ComputeValueTypeFieldPaddingFieldValue(UInt32 padding, UInt32 alignment)
|
||||
{
|
||||
// For the default case, return 0
|
||||
if ((padding == 0) && (alignment == IntPtr.Size))
|
||||
return 0;
|
||||
|
||||
UInt32 alignmentLog2 = 0;
|
||||
Debug.Assert(alignment != 0);
|
||||
|
||||
while ((alignment & 1) == 0)
|
||||
{
|
||||
alignmentLog2++;
|
||||
alignment = alignment >> 1;
|
||||
}
|
||||
Debug.Assert(alignment == 1);
|
||||
|
||||
Debug.Assert(ValueTypePaddingMax >= padding);
|
||||
|
||||
alignmentLog2++; // Our alignment values here are adjusted by one to allow for a default of 0
|
||||
|
||||
UInt32 paddingLowBits = padding & ValueTypePaddingLowMask;
|
||||
UInt32 paddingHighBits = ((padding & ~ValueTypePaddingLowMask) >> ValueTypePaddingAlignmentShift) << ValueTypePaddingHighShift;
|
||||
UInt32 alignmentLog2Bits = alignmentLog2 << ValueTypePaddingAlignmentShift;
|
||||
Debug.Assert((alignmentLog2Bits & ~ValueTypePaddingAlignmentMask) == 0);
|
||||
return paddingLowBits | paddingHighBits | alignmentLog2Bits;
|
||||
}
|
||||
|
||||
internal CorElementType CorElementType
|
||||
{
|
||||
get
|
||||
@@ -1315,19 +1277,21 @@ namespace Internal.Runtime
|
||||
if (eField == EETypeField.ETF_SealedVirtualSlots)
|
||||
return cbOffset;
|
||||
|
||||
if (IsNullable || (RareFlags & EETypeRareFlags.IsDynamicTypeWithSealedVTableEntriesFlag) != 0)
|
||||
if (IsNullable)
|
||||
cbOffset += (UInt32)IntPtr.Size;
|
||||
|
||||
EETypeRareFlags rareFlags = RareFlags;
|
||||
|
||||
// in the case of sealed vtable entries on static types, we have a UInt sized relative pointer
|
||||
if ((RareFlags & EETypeRareFlags.HasSealedVTableEntriesFlag) != 0)
|
||||
cbOffset += 4;
|
||||
if ((rareFlags & EETypeRareFlags.HasSealedVTableEntriesFlag) != 0)
|
||||
cbOffset += (IsDynamicType ? (UInt32)IntPtr.Size : 4);
|
||||
|
||||
if (eField == EETypeField.ETF_DynamicDispatchMap)
|
||||
{
|
||||
Debug.Assert(IsDynamicType);
|
||||
return cbOffset;
|
||||
}
|
||||
if ((RareFlags & EETypeRareFlags.HasDynamicallyAllocatedDispatchMapFlag) != 0)
|
||||
if ((rareFlags & EETypeRareFlags.HasDynamicallyAllocatedDispatchMapFlag) != 0)
|
||||
cbOffset += (UInt32)IntPtr.Size;
|
||||
|
||||
if (eField == EETypeField.ETF_GenericDefinition)
|
||||
@@ -1351,7 +1315,7 @@ namespace Internal.Runtime
|
||||
return cbOffset;
|
||||
}
|
||||
|
||||
if ((RareFlags & EETypeRareFlags.HasDynamicModuleFlag) != 0)
|
||||
if ((rareFlags & EETypeRareFlags.HasDynamicModuleFlag) != 0)
|
||||
cbOffset += (UInt32)IntPtr.Size;
|
||||
|
||||
if (eField == EETypeField.ETF_DynamicTemplateType)
|
||||
@@ -1364,26 +1328,26 @@ namespace Internal.Runtime
|
||||
|
||||
if (eField == EETypeField.ETF_DynamicGcStatics)
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithGcStatics) != 0);
|
||||
Debug.Assert((rareFlags & EETypeRareFlags.IsDynamicTypeWithGcStatics) != 0);
|
||||
return cbOffset;
|
||||
}
|
||||
if ((RareFlags & EETypeRareFlags.IsDynamicTypeWithGcStatics) != 0)
|
||||
if ((rareFlags & EETypeRareFlags.IsDynamicTypeWithGcStatics) != 0)
|
||||
cbOffset += (UInt32)IntPtr.Size;
|
||||
|
||||
if (eField == EETypeField.ETF_DynamicNonGcStatics)
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithNonGcStatics) != 0);
|
||||
Debug.Assert((rareFlags & EETypeRareFlags.IsDynamicTypeWithNonGcStatics) != 0);
|
||||
return cbOffset;
|
||||
}
|
||||
if ((RareFlags & EETypeRareFlags.IsDynamicTypeWithNonGcStatics) != 0)
|
||||
if ((rareFlags & EETypeRareFlags.IsDynamicTypeWithNonGcStatics) != 0)
|
||||
cbOffset += (UInt32)IntPtr.Size;
|
||||
|
||||
if (eField == EETypeField.ETF_DynamicThreadStaticOffset)
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithThreadStatics) != 0);
|
||||
Debug.Assert((rareFlags & EETypeRareFlags.IsDynamicTypeWithThreadStatics) != 0);
|
||||
return cbOffset;
|
||||
}
|
||||
if ((RareFlags & EETypeRareFlags.IsDynamicTypeWithThreadStatics) != 0)
|
||||
if ((rareFlags & EETypeRareFlags.IsDynamicTypeWithThreadStatics) != 0)
|
||||
cbOffset += 4;
|
||||
|
||||
Debug.Assert(false, "Unknown EEType field type");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user