Skip to content

cmd/link: missing arg stack map for functions defined in different package #24419

@cherrymui

Description

@cherrymui

What version of Go are you using (go version)?

tip (86a3389)

Does this issue reproduce with the latest release?

yes

What did you do?

https://play.golang.org/p/4-OeiC68PO4

package main

import "bytes"

func growstack(n int) {
	if n > 0 {
		growstack(n - 1)
	}
}

func main() {
	var x, y []byte
	defer bytes.Compare(x, y) // on AMD64 bytes.Compare is implemented in internal/bytealg
	growstack(10000)          // trigger a stack grow
}
$ go run b.go
runtime: frame bytes.Compare untyped args 824634277936+56
fatal error: missing stackmap

runtime stack:
runtime.throw(0x1073aff, 0x10)
	/Users/cherryyz/src/go-tip/src/runtime/panic.go:598 +0x72
runtime.adjustframe(0x7ffeefbff518, 0x7ffeefbff630, 0x10b3be0)
	/Users/cherryyz/src/go-tip/src/runtime/stack.go:698 +0x578
runtime.tracebackdefers(0xc000000180, 0x1077300, 0x7ffeefbff630)
	/Users/cherryyz/src/go-tip/src/runtime/traceback.go:73 +0xda
runtime.adjustdefers(0xc000000180, 0x7ffeefbff630)
	/Users/cherryyz/src/go-tip/src/runtime/stack.go:733 +0x45
runtime.copystack(0xc000000180, 0x4000, 0x10c5f01)
	/Users/cherryyz/src/go-tip/src/runtime/stack.go:878 +0x17e
runtime.newstack()
	/Users/cherryyz/src/go-tip/src/runtime/stack.go:1063 +0x30e
runtime.morestack()
	/Users/cherryyz/src/go-tip/src/runtime/asm_amd64.s:481 +0x8f

The stack map of bytes.Compare is missing.

The compiler does generate the stack map

$ go build -gcflags -S bytes
...
"".Compare.args_stackmap SRODATA size=12
        0x0000 02 00 00 00 0e 00 00 00 09 00 09 00              ............
...

But it doesn't make into the binary. Apparently the linker dropped it on the floor?

This doesn't seem to be the case for assembly function defined in the same package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions