Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: build/sanitizers/sanitizer_options.cc

Issue 2911513002: Partition libcxx build code from build/config/sanitizers (Closed)
Patch Set: Fix asan Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/sanitizers/sanitizer_options.cc
diff --git a/build/sanitizers/sanitizer_options.cc b/build/sanitizers/sanitizer_options.cc
index 1f4250111ec89262343113b6bd55cb59b2580f0a..e7e427981f9e41acd877c807163197cf998af966 100644
--- a/build/sanitizers/sanitizer_options.cc
+++ b/build/sanitizers/sanitizer_options.cc
@@ -82,24 +82,16 @@ const char *kAsanDefaultOptions =
"check_printf=1 use_sigaltstack=1 "
"strip_path_prefix=/../../ fast_unwind_on_fatal=1 "
"detect_stack_use_after_return=1 detect_odr_violation=0 ";
-static const char kNaClDefaultOptions[] = "handle_segv=0";
-static const char kNaClFlag[] = "--type=nacl-loader";
#endif // OS_LINUX
#if defined(OS_LINUX) || defined(OS_MACOSX)
+// Allow NaCl to override the default asan options.
+extern const char* kAsanDefaultOptionsNaCl;
+__attribute__((weak)) const char* kAsanDefaultOptionsNaCl = nullptr;
+
SANITIZER_HOOK_ATTRIBUTE const char *__asan_default_options() {
-#if defined(OS_MACOSX)
- char*** argvp = _NSGetArgv();
- int* argcp = _NSGetArgc();
- if (!argvp || !argcp) return kAsanDefaultOptions;
- char** argv = *argvp;
- int argc = *argcp;
- for (int i = 0; i < argc; ++i) {
- if (strcmp(argv[i], kNaClFlag) == 0) {
- return kNaClDefaultOptions;
- }
- }
-#endif
+ if (kAsanDefaultOptionsNaCl)
+ return kAsanDefaultOptionsNaCl;
return kAsanDefaultOptions;
}

Powered by Google App Engine
This is Rietveld 408576698