Question about atomic builtin functions in gcc for rtems.

Marcos Díaz marcos.diaz at
Wed Aug 12 20:28:02 UTC 2015

Hi, i was using some c++11 concurrency classes on ARM (with gcc 4.9.2) that
have an underlying use of libgcc atomic functions, for
example __gnu_cxx::__atomic_add_dispatch. In its implementation, (in the
file gcc-sources/libstdc++-v3/include/ext/atomicity.h) I can see that the
macro _GLIBCXX_ATOMIC_BUILTINS is not defined, and therefore the builtin
implementation of __atomic_fetch_add is not used. Instead, the mutex
implementation is used which makes it significantly slower.
As far as I could see, if I explicitly call one of these atomic built-in
functions they work ok and the correct atomic assembly is emitted (using
ARM's ldrex and strex instructions).
 So, the question is why this _GLIBCXX_ATOMIC_BUILTINS macro is disabled.
is there a reason why we aren't using the atomic builtins, or I need to
enable it. How can we do the enabling? Is the implementation incomplete?




Marcos Díaz

Software Engineer

San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina

Phone: +54 351 4217888 / +54 351 4218211/ +54 351 7617452

Skype: markdiaz22
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the devel mailing list