summaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-30 18:05:53 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-30 18:05:53 +0000
commit53486a83200dcd6ef17ca09e1d77db3664acbe2b (patch)
treefd21e26033e46b7fa15c4b038ed1fde6e14e347f /gcc/gcc.c
parentae0c39844cc04a622730c9c5c513193d9d668439 (diff)
downloadgcc-53486a83200dcd6ef17ca09e1d77db3664acbe2b.tar.gz
PR sanitizer/55374
* gcc.c (LIBASAN_SPEC): Define just to ADD_STATIC_LIBASAN_LIBS if LIBASAN_EARLY_SPEC is defined. (LIBASAN_EARLY_SPEC): Define to empty string if not already defined. (LINK_COMMAND_SPEC): Add LIBASAN_EARLY_SPEC for -fsanitize=address, before %o. * config/gnu-user.h (LIBASAN_EARLY_SPEC): Define. * g++.dg/asan/large-func-test-1.C: Allow both _Zna[jm] in addition to _Znw[jm] in the backtrace. Allow _Zna[jm] to be the first frame printed in backtrace. * g++.dg/asan/deep-stack-uaf-1.C: Use malloc instead of operator new to avoid errors about mismatched allocation vs. deallocation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195585 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index ff0f5845224..29735be1b9b 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -548,7 +548,9 @@ proper position among the other output files. */
#else
#define ADD_STATIC_LIBASAN_LIBS
#endif
-#ifdef HAVE_LD_STATIC_DYNAMIC
+#ifdef LIBASAN_EARLY_SPEC
+#define LIBASAN_SPEC ADD_STATIC_LIBASAN_LIBS
+#elif defined(HAVE_LD_STATIC_DYNAMIC)
#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
"} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
ADD_STATIC_LIBASAN_LIBS
@@ -557,6 +559,10 @@ proper position among the other output files. */
#endif
#endif
+#ifndef LIBASAN_EARLY_SPEC
+#define LIBASAN_EARLY_SPEC ""
+#endif
+
#ifndef LIBTSAN_SPEC
#ifdef HAVE_LD_STATIC_DYNAMIC
#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
@@ -705,7 +711,8 @@ proper position among the other output files. */
"%{fuse-ld=*:-fuse-ld=%*}\
%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
- %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
+ %{static:} %{L*} %(mfwrap) %(link_libgcc) \
+ %{fsanitize=address:" LIBASAN_EARLY_SPEC "} %o\
%{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
%{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
%(mflib) " STACK_SPLIT_SPEC "\