Skip to content

Commit 61db2e4

Browse files
committed
runtime: cross-reference _func type better
It takes me several minutes every time I want to find where the linker writes out the _func structures. Add some comments to make this easier. Change-Id: Ic75ce2786ca4b25726babe3c4fe9cd30c85c34e2 Reviewed-on: https://go-review.googlesource.com/34390 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 1716add commit 61db2e4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/cmd/link/internal/ld/pcln.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ func (ctxt *Link) pclntab() {
248248
setaddr(ctxt, ftab, 8+int64(SysArch.PtrSize)+int64(nfunc)*2*int64(SysArch.PtrSize), s)
249249
setuintxx(ctxt, ftab, 8+int64(SysArch.PtrSize)+int64(nfunc)*2*int64(SysArch.PtrSize)+int64(SysArch.PtrSize), uint64(funcstart), int64(SysArch.PtrSize))
250250

251+
// Write runtime._func. Keep in sync with ../../../../runtime/runtime2.go:/_func
252+
// and package debug/gosym.
253+
251254
// fixed size of struct, checked below
252255
off := funcstart
253256

src/runtime/runtime2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ const (
615615

616616
// Layout of in-memory per-function information prepared by linker
617617
// See https://golang.org/s/go12symtab.
618-
// Keep in sync with linker
618+
// Keep in sync with linker (../cmd/link/internal/ld/pcln.go:/pclntab)
619619
// and with package debug/gosym and with symtab.go in package runtime.
620620
type _func struct {
621621
entry uintptr // start pc

0 commit comments

Comments
 (0)