aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorWei Mi <wmi@google.com>2012-11-12 15:51:13 +0000
committerDodji Seketeli <dodji@redhat.com>2012-11-12 15:51:13 +0000
commitebf03bf71c50d4261da2103d3f01a079b6ef0167 (patch)
treeb87fd787f6078b7ba49ca0fefd8a3b30b94d2db9 /gcc/toplev.c
parent931f44504d4cdd80e13de5d93abe9aad316e5c08 (diff)
Initial import of asan from the Google branch
This patch imports the initial state of asan as it was in the Google branch. It provides basic infrastructure for asan to instrument memory accesses on the heap, at -O3. Note that it supports neither stack nor global variable protection. The rest of the patches of the set is intended to further improve this base. gcc/ChangeLog * Makefile.in: Add asan.c and its dependencies. * common.opt: Add -faddress-sanitizer option. * invoke.texi: Document the new flag. * passes.c: Add the asan pass. * toplev.c (compile_file): Call asan_finish_file. * asan.c: New file. * asan.h: New file. * tree-pass.h: Declare pass_asan. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@193432 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 5cbb36411de..3ca0736995e 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -72,6 +72,7 @@ along with GCC; see the file COPYING3. If not see
#include "value-prof.h"
#include "alloc-pool.h"
#include "tree-mudflap.h"
+#include "asan.h"
#include "gimple.h"
#include "tree-ssa-alias.h"
#include "plugin.h"
@@ -570,6 +571,10 @@ compile_file (void)
if (flag_mudflap)
mudflap_finish_file ();
+ /* File-scope initialization for AddressSanitizer. */
+ if (flag_asan)
+ asan_finish_file ();
+
output_shared_constant_pool ();
output_object_blocks ();
finish_tm_clone_pairs ();