diff options
author | Martin Storsjo <martin@martin.st> | 2018-09-25 19:50:39 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2018-09-25 19:50:39 +0000 |
commit | 45205a28343a8953b55a9bebb3b30104dbb4ddf5 (patch) | |
tree | 7d7e8971663379edc9ecdc9846c5e14252a666f3 /compiler-rt/lib/sanitizer_common | |
parent | 693f3a573c747d5d1d56164c7123dbb866977174 (diff) | |
download | bcm5719-llvm-45205a28343a8953b55a9bebb3b30104dbb4ddf5.tar.gz bcm5719-llvm-45205a28343a8953b55a9bebb3b30104dbb4ddf5.zip |
[Sanitizers] [MinGW] Produce undecorated symbols for /export: directives when in MinGW mode
In MinGW mode, the /export: directives in object files are interpreted
differently; the symbols are not assumed to be decorated.
Since the GNU linker doesn't support the /alternatename and /include
directives, there's no such distinction for them in lld. This assumes
that the resulting sanitizer libraries will be linked by lld.
Differential Revision: https://reviews.llvm.org/D51882
llvm-svn: 343015
Diffstat (limited to 'compiler-rt/lib/sanitizer_common')
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_win_defs.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_win_defs.h index 19596cf9c8a..1262630364a 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win_defs.h +++ b/compiler-rt/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 |