]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj: fix stack barriers in ppc64le shared libs
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Tue, 1 Dec 2015 02:39:41 +0000 (15:39 +1300)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Wed, 2 Dec 2015 21:15:37 +0000 (21:15 +0000)
commit3a1bed82a66c9ff4bf659e5603a8f7c0120435c3
tree7c5fe77f7dd290e4111f39dc577d2b672f0c45ac
parent5a049aa4a6c7e73163375ee00acf413ff4a0a0c4
cmd/internal/obj: fix stack barriers in ppc64le shared libs

runtime.stackBarrier is a strange function: it is only ever "called" by
smashing its address into a LR slot on the stack. Calling it like this
certainly does not adhere to the rule that r12 is set to the global entry point
before calling it and the prologue instrutions that compute r2 from r12 in fact
just corrupt r2, which is bad because the function that stackBarrier returns to
probably uses r2 to access global data.

Fortunately stackBarrier itself does not access any global data and so does not
depend on the value of r2, meaning we can ignore the ABI rules and simply skip
inserting the prologue instructions into this specific function.

Fixes 64bit.go, append.go and fixedbugs/issue13169.go from "cd test; go run
run.go -linkshared".

Change-Id: I606864133a83935899398e2d42edd08a946aab24
Reviewed-on: https://go-review.googlesource.com/17281
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/internal/obj/ppc64/obj9.go