[compiler-rt] r242003 - sanitizer_common: Only use _ReadWriteBarrier when targeting MSVC cl.exe.

Peter Collingbourne peter at pcc.me.uk
Mon Jul 13 03:06:58 PDT 2015


It is simpler than that. sanitizer_common does not #include intrin.h but
rather declares intrinsics manually. This isn't compatible with how we
implement intrin.h in Clang.

Peter

On Sun, Jul 12, 2015 at 08:45:00PM -0700, David Majnemer wrote:
> Doesn't this mean that our implementation of _ReadWriteBarrier isn't
> compatible?  What if it was implemented as __atomic_signal_fence(5)?
> 
> On Sun, Jul 12, 2015 at 5:26 PM, Peter Collingbourne <peter at pcc.me.uk>
> wrote:
> 
> > Author: pcc
> > Date: Sun Jul 12 19:26:04 2015
> > New Revision: 242003
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=242003&view=rev
> > Log:
> > sanitizer_common: Only use _ReadWriteBarrier when targeting MSVC cl.exe.
> >
> > Fixes check-ubsan when self hosting on Windows.
> >
> > Modified:
> >     compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
> >
> > Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
> > URL:
> > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=242003&r1=242002&r2=242003&view=diff
> >
> > ==============================================================================
> > --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
> > +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Sun Jul 12
> > 19:26:04 2015
> > @@ -661,7 +661,7 @@ void MaybeStartBackgroudThread();
> >  // compiler from recognising it and turning it into an actual call to
> >  // memset/memcpy/etc.
> >  static inline void SanitizerBreakOptimization(void *arg) {
> > -#if _MSC_VER
> > +#if _MSC_VER && !defined(__clang__)
> >    _ReadWriteBarrier();
> >  #else
> >    __asm__ __volatile__("" : : "r" (arg) : "memory");
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >

-- 
Peter



More information about the llvm-commits mailing list