[llvm-commits] [compiler-rt] r171948 - in /compiler-rt/trunk/lib/ubsan: lit_tests/Misc/deduplication.cpp ubsan_handlers.cc ubsan_handlers_cxx.cc ubsan_value.h

Will Dietz wdietz2 at illinois.edu
Tue Jan 8 22:24:28 PST 2013


Hmm, interesting.

For now I've dropped the attempt to use __atomic_exchange_n from the
code, r171955.

Thoughts on how to properly do this check welcome, although perhaps we
should just leave it with the TAS.

~Will

On Tue, Jan 8, 2013 at 11:33 PM, Meador Inge <meadori at codesourcery.com> wrote:
>
> On Jan 8, 2013, at 9:40 PM, Will Dietz wrote:
>
>>
>> +#ifdef __ATOMIC_RELAXED
>> +    // Use weaker ordering if available (relaxed/monotonic)
>> +    u32 OldColumn = __atomic_exchange_n(&Column, ~u32(0), __ATOMIC_RELAXED);
>> +#else
>> +    // Otherwise, do a TAS which has acquire semantics, stronger than needed.
>> +    u32 OldColumn = __sync_lock_test_and_set(&Column, ~u32(0));
>> +#endif
>> +    return SourceLocation(Filename, Line, OldColumn);
>
> What toolchains and what versions of those toolchains are these atomic
> builtins expected to be available?  The system clang on my OS X 10.7.5
> does *not* have these builtins and I get a build break of the form
> when trying to build now:
>
>    $ clang --version
>    Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM 3.1svn)
>    Target: x86_64-apple-darwin11.4.2
>    Thread model: posix
>
>>
>    error:
>       use of undeclared identifier '__atomic_exchange_n'
>     u32 OldColumn = __atomic_exchange_n(&Column, ~u32(0), __ATOMIC_RELAXED);
>
> Looks like many of the atomic builtins were added to Clang last April [1].
> I am not sure if they are OK to use in the LLVM code base or not.
>
> [1] http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120409/056079.html
>
> --
> Meador Inge
> CodeSourcery / Mentor Embedded
> http://www.mentor.com/embedded-software
>




More information about the llvm-commits mailing list