1
0
mirror of https://github.com/golang/go synced 2024-11-27 04:01:19 -07:00

cmd/internal/obj: add FuncInfo SPWRITE flag for linux/loong64

Co-authored-by: limeidan <limeidan@loongson.cn>
Change-Id: Iac4f706fc9ff1047f1fa02f7178ebfbe38ad1ec3
Reviewed-on: https://go-review.googlesource.com/c/go/+/407754
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: WANG Xuerui <git@xen0n.name>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Guoqi Chen 2022-05-23 08:32:35 +08:00 committed by Gopher Robot
parent a2bca290e7
commit 654b03167f

View File

@ -8,7 +8,7 @@ import (
"cmd/internal/obj"
"cmd/internal/objabi"
"cmd/internal/sys"
"log"
"math"
)
@ -460,6 +460,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
p.From.Reg = REGSP
}
}
if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 {
f := c.cursym.Func()
if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 {
c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE
if ctxt.Debugvlog || !ctxt.IsAsm {
ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p)
if !ctxt.IsAsm {
ctxt.Diag("invalid auto-SPWRITE in non-assembly")
ctxt.DiagFlush()
log.Fatalf("bad SPWRITE")
}
}
}
}
}
}