[PATCH] D51882: [Sanitizers] [MinGW] Produce undecorated symbols for /export: directives when in MinGW mode

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 25 12:53:40 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL343015: [Sanitizers] [MinGW] Produce undecorated symbols for /export: directives when… (authored by mstorsjo, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D51882?vs=164723&id=166977#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51882

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_defs.h


Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_defs.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_defs.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_defs.h
@@ -30,6 +30,16 @@
 #define WIN_SYM_PREFIX
 #endif
 
+// For MinGW, the /export: directives contain undecorated symbols, contrary to
+// link/lld-link. The GNU linker doesn't support /alternatename and /include
+// though, thus lld-link in MinGW mode interprets them in the same way as
+// in the default mode.
+#ifdef __MINGW32__
+#define WIN_EXPORT_PREFIX
+#else
+#define WIN_EXPORT_PREFIX WIN_SYM_PREFIX
+#endif
+
 // Intermediate macro to ensure the parameter is expanded before stringified.
 #define STRINGIFY_(A) #A
 #define STRINGIFY(A) STRINGIFY_(A)
@@ -62,8 +72,8 @@
   __pragma(comment(linker, "/include:" WIN_SYM_PREFIX STRINGIFY(Name)))
 
 #define WIN_EXPORT(ExportedName, Name)                                         \
-  __pragma(comment(linker, "/export:" WIN_SYM_PREFIX STRINGIFY(ExportedName)   \
-                                  "=" WIN_SYM_PREFIX STRINGIFY(Name)))
+  __pragma(comment(linker, "/export:" WIN_EXPORT_PREFIX STRINGIFY(ExportedName)   \
+                                  "=" WIN_EXPORT_PREFIX STRINGIFY(Name)))
 
 // We cannot define weak functions on Windows, but we can use WIN_WEAK_ALIAS()
 // which defines an alias to a default implementation, and only works when


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51882.166977.patch
Type: text/x-patch
Size: 1468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180925/cdb1bb16/attachment.bin>


More information about the llvm-commits mailing list