Update LLVM to 6.0.1 and WebAssembly target refactoring (#1788)

* wasm updates: removed binaryen, simplified morecore and launcher.js
* Updated LLVM toolchain to 6.0.1
This commit is contained in:
Sergey Bogolepov
2018-08-14 21:08:45 +03:00
committed by GitHub
parent 061ea53853
commit 5a66f91da5
36 changed files with 1157 additions and 1108 deletions
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.backend.konan
import org.jetbrains.kotlin.konan.KonanExternalToolFailure
import org.jetbrains.kotlin.konan.exec.Command
import org.jetbrains.kotlin.konan.file.File
import org.jetbrains.kotlin.konan.file.createTempFile
import org.jetbrains.kotlin.konan.target.*
typealias BitcodeFile = String
@@ -90,8 +89,8 @@ internal class LinkStage(val context: Context, val phaser: PhaseManager) {
val configurables = platform.configurables as WasmConfigurables
val combinedBc = temporary("combined", ".bc")
// TODO: use -only-needed for the stdlib
hostLlvmTool("llvm-link", *bitcodeFiles.toTypedArray(), "-o", combinedBc)
val optFlags = (configurables.optFlags + when {
optimize -> configurables.optOptFlags
debug -> configurables.optDebugFlags
@@ -99,24 +98,16 @@ internal class LinkStage(val context: Context, val phaser: PhaseManager) {
} + llvmProfilingFlags()).toTypedArray()
val optimizedBc = temporary("optimized", ".bc")
hostLlvmTool("opt", combinedBc, "-o", optimizedBc, *optFlags)
val llcFlags = (configurables.llcFlags + when {
optimize -> configurables.llcOptFlags
debug -> configurables.llcDebugFlags
else -> configurables.llcNooptFlags
} + llvmProfilingFlags()).toTypedArray()
val combinedS = temporary("combined", ".s")
targetTool("llc", optimizedBc, "-o", combinedS, *llcFlags)
val s2wasmFlags = configurables.s2wasmFlags.toTypedArray()
val combinedWast = temporary("combined", ".wast")
targetTool("s2wasm", combinedS, "-o", combinedWast, *s2wasmFlags)
val combinedWasm = temporary("combined", ".wasm")
val combinedSmap = temporary("combined", ".smap")
targetTool("wasm-as", combinedWast, "-o", combinedWasm, "-g", "-s", combinedSmap)
return combinedWasm
val combinedO = temporary("combined", ".o")
hostLlvmTool("llc", optimizedBc, "-o", combinedO, *llcFlags, "-filetype=obj")
val linkedWasm = temporary("linked", ".wasm")
hostLlvmTool("wasm-ld", combinedO, "-o", linkedWasm, *configurables.lldFlags.toTypedArray())
return linkedWasm
}
private fun llvmLinkAndLlc(bitcodeFiles: List<BitcodeFile>): String {
+1
View File
@@ -32,6 +32,7 @@ linkerOpts.linux= -fPIC \
-lrt -ldl -lpthread -lz -lm
linkerOpts.mingw = -lole32 -luuid -static-libgcc -static-libstdc++ \
-Wl,-Bstatic -lz \
-Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive,-Bdynamic
# It looks like mingw port compiled without LLVM_ENABLE_DUMP