This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Porting libsanitizer to aarch64
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>
- Cc: Christophe Lyon <christophe dot lyon at linaro dot org>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Wed, 22 May 2013 09:43:41 +0200
- Subject: Re: Porting libsanitizer to aarch64
- References: <CAKdteOa-UDeo5zDwCeYSydu0K-WqmTjPgj3sYUpKrc0YPoncCg at mail dot gmail dot com> <20130521154426 dot GA1377 at tucnak dot redhat dot com> <CAGQ9bdyXCWDt0FF4+F5_4LbW7XcZACczKfHhr28nnwk96rf5Mw at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, May 22, 2013 at 11:25:18AM +0400, Konstantin Serebryany wrote:
> > > Then arises a runtime problem: aarch64's frame grows upward which is
> > > not supported: how long would it take to develop this support if at
> > > all possible?
> >
> > Better do what all other targets that want to support -fstack-protector*
> > or -fsanitize=address, use frame grows downward if flag_stack_protector
> > || flag_asan. You wouldn't have -fstack-protector* support otherwise
> > either.
> >
>
> I would second that.
> Supporting upward-growing stack will introduce quite a bit of disruption in
> the run-time library and
> in both compiler modules (GCC and LLVM).
Frame grows upward isn't necessarily stack grows upward, the former is just
mostly compiler internal decision in which direction to allocate automatic
variables and later on spill slots, the latter is an ABI matter and AFAIK
only PA and stormy16 goes against all other architectures on that.
That said, at least for stack protector frame grows downward is a must,
because you don't want array overflows to clobber spill slots, thus spill
slots must go below arrays which are laid out earlier.
Changing frame grows upward into frame grows downward shouldn't be that
hard, see e.g. rs6000 port, where
#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0 || flag_asan != 0)
and grep the port where it uses FRAME_GROWS_DOWNWARD.
Basically you need to tweak initial elimination offset computation for it,
and that might be it, or perhaps one or two extra spots.
Jakub