aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/link.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2022-04-18 13:39:52 -0400
committerAustin Clements <austin@google.com>2022-04-19 15:59:19 +0000
commit8af7fac5a1d2b3881f8f435d77adfcef6a07bedc (patch)
tree65ae1a75c65374cf8b4ab88920b5069d2a0e3f1e /src/cmd/internal/obj/link.go
parentcaa46312eeca1275ce22ecf8985ca31ef8de7883 (diff)
downloadgo-8af7fac5a1d2b3881f8f435d77adfcef6a07bedc.tar.xz
internal/sys: add LR and fixed frame size to sys.Arch
Storing this information in the Arch eliminates some code duplication between the compiler and linker. This information is entirely determined by the Arch, so the current approach of attaching it to an entire Ctxt is a little silly. This will also make it easier to use this information from tests. The next CL will be a rote refactoring to eliminate the Ctxt.FixedFrameSize methods. Change-Id: I315c524fa66a0ea99f63ae5a2a6fdc367d843bad Reviewed-on: https://go-review.googlesource.com/c/go/+/400818 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal/obj/link.go')
-rw-r--r--src/cmd/internal/obj/link.go11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go
index dc06a3aa11..12a4c94e24 100644
--- a/src/cmd/internal/obj/link.go
+++ b/src/cmd/internal/obj/link.go
@@ -989,16 +989,7 @@ func (fi *FuncInfo) UnspillRegisterArgs(last *Prog, pa ProgAlloc) *Prog {
// on the stack in the function prologue and so always have a pointer between
// the hardware stack pointer and the local variable area.
func (ctxt *Link) FixedFrameSize() int64 {
- switch ctxt.Arch.Family {
- case sys.AMD64, sys.I386, sys.Wasm:
- return 0
- case sys.PPC64:
- // PIC code on ppc64le requires 32 bytes of stack, and it's easier to
- // just use that much stack always on ppc64x.
- return int64(4 * ctxt.Arch.PtrSize)
- default:
- return int64(ctxt.Arch.PtrSize)
- }
+ return ctxt.Arch.FixedFrameSize
}
// LinkArch is the definition of a single architecture.