This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386]: Fix PR 70024, wrong code with -fPIC and -mred-zone on i686
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Mon, 7 Mar 2016 09:34:07 +0100
- Subject: Re: [PATCH, i386]: Fix PR 70024, wrong code with -fPIC and -mred-zone on i686
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4bBTuGXB5eM7nC+wdgRA9pre+ebL8KNCQLAwqM6kkzDDA at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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.
Jakub