summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-11-12 13:59:08 +0000
committerAlexey Samsonov <samsonov@google.com>2013-11-12 13:59:08 +0000
commit6345150992421bf1199b8a187b0c8d2990ec2cd2 (patch)
tree4564018437b9f0a5b6b5baa70dfc782406585b1d /compiler-rt/lib
parent25d69507ddb88e618688d243dd301b49d3beeb5b (diff)
downloadbcm5719-llvm-6345150992421bf1199b8a187b0c8d2990ec2cd2.tar.gz
bcm5719-llvm-6345150992421bf1199b8a187b0c8d2990ec2cd2.zip
[Sanitizer] Specify a default value for each common runtime flag
llvm-svn: 194479
Diffstat (limited to 'compiler-rt/lib')
-rw-r--r--compiler-rt/lib/asan/asan_rtl.cc9
-rw-r--r--compiler-rt/lib/lsan/lsan.cc5
-rw-r--r--compiler-rt/lib/msan/msan.cc6
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_flags.cc19
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_flags.h1
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_flags.cc17
6 files changed, 27 insertions, 30 deletions
diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc
index 04d1850e219..bd1ace747f0 100644
--- a/compiler-rt/lib/asan/asan_rtl.cc
+++ b/compiler-rt/lib/asan/asan_rtl.cc
@@ -132,16 +132,9 @@ static void ParseFlagsFromString(Flags *f, const char *str) {
void InitializeFlags(Flags *f, const char *env) {
CommonFlags *cf = common_flags();
+ SetCommonFlagDefaults();
cf->external_symbolizer_path = GetEnv("ASAN_SYMBOLIZER_PATH");
- cf->symbolize = true;
cf->malloc_context_size = kDefaultMallocContextSize;
- cf->fast_unwind_on_fatal = false;
- cf->fast_unwind_on_malloc = true;
- cf->strip_path_prefix = "";
- cf->handle_ioctl = false;
- cf->log_path = 0;
- cf->detect_leaks = false;
- cf->leak_check_at_exit = true;
internal_memset(f, 0, sizeof(*f));
f->quarantine_size = (ASAN_LOW_MEMORY) ? 1UL << 26 : 1UL << 28;
diff --git a/compiler-rt/lib/lsan/lsan.cc b/compiler-rt/lib/lsan/lsan.cc
index 3006f04f374..1424f3b2806 100644
--- a/compiler-rt/lib/lsan/lsan.cc
+++ b/compiler-rt/lib/lsan/lsan.cc
@@ -24,13 +24,10 @@ namespace __lsan {
static void InitializeCommonFlags() {
CommonFlags *cf = common_flags();
+ SetCommonFlagDefaults();
cf->external_symbolizer_path = GetEnv("LSAN_SYMBOLIZER_PATH");
- cf->symbolize = true;
- cf->strip_path_prefix = "";
- cf->fast_unwind_on_malloc = true;
cf->malloc_context_size = 30;
cf->detect_leaks = true;
- cf->leak_check_at_exit = true;
ParseCommonFlagsFromString(GetEnv("LSAN_OPTIONS"));
}
diff --git a/compiler-rt/lib/msan/msan.cc b/compiler-rt/lib/msan/msan.cc
index cdcda0f8755..83b11e5c2ff 100644
--- a/compiler-rt/lib/msan/msan.cc
+++ b/compiler-rt/lib/msan/msan.cc
@@ -141,14 +141,10 @@ static void ParseFlagsFromString(Flags *f, const char *str) {
static void InitializeFlags(Flags *f, const char *options) {
CommonFlags *cf = common_flags();
+ SetCommonFlagDefaults();
cf->external_symbolizer_path = GetEnv("MSAN_SYMBOLIZER_PATH");
- cf->symbolize = true;
- cf->strip_path_prefix = "";
- cf->fast_unwind_on_fatal = false;
- cf->fast_unwind_on_malloc = true;
cf->malloc_context_size = 20;
cf->handle_ioctl = true;
- cf->log_path = 0;
internal_memset(f, 0, sizeof(*f));
f->poison_heap_with_zeroes = false;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc
index d0e7d54a6db..ba23ea04bc2 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc
@@ -18,16 +18,31 @@
namespace __sanitizer {
+void SetCommonFlagDefaults() {
+ CommonFlags *f = common_flags();
+ f->symbolize = true;
+ f->external_symbolizer_path = "";
+ f->strip_path_prefix = "";
+ f->fast_unwind_on_fatal = false;
+ f->fast_unwind_on_malloc = true;
+ f->handle_ioctl = false;
+ f->malloc_context_size = 1;
+ f->log_path = "stderr";
+ f->verbosity = 0;
+ f->detect_leaks = false;
+ f->leak_check_at_exit = true;
+ f->allocator_may_return_null = false;
+}
+
void ParseCommonFlagsFromString(const char *str) {
CommonFlags *f = common_flags();
ParseFlag(str, &f->symbolize, "symbolize");
ParseFlag(str, &f->external_symbolizer_path, "external_symbolizer_path");
- ParseFlag(str, &f->malloc_context_size, "malloc_context_size");
ParseFlag(str, &f->strip_path_prefix, "strip_path_prefix");
ParseFlag(str, &f->fast_unwind_on_fatal, "fast_unwind_on_fatal");
ParseFlag(str, &f->fast_unwind_on_malloc, "fast_unwind_on_malloc");
- ParseFlag(str, &f->symbolize, "symbolize");
ParseFlag(str, &f->handle_ioctl, "handle_ioctl");
+ ParseFlag(str, &f->malloc_context_size, "malloc_context_size");
ParseFlag(str, &f->log_path, "log_path");
ParseFlag(str, &f->verbosity, "verbosity");
ParseFlag(str, &f->detect_leaks, "detect_leaks");
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.h b/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
index efea6fea48d..b8a6b15d8bb 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
@@ -58,6 +58,7 @@ inline CommonFlags *common_flags() {
return &f;
}
+void SetCommonFlagDefaults();
void ParseCommonFlagsFromString(const char *str);
} // namespace __sanitizer
diff --git a/compiler-rt/lib/tsan/rtl/tsan_flags.cc b/compiler-rt/lib/tsan/rtl/tsan_flags.cc
index cf699f20185..c6f24bf49ab 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_flags.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_flags.cc
@@ -91,21 +91,20 @@ void InitializeFlags(Flags *f, const char *env) {
f->history_size = kGoMode ? 1 : 2; // There are a lot of goroutines in Go.
f->io_sync = 1;
- ParseCommonFlagsFromString("strip_path_prefix=");
- ParseCommonFlagsFromString("log_path=stderr");
- ParseCommonFlagsFromString("external_symbolizer_path=");
- ParseCommonFlagsFromString("allocator_may_return_null=0");
- ParseCommonFlagsFromString("verbosity=0");
- *static_cast<CommonFlags*>(f) = *common_flags();
+ CommonFlags *cf = common_flags();
+ SetCommonFlagDefaults();
+ *static_cast<CommonFlags*>(f) = *cf;
// Let a frontend override.
OverrideFlags(f);
ParseFlags(f, __tsan_default_options());
ParseCommonFlagsFromString(__tsan_default_options());
-
// Override from command line.
ParseFlags(f, env);
+ ParseCommonFlagsFromString(env);
+ *static_cast<CommonFlags*>(f) = *cf;
+ // Sanity check.
if (!f->report_bugs) {
f->report_thread_leaks = false;
f->report_destroy_locked = false;
@@ -123,10 +122,6 @@ void InitializeFlags(Flags *f, const char *env) {
" (must be [0..2])\n");
Die();
}
-
- *common_flags() = *f;
- ParseCommonFlagsFromString(env);
- *static_cast<CommonFlags*>(f) = *common_flags();
}
} // namespace __tsan
OpenPOWER on IntegriCloud