[llvm-commits] [compiler-rt] r154106 - /compiler-rt/trunk/lib/asan/asan_win.cc

Kostya Serebryany kcc at google.com
Thu Apr 5 10:42:24 PDT 2012


Thanks!
Still, OMG! InterlockedExchange16 is present in the online docs, but not in
the actual MSVC headers.

On Thu, Apr 5, 2012 at 10:16 AM, Timur Iskhodzhanov <timurrrr at google.com>wrote:

> 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) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120405/75b0d3c5/attachment.html>


More information about the llvm-commits mailing list