What is "pclntab's format"

235 views
Skip to first unread message

Benjamin Yim

unread,
Aug 21, 2022, 6:37:10 AM8/21/22
to golang-nuts
in my local run panic ex:
runtime: pcHeader: magic= 0xfffffff0 pad1= 0 pad2= 0 minLC= 1 ptrSize= 8 pcHeader.textStart= 0x1001000 text= 0x1001000 pluginpath=
fatal error: invalid function symbol table
runtime: panic before malloc heap initialized

runtime stack:
runtime.throw({0x106f352?, 0xf4d7000?})
        /Users/benjamin/Documents/github.com/go/src/runtime/panic.go:1047 +0x5d fp=0x7ff7bfeff7a8 sp=0x7ff7bfeff778 pc=0x103195d
runtime.moduledataverify1(0x7ff700000002?)
        /Users/benjamin/Documents/github.com/go/src/runtime/symtab.go:607 +0x816 fp=0x7ff7bfeff8a8 sp=0x7ff7bfeff7a8 pc=0x104d256
runtime.moduledataverify()
        /Users/benjamin/Documents/github.com/go/src/runtime/symtab.go:593 +0x27 fp=0x7ff7bfeff8c8 sp=0x7ff7bfeff8a8 pc=0x104ca07
runtime.schedinit()
        /Users/benjamin/Documents/github.com/go/src/runtime/proc.go:714 +0x14a fp=0x7ff7bfeff910 sp=0x7ff7bfeff8c8 pc=0x103544a
runtime.rt0_go()
        /Users/benjamin/Documents/github.com/go/src/runtime/asm_amd64.s:350 +0x11e fp=0x7ff7bfeff918 sp=0x7ff7bfeff910 pc=0x105b91e

the source frome:
 func moduledataverify1(datap *moduledata) {
    // Check that the pclntab's format is valid.
    // 检查pclntab的格式是否有效。
    hdr := datap.pcHeader
    if hdr.magic != 0xfffffff1 || hdr.pad1 != 0 || hdr.pad2 != 0 ||
        hdr.minLC != sys.PCQuantum || hdr.ptrSize != goarch.PtrSize || hdr.textStart != datap.text {
        println("runtime: pcHeader: magic=", hex(hdr.magic), "pad1=", hdr.pad1, "pad2=", hdr.pad2,
            "minLC=", hdr.minLC, "ptrSize=", hdr.ptrSize, "pcHeader.textStart=", hex(hdr.textStart),
            "text=", hex(datap.text), "pluginpath=", datap.pluginpath)
        throw("invalid function symbol table")
    }

Not really understand the meaning of this magic number modification, can you briefly explain?
When I delete the verification does not have any effect



local config:
MacBook Pro (15-inch, 2016)
Intel Core i7

Ian Lance Taylor

unread,
Aug 21, 2022, 11:36:48 AM8/21/22
to Benjamin Yim, golang-nuts
Is this a repeatable problem? If not, then my first guess would be
that your binary was corrupted somehow.

The value of the magic number is not important. It is only checked to
make sure that there was no file corruption or linker confusion.

Ian
Reply all
Reply to author
Forward
0 new messages