[PATCH] D28598: [compiler-rt] Provide access to the default implementation of weak functions for MD on Windows.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 15:15:29 PST 2017


mpividori updated this revision to Diff 85468.
mpividori retitled this revision from "[compiler-rt] [Sanitizer Coverage] Provide access to the default implementation of weak functions from sanitizer coverage for MD on Windows." to "[compiler-rt] Provide access to the default implementation of weak functions for MD on Windows.".
mpividori edited the summary of this revision.

https://reviews.llvm.org/D28598

Files:
  lib/asan/asan_interface_internal.h
  lib/asan/asan_win_dynamic_runtime_thunk.cc


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_internal_defs.h"
 #include "sanitizer_common/sanitizer_win_defs.h"
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
+// 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() {
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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28598.85468.patch
Type: text/x-patch
Size: 2808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170123/c7b7d4f3/attachment.bin>


More information about the llvm-commits mailing list