summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/asan/asan_internal.h23
-rw-r--r--compiler-rt/lib/asan/asan_rtl.cc9
-rw-r--r--compiler-rt/lib/asan/asan_stack.cc4
-rw-r--r--compiler-rt/make/platform/clang_darwin.mk5
4 files changed, 27 insertions, 14 deletions
diff --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h
index ca62d40f0fa..94db27dea0e 100644
--- a/compiler-rt/lib/asan/asan_internal.h
+++ b/compiler-rt/lib/asan/asan_internal.h
@@ -41,6 +41,29 @@
" instrumented by AddressSanitizer"
#endif
+// Build-time configuration options.
+
+// If set, sysinfo/sysinfo.h will be used to iterate over /proc/maps.
+#ifndef ASAN_USE_SYSINFO
+# define ASAN_USE_SYSINFO 1
+#endif
+
+// If set, asan will install its own SEGV signal handler.
+#ifndef ASAN_NEEDS_SEGV
+# define ASAN_NEEDS_SEGV 1
+#endif
+
+// If set, asan will intercept C++ exception api call(s).
+#ifndef ASAN_HAS_EXCEPTIONS
+# define ASAN_HAS_EXCEPTIONS 1
+#endif
+
+// If set, asan uses the values of SHADOW_SCALE and SHADOW_OFFSET
+// provided by the instrumented objects. Otherwise constants are used.
+#ifndef ASAN_FLEXIBLE_MAPPING_AND_OFFSET
+# define ASAN_FLEXIBLE_MAPPING_AND_OFFSET 0
+#endif
+
// All internal functions in asan reside inside the __asan namespace
// to avoid namespace collisions with the user programs.
// Seperate namespace also makes it simpler to distinguish the asan run-time
diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc
index 8216cc60033..d0b1da418c9 100644
--- a/compiler-rt/lib/asan/asan_rtl.cc
+++ b/compiler-rt/lib/asan/asan_rtl.cc
@@ -45,10 +45,6 @@
#include <unistd.h>
// must not include <setjmp.h> on Linux
-#ifndef ASAN_NEEDS_SEGV
-# define ASAN_NEEDS_SEGV 1
-#endif
-
namespace __asan {
// -------------------------- Flags ------------------------- {{{1
@@ -503,7 +499,7 @@ extern "C" void WRAP(siglongjmp)(void *env, int val) {
extern "C" void __cxa_throw(void *a, void *b, void *c);
-#if ASAN_HAS_EXCEPTIONS
+#if ASAN_HAS_EXCEPTIONS == 1
extern "C" void WRAP(__cxa_throw)(void *a, void *b, void *c) {
CHECK(&real___cxa_throw);
UnpoisonStackFromHereToTop();
@@ -657,8 +653,7 @@ void __asan_init() {
FLAG_poison_shadow = IntFlagValue(options, "poison_shadow=", 1);
FLAG_report_globals = IntFlagValue(options, "report_globals=", 1);
FLAG_lazy_shadow = IntFlagValue(options, "lazy_shadow=", 0);
- FLAG_handle_segv = IntFlagValue(options, "handle_segv=",
- ASAN_NEEDS_SEGV);
+ FLAG_handle_segv = IntFlagValue(options, "handle_segv=", ASAN_NEEDS_SEGV);
FLAG_handle_sigill = IntFlagValue(options, "handle_sigill=", 0);
FLAG_symbolize = IntFlagValue(options, "symbolize=", 1);
FLAG_demangle = IntFlagValue(options, "demangle=", 1);
diff --git a/compiler-rt/lib/asan/asan_stack.cc b/compiler-rt/lib/asan/asan_stack.cc
index 08a70aa985f..b451452aee9 100644
--- a/compiler-rt/lib/asan/asan_stack.cc
+++ b/compiler-rt/lib/asan/asan_stack.cc
@@ -19,7 +19,7 @@
#include <string.h>
-#ifdef ASAN_USE_SYSINFO
+#if ASAN_USE_SYSINFO == 1
#include "sysinfo/sysinfo.h"
#endif
@@ -31,7 +31,7 @@ ASAN_USE_EXTERNAL_SYMBOLIZER(const void *pc, char *out, int out_size);
namespace __asan {
// ----------------------- ProcSelfMaps ----------------------------- {{{1
-#ifdef ASAN_USE_SYSINFO
+#if ASAN_USE_SYSINFO == 1
class ProcSelfMaps {
public:
void Init() {
diff --git a/compiler-rt/make/platform/clang_darwin.mk b/compiler-rt/make/platform/clang_darwin.mk
index 492fcfc81ec..bb8bf78a087 100644
--- a/compiler-rt/make/platform/clang_darwin.mk
+++ b/compiler-rt/make/platform/clang_darwin.mk
@@ -104,11 +104,6 @@ CFLAGS.eprintf := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
CFLAGS.10.4 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
# FIXME: We can't build ASAN with our stub SDK yet.
CFLAGS.asan_osx := $(CFLAGS) -mmacosx-version-min=10.5
-CFLAGS.asan_osx += \
- -DASAN_USE_SYSINFO=1 \
- -DASAN_NEEDS_SEGV=1 \
- -DASAN_HAS_EXCEPTIONS=1 \
- -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=0
CFLAGS.ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
CFLAGS.ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
OpenPOWER on IntegriCloud