This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCHv3][Kasan][PING^3] Allow to override Asan shadow offset from command line
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Yury Gribov <y dot gribov at samsung dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>, Dmitry Vyukov <dvyukov at google dot com>, Andrey Ryabinin <a dot ryabinin at samsung dot com>
- Date: Wed, 15 Oct 2014 18:37:17 +0200
- Subject: Re: [PATCHv3][Kasan][PING^3] Allow to override Asan shadow offset from command line
- Authentication-results: sourceware.org; auth=none
- References: <540DBD37 dot 9060702 at samsung dot com> <5416B566 dot 2000601 at samsung dot com> <5429951B dot 90900 at samsung dot com> <5432779C dot 5030709 at samsung dot com> <54327A3D dot 3000007 at samsung dot com> <543E9E23 dot 2060809 at samsung dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Oct 15, 2014 at 08:17:39PM +0400, Yury Gribov wrote:
> +static unsigned HOST_WIDE_INT asan_shadow_offset_value;
> +static bool asan_shadow_offset_computed;
> +
> +/* Sets shadow offset to value in string VAL. */
> +
> +bool
> +set_asan_shadow_offset (const char *val)
> +{
> + char *endp;
> +
> + errno = 0;
> + asan_shadow_offset_value = strtoul (val, &endp, 0);
This will not really work well e.g. for 32-bit cross-compilers
to 64-bit.
I'm afraid you need to use strtoull here, libiberty has strtoul.c
already, perhaps just copying that to strtoull.c and adjusting types
etc. (and guarding it whole with HAVE_LONG_LONG)?
Then just use strtoull here if either HAVE_LONG_LONG instead
of strtoul.
Jakub