mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-20 04:19:04 +00:00
main: fix outputting .ll files
This command didn't work anymore since the refactor in #3211. The reason it doesn't work anymore is that before the refactor, the code in the callback wasn't executed for .ll, .bc and .o files but after the refactor it is, which causes a spurious error. This commit fixes this oversight. Example that didn't work anymore and is fixed with this change: tinygo build -o test.ll examples/serial
This commit is contained in:
committed by
Ron Evans
parent
42e4a75319
commit
3dbc4d5210
@@ -168,6 +168,12 @@ func Build(pkgName, outpath string, options *compileopts.Options) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if result.Binary != "" {
|
||||||
|
// If result.Binary is set, it means there is a build output (elf, hex,
|
||||||
|
// etc) that we need to move to the outpath. If it isn't set, it means
|
||||||
|
// the build output was a .ll, .bc or .o file that has already been
|
||||||
|
// written to outpath and so we don't need to do anything.
|
||||||
|
|
||||||
if outpath == "" {
|
if outpath == "" {
|
||||||
if strings.HasSuffix(pkgName, ".go") {
|
if strings.HasSuffix(pkgName, ".go") {
|
||||||
// A Go file was specified directly on the command line.
|
// A Go file was specified directly on the command line.
|
||||||
@@ -200,6 +206,7 @@ func Build(pkgName, outpath string, options *compileopts.Options) error {
|
|||||||
// Check whether file writing was successful.
|
// Check whether file writing was successful.
|
||||||
return outf.Close()
|
return outf.Close()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Move was successful.
|
// Move was successful.
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user