[llvm-commits] [compiler-rt] r154106 - /compiler-rt/trunk/lib/asan/asan_win.cc
Timur Iskhodzhanov
timurrrr at google.com
Thu Apr 5 10:16:33 PDT 2012
Author: timurrrr
Date: Thu Apr 5 12:16:32 2012
New Revision: 154106
URL: http://llvm.org/viewvc/llvm-project?rev=154106&view=rev
Log:
[ASan/Win] Fix build by using inline assembly instead of an unavailable intrinsic function
Modified:
compiler-rt/trunk/lib/asan/asan_win.cc
Modified: compiler-rt/trunk/lib/asan/asan_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_win.cc?rev=154106&r1=154105&r2=154106&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_win.cc Thu Apr 5 12:16:32 2012
@@ -235,7 +235,16 @@
}
uint16_t AtomicExchange(uint16_t *a, uint16_t new_val) {
- return InterlockedExchange16(a, new_val);
+ // InterlockedExchange16 seems unavailable on some MSVS installations.
+ // Everybody stand back, I pretend to know inline assembly!
+ // FIXME: I assume VC is smart enough to save/restore eax/ecx?
+ __asm {
+ mov eax, a
+ mov cx, new_val
+ xchg [eax], cx
+ mov new_val, cx
+ }
+ return new_val;
}
const char* AsanGetEnv(const char* name) {
More information about the llvm-commits
mailing list