Context: I am adding additional information to runtime.inlinedCall (function start line), which I am plumbing via the FuncInfo. In the linker, this FuncInfo.Valid() got me thinking that (IMO) inlined functions ought to always have a FuncInfo, since they must be Go functions, so I switched the check to panic if it is missing.
This program fails that check:
package main
func main() {
var i int
fn := func() { i++ }
fn()
func() { i++ }()
}
panic: inlined function main.main.func2 missing func info
goroutine 1 [running]:
cmd/link/internal/ld.genInlTreeSym(0xc000510000?, 0x200000010?, {0xc000510000, 0xc000166080, {0xc00016888d, 0x48, 0x48}, {0x1, 0x10, 0x2, ...}}, ...)
/usr/local/google/home/mpratt/src/go/src/cmd/link/internal/ld/pcln.go:172 +0x419
cmd/link/internal/ld.makeInlSyms(0xc000158000, {0xc000a5a000, 0x40c, 0x40c?}, 0x20?)
/usr/local/google/home/mpratt/src/go/src/cmd/link/internal/ld/pcln.go:194 +0x245
cmd/link/internal/ld.(*Link).pclntab(0xc000158000, {0xc000105900?, 0x1?, 0xf?})
/usr/local/google/home/mpratt/src/go/src/cmd/link/internal/ld/pcln.go:786 +0x1e6
cmd/link/internal/ld.Main(_, {0x20, 0x20, 0x1, 0x7, 0x10, 0x0, {0x0, 0x0}, {0x6886dd, ...}, ...})
/usr/local/google/home/mpratt/src/go/src/cmd/link/internal/ld/main.go:328 +0x144a
main.main()
/usr/local/google/home/mpratt/src/go/src/cmd/link/main.go:72 +0xedb
The first closure (fn) has a FuncInfo, but the second does not. This seems like a bug to me, though it probably had low impact before because FuncID would default to FuncID_normal anyways.
I am still digging, but it looks like this is somewhere in the compiler, as func2 never makes it to ssagen.InitLSym, which sets up the FuncInfo.
cc @golang/compiler @cherrymui
Context: I am adding additional information to
runtime.inlinedCall(function start line), which I am plumbing via theFuncInfo. In the linker, thisFuncInfo.Valid()got me thinking that (IMO) inlined functions ought to always have aFuncInfo, since they must be Go functions, so I switched the check to panic if it is missing.This program fails that check:
The first closure (
fn) has aFuncInfo, but the second does not. This seems like a bug to me, though it probably had low impact before becauseFuncIDwould default toFuncID_normalanyways.I am still digging, but it looks like this is somewhere in the compiler, as func2 never makes it to
ssagen.InitLSym, which sets up theFuncInfo.cc @golang/compiler @cherrymui