On Mon, Mar 7, 2016 at 9:34 AM, Jakub Jelinek <ja...@redhat.com> wrote: > On Sun, Mar 06, 2016 at 10:39:19PM +0100, Uros Bizjak wrote: >> 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? > > LGTM. Have you checked other possibilities of red-zone violations from the > compiler generated stuff? I mean -p, -mfentry, TLS (both GNU and GNU2)? > Signals/interrupts and inline asm is something that the user is responsible > if he enables -mred-zone, but the above probably are not.
Yes. TLS disables redzone via similar mechanism, where ix86_current_function_calls_tls_descriptor flag disables redzone. mcount and __fentry__ are called before redzone is used, so it looks that they work OK. Uros.