[patch?] Linux ARM atomics

John McCall rjmccall at apple.com
Mon Apr 15 10:27:58 PDT 2013

On Apr 14, 2013, at 5:32 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> With the attached patch I can bootstrap clang on my new ARM chromebook
> running fedora 18.
> The thing is, I don't really understand what this code is doing :-(
> Why is clang in the business of deciding what gets compiled into a
> libgcc/compilerrt call? Shouldn't it always produce IL that uses the
> atomic operations and let LLVM produce the compiler-rt calls when it
> knows the backend can't handle it?

The use of a library function is ABI and therefore a natural frontend responsibility.
Among other things:
  - the atomic library functions are not guaranteed to be atomic w.r.t. the processor's
    primitive atomics and
  - different targets may require us to use a different set of atomic library functions
    or provide slightly different semantics to them.

So it makes sense for the backend to require that the frontend just not emit
illegal primitive atomic operations.

The current design where atomic library routines are statically linked in from
compiler-rt allows us to compile things we wouldn't otherwise but is extremely
problematic for library interoperation.


More information about the cfe-commits mailing list