On Thu, 2012-12-06 at 10:50 -0500, David Edelsohn wrote: > On Thu, Dec 6, 2012 at 9:46 AM, Peter Bergner <berg...@vnet.ibm.com> wrote: > > >> That macro determines if GCC thinks -fsanitze=address is supported, > >> which it is not on AIX. The macro probably should be defined in sysv4.h, > >> not rs6000.c, and the function should not be defined appropriately. > > > > Ok, I can move the macro there. And by the function being defined > > appropriately, do you mean wrapping it in a: > > > > #ifdef TARGET_ASAN_SHADOW_OFFSET > > I meant wrapping the code in > > #if TARGET_ELF
Ok, how about the following which bootstrapped and regtested fine? Peter libsanitizer/ * configure.tgt: Enable build on powerpc*-linux. gcc/ * config/rs6000/sysv4.h (TARGET_ASAN_SHADOW_OFFSET): Define. * config/rs6000/rs6000.c (rs6000_asan_shadow_offset): New function. * config/rs6000/rs6000.h (FRAME_GROWS_DOWNWARD): Define to flag_stack_protect != 0 || flag_asan != 0. Index: libsanitizer/configure.tgt =================================================================== --- libsanitizer/configure.tgt (revision 194226) +++ libsanitizer/configure.tgt (working copy) @@ -25,6 +25,8 @@ case "${target}" in TSAN_SUPPORTED=yes fi ;; + powerpc*-*-linux*) + ;; sparc*-*-linux*) ;; x86_64-*-darwin* | i?86-*-darwin*) Index: gcc/config/rs6000/sysv4.h =================================================================== --- gcc/config/rs6000/sysv4.h (revision 194226) +++ gcc/config/rs6000/sysv4.h (working copy) @@ -971,6 +971,9 @@ ncrtn.o%s" #define TARGET_ASM_FILE_END rs6000_elf_file_end +#undef TARGET_ASAN_SHADOW_OFFSET +#define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset + /* This target uses the sysv4.opt file. */ #define TARGET_USES_SYSV4_OPT 1 Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 194226) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -27521,6 +27521,15 @@ rs6000_final_prescan_insn (rtx insn, rtx } } +/* Implement the TARGET_ASAN_SHADOW_OFFSET hook. */ + +#if TARGET_ELF +static unsigned HOST_WIDE_INT +rs6000_asan_shadow_offset (void) +{ + return (unsigned HOST_WIDE_INT) 1 << (TARGET_64BIT ? 41 : 29); +} +#endif /* Mask options that we want to support inside of attribute((target)) and #pragma GCC target operations. Note, we do not include things like Index: gcc/config/rs6000/rs6000.h =================================================================== --- gcc/config/rs6000/rs6000.h (revision 194226) +++ gcc/config/rs6000/rs6000.h (working copy) @@ -1406,7 +1406,7 @@ extern enum reg_class rs6000_constraints On the RS/6000, we grow upwards, from the area after the outgoing arguments. */ -#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0) +#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0 || flag_asan != 0) /* Size of the outgoing register save area */ #define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX \