[Gc] atomic_ops on ARM compile bug

Gregory Farnum gregf at hq.newdream.net
Tue Sep 14 13:16:46 PDT 2010

I'm one of the developers on Ceph (ceph.newdream.net) 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.
Once confirmed, it'd also be good if
the fix got put into the appropriate source repositories. :)

-D_REENTRANT -D_THREAD_SAFE -rdynamic -g -O2 -MT
AuthAuthorizeHandler.o -MD -MP -MF .deps/AuthAuthorizeHandler.Tpo -c
-o AuthAuthorizeHandler.o `test -f 'auth/AuthAuthorizeHandler.cc' ||
echo './'`auth/AuthAuthorizeHandler.cc
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/AuthAuthorizeHandler.cc:1:
./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