[compiler-rt] r306707 - Export the nothrow overload of operator new

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 10:39:53 PDT 2017


Author: rnk
Date: Thu Jun 29 10:39:53 2017
New Revision: 306707

URL: http://llvm.org/viewvc/llvm-project?rev=306707&view=rev
Log:
Export the nothrow overload of operator new

This missing export was causing allocator_returns_null.cc to fail on
Windows with a dynamic ASan runtime.

Modified:
    compiler-rt/trunk/lib/asan/asan_new_delete.cc

Modified: compiler-rt/trunk/lib/asan/asan_new_delete.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_new_delete.cc?rev=306707&r1=306706&r2=306707&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_new_delete.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_new_delete.cc Thu Jun 29 10:39:53 2017
@@ -25,22 +25,26 @@
 // dllexport would normally do. We need to export them in order to make the
 // VS2015 dynamic CRT (MD) work.
 #if SANITIZER_WINDOWS
-# define CXX_OPERATOR_ATTRIBUTE
-# ifdef _WIN64
-#  pragma comment(linker, "/export:??2 at YAPEAX_K@Z")   // operator new
-#  pragma comment(linker, "/export:??3 at YAXPEAX@Z")    // operator delete
-#  pragma comment(linker, "/export:??3 at YAXPEAX_K@Z")  // sized operator delete
-#  pragma comment(linker, "/export:??_U at YAPEAX_K@Z")  // operator new[]
-#  pragma comment(linker, "/export:??_V at YAXPEAX@Z")   // operator delete[]
-# else
-#  pragma comment(linker, "/export:??2 at YAPAXI@Z")   // operator new
-#  pragma comment(linker, "/export:??3 at YAXPAX@Z")   // operator delete
-#  pragma comment(linker, "/export:??3 at YAXPAXI@Z")  // sized operator delete
-#  pragma comment(linker, "/export:??_U at YAPAXI@Z")  // operator new[]
-#  pragma comment(linker, "/export:??_V at YAXPAX@Z")  // operator delete[]
-# endif
+#define CXX_OPERATOR_ATTRIBUTE
+#define COMMENT_EXPORT(sym) __pragma(comment(linker, "/export:"##sym))
+#ifdef _WIN64
+COMMENT_EXPORT("??2 at YAPEAX_K@Z")                     // operator new
+COMMENT_EXPORT("??2 at YAPEAX_KAEBUnothrow_t@std@@@Z")  // operator new nothrow
+COMMENT_EXPORT("??3 at YAXPEAX@Z")                      // operator delete
+COMMENT_EXPORT("??3 at YAXPEAX_K@Z")                    // sized operator delete
+COMMENT_EXPORT("??_U at YAPEAX_K@Z")                    // operator new[]
+COMMENT_EXPORT("??_V at YAXPEAX@Z")                     // operator delete[]
 #else
-# define CXX_OPERATOR_ATTRIBUTE INTERCEPTOR_ATTRIBUTE
+COMMENT_EXPORT("??2 at YAPAXI@Z")                    // operator new
+COMMENT_EXPORT("??2 at YAPAXIABUnothrow_t@std@@@Z")  // operator new nothrow
+COMMENT_EXPORT("??3 at YAXPAX@Z")                    // operator delete
+COMMENT_EXPORT("??3 at YAXPAXI@Z")                   // sized operator delete
+COMMENT_EXPORT("??_U at YAPAXI@Z")                   // operator new[]
+COMMENT_EXPORT("??_V at YAXPAX@Z")                   // operator delete[]
+#endif
+#undef COMMENT_EXPORT
+#else
+#define CXX_OPERATOR_ATTRIBUTE INTERCEPTOR_ATTRIBUTE
 #endif
 
 using namespace __asan;  // NOLINT




More information about the llvm-commits mailing list