[PATCH] Repair cmake libatomic check.

James Y Knight jyknight at google.com
Mon Jun 15 21:28:49 PDT 2015

Thanks. I'll land it in the morning when I can watch for problems. :)

As to the side note:

GCC can do it only because its default target on Debian is the "v8plus"
mode, which is the SparcV8 32bit calling convention/ABI, but assuming a
minimum of a Sparc V9 CPU to execute on. This allows the use of the V9
instructions, and the ability to store 64bit values in some of the

But, a base Sparc V8 truly cannot support native atomic-ops (in GCC
either), because it doesn't have a CAS instruction or LL/SC. The only
primitive atomic ops available are swap, load, and store, which are only
enough to implement locks.

There's not even any magic kernel userspace-helper routine for doing atomic
cmpxchg, like there is for ARMv5, presumably because nobody really cares
about base sparc v8: the v9 cpu was introduced 20 years ago, and even the
popular LEON embedded sparcv8 chip has CAS an an extension (though,
unfortunately incompatible with the v9 one, for somewhat-reasonable

Anyways, currently LLVM supports v9 only in the 64bit ABI, not as a cpu for
the v8 ABI. Thus, the lack of atomics support here is actually working as
intended -- for the "v8" cpu that LLVM is compiling for.



More information about the llvm-commits mailing list