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; |
} |