<div dir="ltr">Thanks!</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 10, 2014 at 3:33 AM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: timurrrr<br>
Date: Thu Jul 10 05:33:48 2014<br>
New Revision: 212699<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=212699&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=212699&view=rev</a><br>
Log:<br>
[ASan/Win] Don't hardcode ASan runtime version in ASan dll thunk<br>
<br>
Reviewed at <a href="http://reviews.llvm.org/D4459" target="_blank">http://reviews.llvm.org/D4459</a><br>
<br>
Added:<br>
compiler-rt/trunk/lib/asan/asan_init_version.h<br>
Modified:<br>
compiler-rt/trunk/lib/asan/asan_dll_thunk.cc<br>
compiler-rt/trunk/lib/asan/asan_interface_internal.h<br>
compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c<br>
compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c<br>
<br>
Modified: compiler-rt/trunk/lib/asan/asan_dll_thunk.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_dll_thunk.cc?rev=212699&r1=212698&r2=212699&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_dll_thunk.cc?rev=212699&r1=212698&r2=212699&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/asan/asan_dll_thunk.cc (original)<br>
+++ compiler-rt/trunk/lib/asan/asan_dll_thunk.cc Thu Jul 10 05:33:48 2014<br>
@@ -20,6 +20,7 @@<br>
// Using #ifdef rather than relying on Makefiles etc.<br>
// simplifies the build procedure.<br>
#ifdef ASAN_DLL_THUNK<br>
+#include "asan_init_version.h"<br>
#include "sanitizer_common/sanitizer_interception.h"<br>
<br>
// ---------- Function interception helper functions and macros ----------- {{{1<br>
@@ -203,13 +204,13 @@ extern "C" {<br>
<br>
// Manually wrap __asan_init as we need to initialize<br>
// __asan_option_detect_stack_use_after_return afterwards.<br>
- void __asan_init_v4() {<br>
+ void __asan_init() {<br>
typedef void (*fntype)();<br>
static fntype fn = 0;<br>
- // __asan_init_v4 is expected to be called by only one thread.<br>
+ // __asan_init is expected to be called by only one thread.<br>
if (fn) return;<br>
<br>
- fn = (fntype)getRealProcAddressOrDie("__asan_init_v4");<br>
+ fn = (fntype)getRealProcAddressOrDie(__asan_init_name);<br>
fn();<br>
__asan_option_detect_stack_use_after_return =<br>
(__asan_should_detect_stack_use_after_return() != 0);<br>
@@ -339,7 +340,7 @@ void InterceptHooks() {<br>
// In DLLs, the callbacks are expected to return 0,<br>
// otherwise CRT initialization fails.<br>
static int call_asan_init() {<br>
- __asan_init_v4();<br>
+ __asan_init();<br>
return 0;<br>
}<br>
#pragma section(".CRT$XIB", long, read) // NOLINT<br>
<br>
Added: compiler-rt/trunk/lib/asan/asan_init_version.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_init_version.h?rev=212699&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_init_version.h?rev=212699&view=auto</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/asan/asan_init_version.h (added)<br>
+++ compiler-rt/trunk/lib/asan/asan_init_version.h Thu Jul 10 05:33:48 2014<br>
@@ -0,0 +1,37 @@<br>
+//===-- asan_init_version.h -------------------------------------*- C++ -*-===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+// This file is a part of AddressSanitizer, an address sanity checker.<br>
+//<br>
+// This header defines a versioned __asan_init function to be called at the<br>
+// startup of the instrumented program.<br>
+//===----------------------------------------------------------------------===//<br>
+#ifndef ASAN_INIT_VERSION_H<br>
+#define ASAN_INIT_VERSION_H<br>
+<br>
+#include "sanitizer_common/sanitizer_internal_defs.h"<br>
+<br>
+extern "C" {<br>
+ // This function should be called at the very beginning of the process,<br>
+ // before any instrumented code is executed and before any call to malloc.<br>
+ // Every time the ASan ABI changes we also change the version number in this<br>
+ // name. Objects build with incompatible ASan ABI version<br>
+ // will not link with run-time.<br>
+ // Changes between ABI versions:<br>
+ // v1=>v2: added 'module_name' to __asan_global<br>
+ // v2=>v3: stack frame description (created by the compiler)<br>
+ // contains the function PC as the 3-rd field (see<br>
+ // DescribeAddressIfStack).<br>
+ // v3=>v4: added '__asan_global_source_location' to __asan_global.<br>
+ SANITIZER_INTERFACE_ATTRIBUTE void __asan_init_v4();<br>
+ #define __asan_init __asan_init_v4<br>
+ #define __asan_init_name "__asan_init_v4"<br>
+}<br>
+<br>
+#endif // ASAN_INIT_VERSION_H<br>
<br>
Modified: compiler-rt/trunk/lib/asan/asan_interface_internal.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interface_internal.h?rev=212699&r1=212698&r2=212699&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interface_internal.h?rev=212699&r1=212698&r2=212699&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/asan/asan_interface_internal.h (original)<br>
+++ compiler-rt/trunk/lib/asan/asan_interface_internal.h Thu Jul 10 05:33:48 2014<br>
@@ -17,23 +17,11 @@<br>
<br>
#include "sanitizer_common/sanitizer_internal_defs.h"<br>
<br>
+#include "asan_init_version.h"<br>
+<br>
using __sanitizer::uptr;<br>
<br>
extern "C" {<br>
- // This function should be called at the very beginning of the process,<br>
- // before any instrumented code is executed and before any call to malloc.<br>
- // Every time the asan ABI changes we also change the version number in this<br>
- // name. Objects build with incompatible asan ABI version<br>
- // will not link with run-time.<br>
- // Changes between ABI versions:<br>
- // v1=>v2: added 'module_name' to __asan_global<br>
- // v2=>v3: stack frame description (created by the compiler)<br>
- // contains the function PC as the 3-rd field (see<br>
- // DescribeAddressIfStack).<br>
- // v3=>v4: added '__asan_global_source_location' to __asan_global.<br>
- SANITIZER_INTERFACE_ATTRIBUTE void __asan_init_v4();<br>
- #define __asan_init __asan_init_v4<br>
-<br>
// This structure is used to describe the source location of a place where<br>
// global was defined.<br>
struct __asan_global_source_location {<br>
<br>
Modified: compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c?rev=212699&r1=212698&r2=212699&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c?rev=212699&r1=212698&r2=212699&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c Thu Jul 10 05:33:48 2014<br>
@@ -16,6 +16,7 @@<br>
// RUN: | grep -v "__asan_on_error" > %t.symbols<br>
<br>
// RUN: cat %p/../../../../lib/asan/asan_interface_internal.h \<br>
+// RUN: %p/../../../../lib/asan/asan_init_version.h \<br>
// RUN: | sed "s/\/\/.*//" | sed "s/typedef.*//" \<br>
// RUN: | grep -v "OPTIONAL" \<br>
// RUN: | grep "__asan_.*(" | sed "s/.* __asan_/__asan_/;s/(.*//" \<br>
<br>
Modified: compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c?rev=212699&r1=212698&r2=212699&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c?rev=212699&r1=212698&r2=212699&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c Thu Jul 10 05:33:48 2014<br>
@@ -9,6 +9,7 @@<br>
// RUN: | grep -v "__asan_stack_" \<br>
// RUN: | grep -v "__asan_on_error" > %t.symbols<br>
// RUN: cat %p/../../../../lib/asan/asan_interface_internal.h \<br>
+// RUN: %p/../../../../lib/asan/asan_init_version.h \<br>
// RUN: | sed "s/\/\/.*//" | sed "s/typedef.*//" \<br>
// RUN: | grep -v "OPTIONAL" \<br>
// RUN: | grep "__asan_.*(" | sed "s/.* __asan_/__asan_/;s/(.*//" \<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div>
</div>