[llvm-commits] [compiler-rt] r146161 - in /compiler-rt/trunk: lib/asan/asan_internal.h lib/asan/asan_rtl.cc lib/asan/asan_stack.cc make/platform/clang_darwin.mk

Kostya Serebryany kcc at google.com
Thu Dec 8 10:30:43 PST 2011


Author: kcc
Date: Thu Dec  8 12:30:42 2011
New Revision: 146161

URL: http://llvm.org/viewvc/llvm-project?rev=146161&view=rev
Log:
[asan] move build-time config options from makefile to source (otherwise we need config options in all makefiles) 

Modified:
    compiler-rt/trunk/lib/asan/asan_internal.h
    compiler-rt/trunk/lib/asan/asan_rtl.cc
    compiler-rt/trunk/lib/asan/asan_stack.cc
    compiler-rt/trunk/make/platform/clang_darwin.mk

Modified: compiler-rt/trunk/lib/asan/asan_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=146161&r1=146160&r2=146161&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_internal.h (original)
+++ compiler-rt/trunk/lib/asan/asan_internal.h Thu Dec  8 12:30:42 2011
@@ -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

Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=146161&r1=146160&r2=146161&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Thu Dec  8 12:30:42 2011
@@ -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 __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 @@
   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);

Modified: compiler-rt/trunk/lib/asan/asan_stack.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stack.cc?rev=146161&r1=146160&r2=146161&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_stack.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_stack.cc Thu Dec  8 12:30:42 2011
@@ -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 @@
 namespace __asan {
 
 // ----------------------- ProcSelfMaps ----------------------------- {{{1
-#ifdef ASAN_USE_SYSINFO
+#if ASAN_USE_SYSINFO == 1
 class ProcSelfMaps {
  public:
   void Init() {

Modified: compiler-rt/trunk/make/platform/clang_darwin.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_darwin.mk?rev=146161&r1=146160&r2=146161&view=diff
==============================================================================
--- compiler-rt/trunk/make/platform/clang_darwin.mk (original)
+++ compiler-rt/trunk/make/platform/clang_darwin.mk Thu Dec  8 12:30:42 2011
@@ -104,11 +104,6 @@
 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)





More information about the llvm-commits mailing list