This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [asan] Target hook for shadow memory offset
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Diego Novillo <dnovillo at google dot com>, Dodji Seketeli <dseketel at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 11 Oct 2012 07:39:42 -0700
- Subject: Re: [asan] Target hook for shadow memory offset
- References: <20121011143208.GB584@tucnak.redhat.com>
On Thu, Oct 11, 2012 at 7:32 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> As the shadow memory offset ored into shifted addresses is clearly
> target specific (1 << 29 on i?86, 1LL << 44 on x86_64, 0 on ARM?,
> no support on other target so far), it should be IMHO a target hook.
>
> Ok for asan?
>
> --- gcc/config/i386/i386.c.jj 2012-10-11 11:53:58.000000000 +0200
> +++ gcc/config/i386/i386.c 2012-10-11 15:59:45.708922960 +0200
> @@ -5619,6 +5619,14 @@ ix86_legitimate_combined_insn (rtx insn)
> return true;
> }
>
> +/* Implement the TARGET_ASAN_SHADOW_OFFSET hook. */
> +
> +static unsigned HOST_WIDE_INT
> +ix86_asan_shadow_offset (void)
> +{
> + return (unsigned HOST_WIDE_INT) 1 << (Pmode == DImode ? 44 : 29);
> +}
> +
I think you should use TARGET_LP64 instead of Pmode == DImode.
--
H.J.