diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2014-12-12 01:08:24 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-12-12 01:08:24 +0000 |
commit | 490896f8e57135b8a673e68d18139049fd8ce454 (patch) | |
tree | 403b52d37d42f22d1b128e9e194945372f3e1735 | |
parent | f3fd684f1266f2c2c7df3edc8b7e5e80ab11ca69 (diff) |
[ASan] Group all flag parsing code together. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224087 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/asan/asan_rtl.cc | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc index 34fb111d5..0f608f13c 100644 --- a/lib/asan/asan_rtl.cc +++ b/lib/asan/asan_rtl.cc @@ -299,21 +299,32 @@ void InitializeFlags(Flags *f, const char *env) { // Override from command line. ParseFlagsFromString(f, env); + if (env) + VReport(1, "Parsed ASAN_OPTIONS: %s\n", env); + + // If ASan starts in deactivated state, stash and clear some flags. + // Otherwise, let activation flags override current settings. + if (flags()->start_deactivated) + AsanStartDeactivated(); + else + ParseExtraActivationFlags(); + if (common_flags()->help) { PrintFlagDescriptions(); } + // Flag validation: if (!CAN_SANITIZE_LEAKS && cf->detect_leaks) { Report("%s: detect_leaks is not supported on this platform.\n", SanitizerToolName); cf->detect_leaks = false; } - // Make "strict_init_order" imply "check_initialization_order". // TODO(samsonov): Use a single runtime flag for an init-order checker. if (f->strict_init_order) { f->check_initialization_order = true; } + CHECK_LE(flags()->min_uar_stack_size_log, flags()->max_uar_stack_size_log); } // Parse flags that may change between startup and activation. @@ -574,20 +585,11 @@ static void AsanInitInternal() { SetCheckFailedCallback(AsanCheckFailed); SetPrintfAndReportCallback(AppendToErrorMessageBuffer); - if (!flags()->start_deactivated) - ParseExtraActivationFlags(); - __sanitizer_set_report_path(common_flags()->log_path); + + // Enable UAR detection, if required. __asan_option_detect_stack_use_after_return = flags()->detect_stack_use_after_return; - CHECK_LE(flags()->min_uar_stack_size_log, flags()->max_uar_stack_size_log); - - if (options) { - VReport(1, "Parsed ASAN_OPTIONS: %s\n", options); - } - - if (flags()->start_deactivated) - AsanStartDeactivated(); // Re-exec ourselves if we need to set additional env or command line args. MaybeReexec(); |