Index: lib/asan/asan_interface_internal.h =================================================================== --- lib/asan/asan_interface_internal.h +++ lib/asan/asan_interface_internal.h @@ -170,11 +170,9 @@ WEAK_DECL(const char*, __asan_default_options, void); - SANITIZER_INTERFACE_ATTRIBUTE extern uptr __asan_shadow_memory_dynamic_address; // Global flag, copy of ASAN_OPTIONS=detect_stack_use_after_return - SANITIZER_INTERFACE_ATTRIBUTE extern int __asan_option_detect_stack_use_after_return; SANITIZER_INTERFACE_ATTRIBUTE Index: lib/asan/asan_win_dynamic_runtime_thunk.cc =================================================================== --- lib/asan/asan_win_dynamic_runtime_thunk.cc +++ lib/asan/asan_win_dynamic_runtime_thunk.cc @@ -24,10 +24,35 @@ // Using #ifdef rather than relying on Makefiles etc. // simplifies the build procedure. #ifdef ASAN_DYNAMIC_RUNTIME_THUNK +#define SANITIZER_IMPORT_INTERFACE 1 +#include "asan_interface_internal.h" +#include "sanitizer_common/sanitizer_allocator_interface.h" +#include "sanitizer_common/sanitizer_interface_internal.h" #include "sanitizer_common/sanitizer_win_defs.h" #define WIN32_LEAN_AND_MEAN #include +// Define weak alias for all weak functions imported from asan dll. +WIN_WEAK_IMPORT_DEF(__sanitizer_malloc_hook) +WIN_WEAK_IMPORT_DEF(__sanitizer_free_hook) +WIN_WEAK_IMPORT_DEF(__sanitizer_print_memory_profile) +WIN_WEAK_IMPORT_DEF(__sanitizer_sandbox_on_notify) +WIN_WEAK_IMPORT_DEF(__sanitizer_report_error_summary) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_cmp) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_cmp1) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_cmp2) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_cmp4) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_cmp8) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_switch) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_div4) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_div8) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_gep) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_pc_indir) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_pc_guard) +WIN_WEAK_IMPORT_DEF(__sanitizer_cov_trace_pc_guard_init) +WIN_WEAK_IMPORT_DEF(__asan_on_error) +WIN_WEAK_IMPORT_DEF(__asan_default_options) + // First, declare CRT sections we'll be using in this file #pragma section(".CRT$XIB", long, read) // NOLINT #pragma section(".CRT$XID", long, read) // NOLINT @@ -51,8 +76,8 @@ __declspec(dllimport) int __asan_should_detect_stack_use_after_return(); int __asan_option_detect_stack_use_after_return; -__declspec(dllimport) void* __asan_get_shadow_memory_dynamic_address(); -void* __asan_shadow_memory_dynamic_address; +__declspec(dllimport) uptr __asan_get_shadow_memory_dynamic_address(); +uptr __asan_shadow_memory_dynamic_address; } static int InitializeClonedVariables() {