Skip to content

Commit 728a9e7

Browse files
committed
ssa: InitAbiTypes check empty abi symbols
1 parent fd6fe51 commit 728a9e7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

internal/build/main_module_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestGenMainModuleExecutable(t *testing.T) {
2929
},
3030
}
3131
pkg := &packages.Package{PkgPath: "example.com/foo", ExportFile: "foo.a"}
32-
mod := genMainModule(ctx, llssa.PkgRuntime, pkg, true, true, false)
32+
mod := genMainModule(ctx, llssa.PkgRuntime, pkg, true, true, true)
3333
if mod.ExportFile != "foo.a-main" {
3434
t.Fatalf("unexpected export file: %s", mod.ExportFile)
3535
}

ssa/abitype.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,9 @@ func (p Package) getAbiTypes(name string) Expr {
552552
}
553553

554554
func (p Package) InitAbiTypes(fname string) Function {
555+
if len(p.Prog.abiSymbol) == 0 {
556+
return nil
557+
}
555558
initFn := p.NewFunc(fname, NoArgsNoRet, InC)
556559
b := initFn.MakeBody(1)
557560
fn := p.rtFunc("initTypes")

0 commit comments

Comments
 (0)