On Tue, Feb 3, 2015 at 8:57 AM, Alan Modra <amo...@gmail.com> wrote: > This fixes a large number of Go testsuite failures on powerpc64 ELFv1, > caused by loading r11 from a function descriptor and thus trashing the > value set up from CALL_EXPR_STATIC_CHAIN. So don't load r11 if it > already contains a useful value. Whether r11 has been set is found > directly by examining rtl. Conveniently, looking at the previous > sequence on the rtl sequence stack lets us skip over anything already > emitted for GEN_CALL, and the static chain assignment, if present, > happens to be the last insn of that sequence (calls.c emit_call_1 > stuff). > > Alternative approaches considered: > 1) Turn off TARGET_POINTERS_TO_NESTED_FUNCTIONS for Go in > rs6000_option_override_internal, similar to the hack posted in the > PR. That fixes Go, but leaves __builtin_call_with_static_chain > broken. > 2) Turn off TARGET_POINTERS_TO_NESTED_FUNCTIONS everywhere. This > means rewriting rs6000_trampoline_init to not put the static chain > value into the trampoline function descriptor, and possibly other > code. Might also affect user code. > 3) Arrange to have a new flag set in the third arg of rs6000_call_aix. > This isn't simple due to none of INIT_CUMULATIVE_ARGS or various > targetm.calls hooks having access to the call expression. We don't > have a function decl either, since this is an indirect call. > > Bootstrapped and regression tested powerpc64-linux. OK to apply? > > PR target/64876 > * config/rs6000/rs6000.c (chain_already_loaded): New function. > (rs6000_call_aix): Use it.
Okay with Jakub's suggested change. Thanks, David