This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] New -fstack-check implementation
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 29 Mar 2008 15:27:17 -0700
- Subject: Re: [PATCH] New -fstack-check implementation
- References: <firstname.lastname@example.org>
On Sat, Mar 29, 2008 at 11:14:23PM +0100, Eric Botcazou wrote:
> Due to popular demand :-), I'm again submitting the new stack checking
> implementation that we have been using at AdaCore for a few years now.
> Previous submissions:
> But, contrary to the above submissions, this one contains the full set of
> changes (modulo some adjustments in the Ada runtime and *-unwind.h files for
> non-Linux platforms).
> -fstack-check is broken in the 4.x series of compilers in the sense that you
> cannot recover from a stack overflow condition (for example in Ada). It's a
> regression from the 3.x series although there were bugs in that series too.
> Moreover, the original implementation comes with several drawbacks:
> - modified allocation strategy for large objects: they will always be
> allocated dynamically if their size exceeds a fixed threshold.
> - fixed limit on the size of the static frame of functions: when it is
> topped by a particular function, stack checking is not reliable and
> a warning is issued by the compiler.
> - inefficiency: because of both the modified allocation strategy and the
> generic implementation, the performances of the code are unnecessarily
> We are proposing a new implementation that eliminates the aforementioned
> drawbacks. It is based on partial support code in the architecture
> back-ends, modelled on what the Alpha back-end already has because of the
> requirement of the Tru64 ABI. We implemented it on Alpha/Tru64, x86/Linux,
> x86/Solaris, x86/FreeBSD, x86/Windows, x86/VxWorks, x86/LynxOS, x86-64/Linux,
> MIPS/IRIX (n32), SPARC/Solaris, SPARC64/Solaris, PA/HP-UX, PowerPC/AIX,
> PowerPC/VxWorks, PowerPC/LynxOS, IA-64/Linux and IA-64/HP-UX in 3.4.x, 4.1.x
> and 4.3.x based compilers.
> The new mechanism doesn't eliminate the old one, the option -fold-stack-check
> even makes it possible to select the latter when the former is available. On
> architectures without specific support code, -fstack-check is equivalent to
> Tested on i586-suse-linux. Although the changes are mostly orthogonal to the
> rest of the compiler, suggestions are welcome as to what the best procedure
> for integrating this patch in the compiler would be.
Does it work with stack alignment? You can check out stack alignment
We are planning to merge it to mainline at stage 1.