[asan] Target hook for shadow memory offset

H.J. Lu hjl.tools@gmail.com
Thu Oct 11 14:45:00 GMT 2012


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.



More information about the Gcc-patches mailing list