[PATCH] ubsan: Port runtime library to (32- and 64-bit) Windows.

Reid Kleckner rnk at google.com
Tue Jun 30 18:50:08 PDT 2015


================
Comment at: lib/sanitizer_common/sanitizer_atomic_msvc.h:157
@@ -147,9 +156,3 @@
   DCHECK(!((uptr)a % sizeof(*a)));
-  __asm {
-    mov eax, a
-    mov cl, v
-    xchg [eax], cl  // NOLINT
-    mov v, cl
-  }
-  return v;
+  return (u8)_InterlockedExchange8((volatile char*)&a->val_dont_use, v);
 }
----------------
samsonov wrote:
> IIRC this is only available since Visual Studio 2013. I'm not aware of the minimum version we support, adding Reid.
VS 2013 is the minimum toolchain requirement for LLVM, so this should be fine.

================
Comment at: lib/ubsan/ubsan_flags.cc:75
@@ +74,3 @@
+#if SANITIZER_WINDOWS
+const char *__ubsan_default_default_options() { return ""; }
+#pragma comment(linker, "/alternatename:__ubsan_default_options=__ubsan_default_default_options")
----------------
samsonov wrote:
> What does this function mean?
Peter, at some point we might implement attribute weak in clang the way mingw does, where we automatically create a new symbol and a weak alias to it with the original name, so you might want to make this `#elif SANITIZER_WINDOWS`.

http://reviews.llvm.org/D10856

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list