Use weak symbols only on supported platforms
Clang on Windows notably has a broken weak symbol implementation. See:
https://bugs.llvm.org/show_bug.cgi?id=37598
Change-Id: I417d08908f594c817626e4c225ea7c7429b35ca5
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/35864
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
diff --git a/crypto/mem.c b/crypto/mem.c
index 14e0bdf..0ca0e84 100644
--- a/crypto/mem.c
+++ b/crypto/mem.c
@@ -79,7 +79,10 @@
static void __asan_unpoison_memory_region(const void *addr, size_t size) {}
#endif
-#if defined(__GNUC__) || defined(__clang__)
+// Windows doesn't really support weak symbols as of May 2019, and Clang on
+// Windows will emit strong symbols instead. See
+// https://bugs.llvm.org/show_bug.cgi?id=37598
+#if defined(__GNUC__) || (defined(__clang__) && !defined(_MSC_VER))
// sdallocx is a sized |free| function. By passing the size (which we happen to
// always know in BoringSSL), the malloc implementation can save work. We cannot
// depend on |sdallocx| being available so we declare a wrapper that falls back