Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Scheuer <info@creatix.dk>2018-02-04 03:47:18 +0300
committerMorgan Brown <morganbr@users.noreply.github.com>2018-02-04 03:47:18 +0300
commitf19daaae780f2b0b2675792a8b0ef071dc1e58ff (patch)
tree638ec60b9f3f2c538b9288a1f8ab32f8dc8f0048 /src/ILCompiler.WebAssembly
parent2aaccdfc08dc2217bbc1777d4c98dda2a4867fb7 (diff)
Add support for building wasm on OSX and Ubuntu 16 (#5297)
* Enable wasm building on OSX. Upgrade libLLVM to 4.0.0 and LLVMSharp to 5.0.0 LLVM upgrade: Fix 'Use still stuck around after Def is destroyed' of the deleted basic blocks Add wasm support in runtest.sh Remove HelloWasm.csproj reference to .ilproj on non-windows OS because of dependency on ilasm Fix LinkNative target to execute correct commands for Unix wasm builds. Added support for building on Ubuntu 16.04.3 Update documentation on how to build WebAssembly.
Diffstat (limited to 'src/ILCompiler.WebAssembly')
-rw-r--r--src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs5
-rw-r--r--src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs4
-rw-r--r--src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilation.cs1
-rw-r--r--src/ILCompiler.WebAssembly/src/ILCompiler.WebAssembly.csproj23
-rw-r--r--src/ILCompiler.WebAssembly/src/libLLVMdep.depproj22
5 files changed, 44 insertions, 11 deletions
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
index a24c1efe9..1ac1869c3 100644
--- a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
+++ b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
@@ -116,15 +116,18 @@ namespace Internal.IL
}
catch
{
+ LLVMBasicBlockRef trapBlock = LLVM.AppendBasicBlock(_llvmFunction, "Trap");
+
// Change the function body to trap
foreach (BasicBlock block in _basicBlocks)
{
if (block != null && block.Block.Pointer != IntPtr.Zero)
{
+ LLVM.ReplaceAllUsesWith(block.Block, trapBlock);
LLVM.DeleteBasicBlock(block.Block);
}
}
- LLVMBasicBlockRef trapBlock = LLVM.AppendBasicBlock(_llvmFunction, "Trap");
+
LLVM.PositionBuilderAtEnd(_builder, trapBlock);
EmitTrapCall();
LLVM.BuildRetVoid(_builder);
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs
index 9cb9b26d5..8808a2e02 100644
--- a/src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs
+++ b/src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs
@@ -183,9 +183,9 @@ namespace ILCompiler.DependencyAnalysis
EmitNativeMain();
LLVM.WriteBitcodeToFile(Module, _objectFilePath);
#if DEBUG
- LLVM.PrintModuleToFile(Module, Path.ChangeExtension(_objectFilePath, ".txt"), out IntPtr unused2);
+ LLVM.PrintModuleToFile(Module, Path.ChangeExtension(_objectFilePath, ".txt"), out string unused2);
#endif //DEBUG
- LLVM.VerifyModule(Module, LLVMVerifierFailureAction.LLVMAbortProcessAction, out IntPtr unused);
+ LLVM.VerifyModule(Module, LLVMVerifierFailureAction.LLVMAbortProcessAction, out string unused);
//throw new NotImplementedException(); // This function isn't complete
}
diff --git a/src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilation.cs b/src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilation.cs
index 94b35a3f4..5a32248a7 100644
--- a/src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilation.cs
+++ b/src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilation.cs
@@ -26,7 +26,6 @@ namespace ILCompiler
: base(dependencyGraph, nodeFactory, GetCompilationRoots(roots, nodeFactory), null, null, logger)
{
NodeFactory = nodeFactory;
- LLVM.LoadLibrary_libLLVM("./libLLVM-x64.dll");
Module = LLVM.ModuleCreateWithName("netscripten");
LLVM.SetTarget(Module, "asmjs-unknown-emscripten");
Options = options;
diff --git a/src/ILCompiler.WebAssembly/src/ILCompiler.WebAssembly.csproj b/src/ILCompiler.WebAssembly/src/ILCompiler.WebAssembly.csproj
index cd88923c7..2eb7e3eeb 100644
--- a/src/ILCompiler.WebAssembly/src/ILCompiler.WebAssembly.csproj
+++ b/src/ILCompiler.WebAssembly/src/ILCompiler.WebAssembly.csproj
@@ -10,15 +10,18 @@
<NoWarn>8002</NoWarn>
<OutputPath>$(BaseOutputPath)$(OSPlatformConfig)/tools</OutputPath>
</PropertyGroup>
+
<ItemGroup>
<PackageReference Include="LLVMSharp">
- <Version>3.9.1-rc3</Version>
- </PackageReference>
- <PackageReference Include="libLLVM">
- <Version>3.9.1</Version>
- </PackageReference>
+ <Version>5.0.0</Version>
+ </PackageReference>
</ItemGroup>
+
<ItemGroup Condition="'$(IsProjectNLibrary)' != 'true'">
+ <ProjectReference Include="libLLVMdep.depproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
+ </ProjectReference>
<ProjectReference Include="..\..\ILCompiler.DependencyAnalysisFramework\src\ILCompiler.DependencyAnalysisFramework.csproj" />
<ProjectReference Include="..\..\ILCompiler.MetadataTransform\src\ILCompiler.MetadataTransform.csproj" />
<ProjectReference Include="..\..\ILCompiler.MetadataWriter\src\ILCompiler.MetadataWriter.csproj" />
@@ -53,10 +56,16 @@
<Compile Include="CodeGen\ILToWebAssemblyImporter.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="..\..\..\packages\llvmsharp\3.9.1-rc3\lib\netstandard1.1\LLVMSharp.dll">
+ <Content Include="..\..\..\packages\llvmsharp\5.0.0\lib\netstandard1.1\LLVMSharp.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="..\..\..\packages\libllvm\3.9.1\content\libLLVM-x64.dll">
+ <Content Include="..\..\..\packages\libllvm\4.0.0\runtimes\osx\native\libLLVM.dylib" Condition="'$(HostOS)' == 'OSX'">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\packages\libllvm\4.0.0\runtimes\linux-x64\native\libLLVM.so" Condition="'$(HostOS)' == 'Linux'">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\packages\libllvm\4.0.0\runtimes\win-x64\native\libLLVM.dll" Condition="'$(HostOS)' == 'Windows_NT'">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
diff --git a/src/ILCompiler.WebAssembly/src/libLLVMdep.depproj b/src/ILCompiler.WebAssembly/src/libLLVMdep.depproj
new file mode 100644
index 000000000..5e0a14f61
--- /dev/null
+++ b/src/ILCompiler.WebAssembly/src/libLLVMdep.depproj
@@ -0,0 +1,22 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+
+ <PropertyGroup>
+ <OutputPath>$(BaseOutputPath)$(OSPlatformConfig)/tools</OutputPath>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <TargetFramework>netstandard1.3</TargetFramework>
+ <RuntimeIdentifiers>$(NuPkgRid)</RuntimeIdentifiers>
+ <RuntimeIdentifiers Condition="$(NuPkgRid.StartsWith('ubuntu.'))">ubuntu.14.04-x64</RuntimeIdentifiers>
+ <RidSpecificAssets>true</RidSpecificAssets>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="libLLVM">
+ <Version>4.0.0</Version>
+ </PackageReference>
+ </ItemGroup>
+
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>