From f05b378b896088b34e0744e210bf0d81ef206e8e Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Fri, 31 Jul 2020 01:24:06 +0200 Subject: [PATCH] compiler: add proper parameter names to runtime.initAll This is required by the coroutines pass, otherwise it will panic. It checks for the proper parameter names to make sure the function is not exported. In this case, the runtime.initAll function wasn't exported but simply didn't have the correct parameter names so the check triggered even though it shouldn't. --- compiler/compiler.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/compiler.go b/compiler/compiler.go index 20ac339f..7270dd2f 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -293,6 +293,8 @@ func Compile(pkgName string, machine llvm.TargetMachine, config *compileopts.Con pos := c.ir.Program.Fset.Position(initFn.Pos()) irbuilder.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), difunc, llvm.Metadata{}) } + initFn.LLVMFn.Param(0).SetName("context") + initFn.LLVMFn.Param(1).SetName("parentHandle") block := c.ctx.AddBasicBlock(initFn.LLVMFn, "entry") irbuilder.SetInsertPointAtEnd(block) for _, fn := range initFuncs {