[PATCH] D120026: [ARM] Fix ARM backend to correctly use atomic expansion routines.

Alan Phipps via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 14:08:54 PDT 2022


alanphipps added a comment.

> There is no way to implement an "atomic" operation on an M0 besides turning off interrupts, and we don't want the builtins library to mess with the interrupt mask.  I'd expect the OS/user to provide the functionality, if they need it.  compiler-rt doesn't provide __sync_* for cortex-m0, for the same reason.
>
> I'm not sure how your setup was working before.  I guess maybe if you only need atomics for C++ static local vars, and you built libc++abi with LIBCXXABI_HAS_NO_THREADS?  If you don't actually need threading/atomics, you can use `-fno-threadsafe-statics` and/or `-mthread-model single`.

OK thank you for answering my questions. Our downstream compiler targets primarily baremetal systems on embedded devices, so we can't rely on an OS provided implementation of atomics.  I suspect we're not the only downstream compiler impacted. I will try the options you suggest and let you know, but we may have to do something else to work around the effects of this commit.  We weren't doing anything special other than what was out of the box, so this change took us by surprise.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120026/new/

https://reviews.llvm.org/D120026



More information about the llvm-commits mailing list