summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_win.cc
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2012-04-05 17:16:32 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2012-04-05 17:16:32 +0000
commit088109230606b758af5255b3378364126117bc64 (patch)
tree4eb2a7ee1a98dbb02c8c212d004c07f7e8b09e18 /compiler-rt/lib/asan/asan_win.cc
parent3c9bc4dbdb8878d3bd3e2ad9034a25e2e50b53cd (diff)
downloadbcm5719-llvm-088109230606b758af5255b3378364126117bc64.tar.gz
bcm5719-llvm-088109230606b758af5255b3378364126117bc64.zip
[ASan/Win] Fix build by using inline assembly instead of an unavailable intrinsic function
llvm-svn: 154106
Diffstat (limited to 'compiler-rt/lib/asan/asan_win.cc')
-rw-r--r--compiler-rt/lib/asan/asan_win.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler-rt/lib/asan/asan_win.cc b/compiler-rt/lib/asan/asan_win.cc
index baa8268b397..dbc77c34e4c 100644
--- a/compiler-rt/lib/asan/asan_win.cc
+++ b/compiler-rt/lib/asan/asan_win.cc
@@ -235,7 +235,16 @@ int AtomicInc(int *a) {
}
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) {
OpenPOWER on IntegriCloud