backend: Place *.bc.o files in a temporary directory for llvmLto()

This commit is contained in:
Ilya Matveev
2017-01-25 17:31:44 +03:00
committed by ilmat192
parent 59e093c8e4
commit b7a78deafa
@@ -147,8 +147,9 @@ internal class LinkStage(val context: Context) {
val libraries = context.config.libraries
fun llvmLto(files: List<BitcodeFile>): ObjectFile {
// TODO: Make it a temporary file.
val combined = "combined.o"
val tmpCombined = File.createTempFile("combined", ".o")
tmpCombined.deleteOnExit()
val combined = tmpCombined.absolutePath
val tool = distribution.llvmLto
val command = mutableListOf(tool, "-o", combined)
@@ -165,6 +166,7 @@ internal class LinkStage(val context: Context) {
val tmpObjectFile = File.createTempFile(File(file).name, ".o")
tmpObjectFile.deleteOnExit()
val objectFile = tmpObjectFile.absolutePath
val tool = distribution.llvmLlc
val command = listOf(distribution.llvmLlc, "-o", objectFile, "-filetype=obj") +
properties.propertyList("llvmLlcFlags.$suffix") + listOf(file)