[ASan] fixup for r160712: provide a default definition for weak __asan_default_options()

llvm-svn: 160718
This commit is contained in:
Alexey Samsonov 2012-07-25 10:40:57 +00:00
parent f4156d496e
commit c145b02607
2 changed files with 13 additions and 14 deletions

View File

@ -19,15 +19,14 @@
// ASan flag values can be defined in three ways:
// 1) initialized with default values at startup.
// 2) overriden from user-specified string __asan_default_options.
// 2) overriden from string returned by user-specified function
// __asan_default_options().
// 3) overriden from env variable ASAN_OPTIONS.
extern "C" {
#if !defined(_WIN32)
// We do not need to redefine the defaults right now on Windows.
const char *__asan_default_options() SANITIZER_WEAK_ATTRIBUTE;
#endif
}
// Can be overriden by user.
const char *__asan_default_options() SANITIZER_WEAK_ATTRIBUTE;
} // extern "C"
namespace __asan {

View File

@ -98,6 +98,10 @@ static void ParseFlagsFromString(Flags *f, const char *str) {
ParseFlag(str, &f->disable_core, "disable_core");
}
extern "C" {
const char* WEAK __asan_default_options() { return ""; }
} // extern "C"
void InitializeFlags(Flags *f, const char *env) {
internal_memset(f, 0, sizeof(*f));
@ -126,15 +130,11 @@ void InitializeFlags(Flags *f, const char *env) {
f->disable_core = (__WORDSIZE == 64);
// Override from user-specified string.
#if !defined(_WIN32)
if (__asan_default_options) {
ParseFlagsFromString(f, __asan_default_options());
if (flags()->verbosity) {
Report("Using the defaults from __asan_default_options: %s\n",
__asan_default_options());
}
ParseFlagsFromString(f, __asan_default_options());
if (flags()->verbosity) {
Report("Using the defaults from __asan_default_options: %s\n",
__asan_default_options());
}
#endif
// Override from command line.
ParseFlagsFromString(f, env);