Re: [Gc] atomic_ops on ARM compile bug

Ivan Maidanski ivmai at
Tue Sep 14 13:38:27 PDT 2010

Hi, Gregory!

I see the problem. It seems to me that the problem is not only for arm target.

The more reliable fix is to replace AO_GENERALIZE_TWICE with !AO_GENERALIZE_ONCE nad define the latter only for x86/amd64.

Hans -
your comments, please...

Tue, 14 Sep 2010 13:16:46 -0700 Gregory Farnum <gregf at>:

> I'm one of the developers on Ceph ( and we've been
> using and enjoying atomic-ops in our userspace stuff. There's a recent
> compile-time bug report running on Ubuntu armel, available at:
> (I've pasted in the compile error below. [1])
> As I imply there, I tried to trace through the macro generation and
> believe this is simply because ARM provides few enough hardware
> instructions that generalize.h needs to be run through a few times in
> order to generate all the macro/function calls in the correct order,
> so defining AO_GENERALIZE_TWICE for the arm architecture ought to
> solve this.
> Sadly, I don't have an ARM platform available to check and our brief
> attempt to set up a QEMU version failed, so if
> anybody could somehow confirm this solution for me, I'd appreciate it.

You don't need the target platform to see whether the compilation succeeds - just use mingwce or VC++ for arm toolchains.

> Once confirmed, it'd also be good if
> the fix got put into the appropriate source repositories. :)
> Thanks!
> -Greg
> [1]:
> -D_REENTRANT -D_THREAD_SAFE -rdynamic -g -O2 -MT
> AuthAuthorizeHandler.o -MD -MP -MF .deps/AuthAuthorizeHandler.Tpo -c
> -o AuthAuthorizeHandler.o `test -f 'auth/' ||
> echo './'`auth/
> In file included from ./include/buffer.h:55,
> from ./include/encoding.h:20,
> from ./include/object.h:29,
> from ./include/types.h:64,
> from auth/Crypto.h:17,
> from auth/Auth.h:18,
> from auth/
> ./include/atomic.h: In member function 'size_t ceph::atomic_t::dec()':
> ./include/atomic.h:36: error: 'AO_fetch_and_sub1_write' was not
> declared in this scope
> ./include/atomic.h: In member function 'void
> ceph::atomic_t::sub(int)':
> ./include/atomic.h:43: error: 'AO_fetch_and_add_write' was not
> declared in this scope
> make[3]: *** [AuthAuthorizeHandler.o] Error 1
> The atomic_ops header is properly included in the referenced atomic.h
> file, and an earlier line "AO_fetch_and_add1(&val);
> " compiles without incident.

More information about the Gc mailing list