]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: generate args_stackmap for ABI0 assembly func regardless of linkname
authorCherry Mui <cherryyz@google.com>
Fri, 24 May 2024 19:00:56 +0000 (15:00 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 7 Jun 2024 15:22:22 +0000 (15:22 +0000)
commit0b72631a8229bcb86913f4855e217ddedbfbbb46
tree5d8e6d0913d276b550a0d7480567076d91ea5114
parent98529a8e7cf1cc0b561f26a4bd3ddf8f6dbd2f8a
cmd/compile: generate args_stackmap for ABI0 assembly func regardless of linkname

Currently, the compiler generates the argument stack map based on
the function signature for bodyless function declarations, if it
is not linknamed. The assumption is that linknamed function is
provided by (Go code in) another package, so its args stack map
will be generated when compiling that package.

Now we have linknames added to declarations of assembly functions,
to signal that this function is accessed externally. Examples
include runtime.morestack_noctxt, math/big.addVV. In the current
implementation the compiler does not generate its args stack map.
That causes the assembly function's args stack map missing.
Instead, change it to generate the stack map if it is a
declaration of an ABI0 function, which can only be defined in
assembly and passed to the compiler through the -symabis flag. The
stack map generation currently only works with ABI0 layout anyway,
so we don't need to handle ABIInternal assembly functions.

Change-Id: Ic9da3b4854c604e64ed01584da3865994f5b95b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/587928
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/gc/compile.go
src/cmd/compile/internal/liveness/plive.go
test/linknameasm.dir/a_amd64.s [new file with mode: 0644]
test/linknameasm.dir/x.go [new file with mode: 0644]
test/linknameasm.go [new file with mode: 0644]