aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2019-08-20 17:39:09 -0400
committerAustin Clements <austin@google.com>2021-11-05 00:52:06 +0000
commit3839b6001470f7bc73c9a80f6458f7111ae3d9cc (patch)
treeb7689db44468d159b06f7618dc0a895903e9a032 /src/cmd/asm
parent1c4cfd80109da81a2c6cf49b4d3ff49c45af8e03 (diff)
downloadgo-3839b6001470f7bc73c9a80f6458f7111ae3d9cc.tar.gz
go-3839b6001470f7bc73c9a80f6458f7111ae3d9cc.zip
cmd/{asm,compile,internal/obj}: add "maymorestack" support
This adds a debugging hook for optionally calling a "maymorestack" function in the prologue of any function that might call morestack (whether it does at run time or not). The maymorestack function will let us improve lock checking and add debugging modes that stress function preemption and stack growth. Passes toolstash-check -all (except on js/wasm, where toolstash appears to be broken) Fixes #48297. Change-Id: I27197947482b329af75dafb9971fc0d3a52eaf31 Reviewed-on: https://go-review.googlesource.com/c/go/+/359795 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/flags/flags.go5
-rw-r--r--src/cmd/asm/main.go1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/asm/internal/flags/flags.go b/src/cmd/asm/internal/flags/flags.go
index dd947c7b5b..607166e664 100644
--- a/src/cmd/asm/internal/flags/flags.go
+++ b/src/cmd/asm/internal/flags/flags.go
@@ -28,6 +28,10 @@ var (
CompilingRuntime = flag.Bool("compiling-runtime", false, "source to be compiled is part of the Go runtime")
)
+var DebugFlags struct {
+ MayMoreStack string `help:"call named function before all stack growth checks"`
+}
+
var (
D MultiFlag
I MultiFlag
@@ -39,6 +43,7 @@ func init() {
flag.Var(&D, "D", "predefined symbol with optional simple value -D=identifier=value; can be set multiple times")
flag.Var(&I, "I", "include directory; can be set multiple times")
flag.BoolVar(&DebugV, "v", false, "print debug output")
+ flag.Var(objabi.NewDebugFlag(&DebugFlags, nil), "d", "enable debugging settings; try -d help")
objabi.AddVersionFlag() // -V
objabi.Flagcount("S", "print assembly and machine code", &PrintOut)
}
diff --git a/src/cmd/asm/main.go b/src/cmd/asm/main.go
index 3e32aa3d7d..3683527f5b 100644
--- a/src/cmd/asm/main.go
+++ b/src/cmd/asm/main.go
@@ -42,6 +42,7 @@ func main() {
ctxt.Flag_dynlink = *flags.Dynlink
ctxt.Flag_linkshared = *flags.Linkshared
ctxt.Flag_shared = *flags.Shared || *flags.Dynlink
+ ctxt.Flag_maymorestack = flags.DebugFlags.MayMoreStack
ctxt.IsAsm = true
ctxt.Pkgpath = *flags.Importpath
switch *flags.Spectre {