• Michael Hudson-Doyle's avatar
    cmd/internal/obj: fix stack barriers in ppc64le shared libs · 3a1bed82
    Michael Hudson-Doyle authored
    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/17281Reviewed-by: 's avatarAustin Clements <austin@google.com>
    3a1bed82
obj9.go 26.1 KB