aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/gc/main.go
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2020-10-07 12:31:05 -0400
committerThan McIntosh <thanm@google.com>2020-10-19 11:25:35 +0000
commitdd58239dd20f7002b3e219a477514b91dd0cc5fc (patch)
treecec7a6682be941a73be7f810f38463ba3a4f9fb3 /src/cmd/compile/internal/gc/main.go
parent9499a2e10840e3878bff06e7f9a3bdaa56c5ca45 (diff)
downloadgo-dd58239dd20f7002b3e219a477514b91dd0cc5fc.tar.gz
go-dd58239dd20f7002b3e219a477514b91dd0cc5fc.zip
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>
Diffstat (limited to 'src/cmd/compile/internal/gc/main.go')
-rw-r--r--src/cmd/compile/internal/gc/main.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go
index e4e4ce72fd..2fffe625cd 100644
--- a/src/cmd/compile/internal/gc/main.go
+++ b/src/cmd/compile/internal/gc/main.go
@@ -968,9 +968,10 @@ func readSymABIs(file, myimportpath string) {
if len(parts) != 3 {
log.Fatalf(`%s:%d: invalid symabi: syntax is "%s sym abi"`, file, lineNum, parts[0])
}
- sym, abi := parts[1], parts[2]
- if abi != "ABI0" { // Only supported external ABI right now
- log.Fatalf(`%s:%d: invalid symabi: unknown abi "%s"`, file, lineNum, abi)
+ sym, abistr := parts[1], parts[2]
+ abi, valid := obj.ParseABI(abistr)
+ if !valid {
+ log.Fatalf(`%s:%d: invalid symabi: unknown abi "%s"`, file, lineNum, abistr)
}
// If the symbol is already prefixed with
@@ -983,9 +984,9 @@ func readSymABIs(file, myimportpath string) {
// Record for later.
if parts[0] == "def" {
- symabiDefs[sym] = obj.ABI0
+ symabiDefs[sym] = abi
} else {
- symabiRefs[sym] = obj.ABI0
+ symabiRefs[sym] = abi
}
default:
log.Fatalf(`%s:%d: invalid symabi type "%s"`, file, lineNum, parts[0])