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
Этот коммит содержится в:
родитель
42e4a75319
коммит
3dbc4d5210
1 изменённых файлов: 34 добавлений и 27 удалений
7
main.go
7
main.go
|
@ -168,6 +168,12 @@ func Build(pkgName, outpath string, options *compileopts.Options) error {
|
|||
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 strings.HasSuffix(pkgName, ".go") {
|
||||
// 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.
|
||||
return outf.Close()
|
||||
}
|
||||
}
|
||||
|
||||
// Move was successful.
|
||||
return nil
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче