https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78357
--- Comment #3 from Chung-Lin Tang <cltang at gcc dot gnu.org> --- (In reply to Sebastian Huber from comment #2) > (In reply to Chung-Lin Tang from comment #1) > > Sebastian, I'm not sure what your problem is. The atomics in nios2 are > > implemented by __sync_* functions placed in libgcc. The built-in function > > expansion inside GCC is aware of this, and __atomic_* functions get mapped > > to those. Is there anything affecting your use? > > I think this mapping of __atomic_* functions to __sync_* functions is > wrong/outdated. Is this a speciality of the Nios II support? I am not > aware of a second target support in GCC which does this. The __sync_* > builtins are a legacy API: > > https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins. > html#g_t_005f_005fsync-Builtins Nios II is not the only target which implements __sync_*, see the libgcc source code for details. In the current GCC code expansion paths, the __atomic_* functions are meant to expand to hardware instruction sequences. In cases where we need to generate library calls for atomics, GCC only generates __sync_* calls. > > > > libatomic is usually supported by those targets with more "rich" atomic > > instructions, and nios2 in its current form is obviously not one of them. > > The libatomic is for architectures which lack atomic instructions. To clarify/correct my above statement, we do build libatomic like other targets, but the basic __atomic_* functions used inside it is also generated as __sync_* calls. libatomic does NOT directly "implement" the basic __atomic_* operations, that's supposed to be done inside the compiler. Can you more specifically describe what you're trying to do? Or is this just a general query?