OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // This file contains the default options for various compiler-based dynamic |
| 6 // tools. |
| 7 |
| 8 #include "build/build_config.h" |
| 9 |
| 10 // Functions returning default options are declared weak in the tools' runtime |
| 11 // libraries. To make the linker pick the strong replacements for those |
| 12 // functions from this module, we explicitly force its inclusion by passing |
| 13 // -Wl,-u_sanitizer_options_link_helper |
| 14 extern "C" |
| 15 void _sanitizer_options_link_helper() { } |
| 16 |
| 17 #if defined(ADDRESS_SANITIZER) |
| 18 // Default options for AddressSanitizer in various configurations: |
| 19 // strict_memcmp=1 - disable the strict memcmp() checking |
| 20 // (http://crbug.com/178677 and http://crbug.com/178404). |
| 21 // malloc_context_size=5 - limit the size of stack traces collected by ASan |
| 22 // for each malloc/free by 5 frames. These stack traces tend to accumulate |
| 23 // very fast in applications using JIT (v8 in Chrome's case), see |
| 24 // https://code.google.com/p/address-sanitizer/issues/detail?id=177 |
| 25 // symbolize=false - disable the in-process symbolization, which isn't 100% |
| 26 // compatible with the existing sandboxes and doesn't make much sense for |
| 27 // stripped official binaries. |
| 28 // legacy_pthread_cond=1 - run in the libpthread 2.2.5 compatibility mode to |
| 29 // work around libGL.so using the obsolete API, see |
| 30 // http://crbug.com/341805. This may break if pthread_cond_t objects are |
| 31 // accessed by both instrumented and non-instrumented binaries (e.g. if |
| 32 // they reside in shared memory). This option is going to be deprecated in |
| 33 // upstream AddressSanitizer and must not be used anywhere except the |
| 34 // official builds. |
| 35 // replace_intrin=0 - do not intercept memcpy(), memmove() and memset() to |
| 36 // work around http://crbug.com/162461 (ASan report in OpenCL on Mac). |
| 37 #if defined(OS_LINUX) |
| 38 #if defined(GOOGLE_CHROME_BUILD) |
| 39 // Default AddressSanitizer options for the official build. These do not affect |
| 40 // tests on buildbots (which don't set GOOGLE_CHROME_BUILD) or non-official |
| 41 // Chromium builds. |
| 42 const char kAsanDefaultOptions[] = |
| 43 "legacy_pthread_cond=1 malloc_context_size=5 strict_memcmp=0 " |
| 44 "symbolize=false"; |
| 45 #else |
| 46 // Default AddressSanitizer options for buildbots and non-official builds. |
| 47 const char *kAsanDefaultOptions = |
| 48 "strict_memcmp=0 symbolize=false"; |
| 49 #endif // GOOGLE_CHROME_BUILD |
| 50 |
| 51 #elif defined(OS_MACOSX) |
| 52 const char *kAsanDefaultOptions = "strict_memcmp=0 replace_intrin=0"; |
| 53 #endif // OS_LINUX |
| 54 |
| 55 #if defined(OS_LINUX) || defined(OS_MACOSX) |
| 56 extern "C" |
| 57 __attribute__((no_sanitize_address)) |
| 58 const char *__asan_default_options() { |
| 59 return kAsanDefaultOptions; |
| 60 } |
| 61 #endif // OS_LINUX || OS_MACOSX |
| 62 #endif // ADDRESS_SANITIZER |
OLD | NEW |