summaryrefslogtreecommitdiff
path: root/gcc/asan.h
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-12 15:51:34 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-12 15:51:34 +0000
commit7ad5fd20643c17314388b3f88e6b97723fd145f1 (patch)
tree4f0f7a2a85c05539f589338ab08d8fab607d18d7 /gcc/asan.h
parentb92cccf41deffcfc22bb55557399efe1acb60c60 (diff)
downloadgcc-7ad5fd20643c17314388b3f88e6b97723fd145f1.tar.gz
Initial asan cleanups
This patch defines a new asan_shadow_offset target macro, instead of having a mere macro in the asan.c file. It becomes thus cleaner to define the target macro for targets that supports asan, namely x86 for now. The ASAN_SHADOW_SHIFT (which, along with the asan_shadow_offset constant, is used to compute the address of the shadow memory byte for a given memory address) is defined in asan.h. gcc/ChangeLog * toplev.c (process_options): Warn and turn off -faddress-sanitizer if not supported by target. * asan.c: Include target.h. (asan_scale, asan_offset_log_32, asan_offset_log_64, asan_offset_log): Removed. (build_check_stmt): Use ASAN_SHADOW_SHIFT and targetm.asan_shadow_offset (). (asan_instrument): Don't initialize asan_offset_log. * asan.h (ASAN_SHADOW_SHIFT): Define. * target.def (TARGET_ASAN_SHADOW_OFFSET): New hook. * doc/tm.texi.in (TARGET_ASAN_SHADOW_OFFSET): Add it. * doc/tm.texi: Regenerated. * Makefile.in (asan.o): Depend on $(TARGET_H). * config/i386/i386.c (ix86_asan_shadow_offset): New function. (TARGET_ASAN_SHADOW_OFFSET): Define. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193433 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/asan.h')
-rw-r--r--gcc/asan.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/asan.h b/gcc/asan.h
index 590cf359bd2..699820b852c 100644
--- a/gcc/asan.h
+++ b/gcc/asan.h
@@ -1,5 +1,5 @@
/* AddressSanitizer, a fast memory error detector.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011, 2012 Free Software Foundation, Inc.
Contributed by Kostya Serebryany <kcc@google.com>
This file is part of GCC.
@@ -23,4 +23,8 @@ along with GCC; see the file COPYING3. If not see
extern void asan_finish_file(void);
+/* Shadow memory is found at
+ (address >> ASAN_SHADOW_SHIFT) | targetm.asan_shadow_offset (). */
+#define ASAN_SHADOW_SHIFT 3
+
#endif /* TREE_ASAN */