| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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). | |
| 33 // replace_intrin=0 - do not intercept memcpy(), memmove() and memset() to | |
| 34 // work around http://crbug.com/162461 (ASan report in OpenCL on Mac). | |
| 35 #if defined(OS_LINUX) | |
| 36 #if defined(GOOGLE_CHROME_BUILD) | |
| 37 // Default AddressSanitizer options for the official build. These do not affect | |
| 38 // tests on buildbots (which don't set GOOGLE_CHROME_BUILD) or non-official | |
| 39 // Chromium builds. | |
| 40 const char kAsanDefaultOptions[] = | |
| 41 "legacy_pthread_cond=1 malloc_context_size=5 strict_memcmp=0 " | |
| 42 "symbolize=false"; | |
| 43 #else | |
| 44 // Default AddressSanitizer options for buildbots and non-official builds. | |
| 45 const char *kAsanDefaultOptions = | |
| 46 "legacy_pthread_cond=1 strict_memcmp=0 symbolize=false"; | |
| 47 #endif // GOOGLE_CHROME_BUILD | |
| 48 | |
| 49 #elif defined(OS_MACOSX) | |
| 50 const char *kAsanDefaultOptions = "strict_memcmp=0 replace_intrin=0"; | |
| 51 #endif // OS_LINUX | |
| 52 | |
| 53 #if defined(OS_LINUX) || defined(OS_MACOSX) | |
| 54 extern "C" | |
| 55 __attribute__((no_sanitize_address)) | |
| 56 const char *__asan_default_options() { | |
| 57 return kAsanDefaultOptions; | |
| 58 } | |
| 59 #endif // OS_LINUX || OS_MACOSX | |
| 60 #endif // ADDRESS_SANITIZER | |
| OLD | NEW |