mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/asm: allow def/ref of func ABI when compiling runtime
Function symbols defined and referenced by assembly source currently
always default to ABI0; this patch adds preliminary support for
accepting an explicit ABI selector clause for func defs/refs. This
functionality is currently only enabled when compiling runtime-related
packages (runtime, syscall, reflect). Examples:
TEXT ·DefinedAbi0Symbol<ABI0>(SB),NOSPLIT,$0
RET
TEXT ·DefinedAbi1Symbol<ABIInternal>(SB),NOSPLIT,$0
CALL ·AbiZerolSym<ABI0>(SB)
...
JMP ·AbiInternalSym<ABIInternal>(SB)
RET
Also included is a small change to the code in the compiler that reads
the symabis file emitted by the assembler.
New behavior is currently gated under GOEXPERIMENT=regabi.
Updates #27539, #40724.
Change-Id: Ia22221fe26df0fa002191cfb13bdfaaa38d7df38
Reviewed-on: https://go-review.googlesource.com/c/go/+/260477
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
9499a2e108
commit
dd58239dd2
11 changed files with 207 additions and 65 deletions
|
|
@ -502,6 +502,20 @@ const (
|
|||
ABICount
|
||||
)
|
||||
|
||||
// ParseABI converts from a string representation in 'abistr' to the
|
||||
// corresponding ABI value. Second return value is TRUE if the
|
||||
// abi string is recognized, FALSE otherwise.
|
||||
func ParseABI(abistr string) (ABI, bool) {
|
||||
switch abistr {
|
||||
default:
|
||||
return ABI0, false
|
||||
case "ABI0":
|
||||
return ABI0, true
|
||||
case "ABIInternal":
|
||||
return ABIInternal, true
|
||||
}
|
||||
}
|
||||
|
||||
// Attribute is a set of symbol attributes.
|
||||
type Attribute uint32
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue