all: move bootstrapping IR to Go runtime

This has the benefit of not requiring a 'runtime' IR file, so that
complete relocatable files can be built without requiring input IR.
This makes the compiler a lot easier to use without the Makefile.

Code size is not affected.
This commit is contained in:
Ayke van Laethem
2018-09-04 20:39:22 +02:00
parent 0746d61639
commit 83ad0b6137
7 changed files with 70 additions and 49 deletions
+9 -7
View File
@@ -30,13 +30,15 @@ func Compile(pkgName, runtimePath, outpath, target string, printIR, dumpSSA bool
}
// Add C/LLVM runtime.
runtime, err := llvm.ParseBitcodeFile(runtimePath)
if err != nil {
return err
}
err = c.LinkModule(runtime)
if err != nil {
return err
if runtimePath != "" {
runtime, err := llvm.ParseBitcodeFile(runtimePath)
if err != nil {
return err
}
err = c.LinkModule(runtime)
if err != nil {
return err
}
}
// Compile Go code to IR.