[AArch64] Enable Address Sanitizer.
authorChristophe Lyon <christophe.lyon@linaro.org>
Fri, 26 Sep 2014 13:07:42 +0000 (13:07 +0000)
committerChristophe Lyon <clyon@gcc.gnu.org>
Fri, 26 Sep 2014 13:07:42 +0000 (15:07 +0200)
2014-09-26  Christophe Lyon  <christophe.lyon@linaro.org>

[AArch64] Enable Address Sanitizer.

gcc/
* config/aarch64/aarch64-linux.h (ASAN_CC1_SPEC): Define.
        (CC1_SPEC): Define.
        * config/aarch64/aarch64.c (aarch64_asan_shadow_offset): New function.
        (TARGET_ASAN_SHADOW_OFFSET): Define.

libsanitzer/
* configure.tgt: Enable build on aarch64*-linux.

From-SVN: r215642

gcc/ChangeLog
gcc/config/aarch64/aarch64-linux.h
gcc/config/aarch64/aarch64.c
libsanitizer/ChangeLog
libsanitizer/configure.tgt

index d92a705edf34e32341d612b984700b3cb535aff9..b00392374920b17bc8d83485520f0cb31a01c8b7 100644 (file)
@@ -1,3 +1,10 @@
+2014-09-26  Christophe Lyon  <christophe.lyon@linaro.org>
+
+       * config/aarch64/aarch64-linux.h (ASAN_CC1_SPEC): Define.
+        (CC1_SPEC): Define.
+        * config/aarch64/aarch64.c (aarch64_asan_shadow_offset): New function.
+        (TARGET_ASAN_SHADOW_OFFSET): Define.
+
 2014-09-26  Martin Liska  <mliska@suse.cz>
 
        * cgraph.c (cgraph_node::release_body): New argument keep_arguments
index 1731432a4d1ff45b719f6579af39c5e306a609b8..3fbde9388058ba417cb8c351ef7de6459347943e 100644 (file)
 
 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
 
+#undef  ASAN_CC1_SPEC
+#define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
+
+#undef  CC1_SPEC
+#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC
+
 #define CPP_SPEC "%{pthread:-D_REENTRANT}"
 
 #define LINUX_TARGET_LINK_SPEC  "%{h*}         \
index 68c78f6430600f1c11c9a3ad88552f297bd0d17b..5144c35e29f67d3ee76883f22eb71a3daa880c81 100644 (file)
@@ -9777,6 +9777,14 @@ aarch64_expand_movmem (rtx *operands)
   return true;
 }
 
+/* Implement the TARGET_ASAN_SHADOW_OFFSET hook.  */
+
+static unsigned HOST_WIDE_INT
+aarch64_asan_shadow_offset (void)
+{
+  return (HOST_WIDE_INT_1 << 36);
+}
+
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST aarch64_address_cost
 
@@ -10023,6 +10031,9 @@ aarch64_expand_movmem (rtx *operands)
 #undef TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
 #define TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS true
 
+#undef TARGET_ASAN_SHADOW_OFFSET
+#define TARGET_ASAN_SHADOW_OFFSET aarch64_asan_shadow_offset
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-aarch64.h"
index 75c24b4756ba96a72346edf6e514787800b0fce6..eaabf43f7ccbc637cf8bd3ad36b9ee5a7e8776e7 100644 (file)
@@ -1,3 +1,7 @@
+2014-09-26  Christophe Lyon  <christophe.lyon@linaro.org>
+
+       * configure.tgt: Enable build on aarch64*-linux.
+
 2014-09-19  Kostya Serebryany  <kcc@google.com>
 
        * All source files: Merge from upstream r218156.
index 6de4a65715bb2c2f8dac7b3296536ebd6f40c6ae..2c302ab64897b7e352f0d3c1164182d30c50e3d7 100644 (file)
@@ -35,6 +35,8 @@ case "${target}" in
        ;;
   arm*-*-linux*)
        ;;
+  aarch64*-*-linux*)
+       ;;
   x86_64-*-darwin[1]* | i?86-*-darwin[1]*)
        TSAN_SUPPORTED=no
        ;;