On Sun, Mar 6, 2016 at 1:39 PM, Uros Bizjak <ubiz...@gmail.com> wrote: > Hello! > > Attached patch prevents red-zone with -fPIC for leaf functions on > i686. The idea is to mark when set_got is expanded as a call to a pc > thunk, and use this flag to prevent red-zone in the current function. > > Please note that using red-zone with i686 violates all known ABIs, but > some future ABI can trip on this limitation. The failure mode is quite > tricky, so IMO it warrants a couple of lines as a safety net. > > The testcase is not suitable for the testsuite (it uses -mred-zone for > i686 target), but I have checked that the testcase works OK when > compiled with the patched compiler even when -mred-zone is used > together with -fPIC. > > Jakub, HJ - what do you think? > > 2016-03-01 Uros Bizjak <ubiz...@gmail.com> > > PR target/70064 > * config/i386/i386.h (machine_function): Add > pc_thunk_call_expanded flag. > (ix86_pc_thunk_call_expanded): New define. > * config/i386/i386.md (set_got, set_got_labelled): New expanders. > (*set_got): Rename insn pattern from set_got. > (*set_got_labelled): Rename inst pattern from set_got_labelled. > * config/i386/i386.c (ix86_compute_frame_layout): Use > ix86_pc_thunk_call_expanded to prevent red-zone. > > The patch is bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. >
I think red zone should only be allowed for x86-64 psABI. -- H.J.