cmd/link: centralize knowledge of size of fixed part of stack

Shared libraries on ppc64le will require a larger minimum stack frame (because
the ABI mandates that the TOC pointer is available at 24(R1)). Part 2b of
preparing for that is to have all the code in the linker that needs to know
this size of this call a function to find out.

Change-Id: I246363840096db22e44beabbe38b61d60c1f31ad
Reviewed-on: https://go-review.googlesource.com/15675
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2015-10-12 12:19:20 +13:00
parent c23c8d58d6
commit d66f6c2c86
3 changed files with 16 additions and 9 deletions

View file

@ -1518,7 +1518,7 @@ var morestack *LSym
// allow stack checks here.
func haslinkregister() bool {
return Thearch.Thechar == '5' || Thearch.Thechar == '9' || Thearch.Thechar == '7'
return Ctxt.FixedFrameSize() != 0
}
func callsize() int {
@ -1626,10 +1626,7 @@ func stkcheck(up *Chain, depth int) int {
return 0
}
// Raise limit to allow frame.
limit = int(obj.StackLimit + s.Locals)
if haslinkregister() {
limit += Thearch.Regsize
}
limit = int(obj.StackLimit+s.Locals) + int(Ctxt.FixedFrameSize())
}
// Walk through sp adjustments in function, consuming relocs.