Re[2]: [Gc] atomic_ops on ARM compile bug

Ivan Maidanski ivmai at mail.ru
Wed Sep 15 12:28:06 PDT 2010


Hi!

Fixed.

It turned out that arm case is somewhat special - it defines CAS but not CAS_full, so emul_cas.h is not included.

So, I've defined AO_GENERALIZE_TWICE after include emul_cas.h provided AO_CAN_EMUL_CAS is defined but AO_HAVE_compare_and_swap_full is not.

Tue, 14 Sep 2010 23:00:49 +0000 "Boehm, Hans" <hans.boehm at hp.com>:

> I unfortunately don't remember the details of what triggers this, and it
> would be good to document it better.  I think we don't need the double
> generalization on platforms that directly implement compare_and_swap_full?
> Since the failure mode here is a compiler error, and we haven't yet seen
> it on other platforms, I'd be inclined to add a comment to try
> AO_GENERALIZE_TWICE if something ends up unexpectedly undefined, and just add
> it for the platforms that need it.  It looks to me like strongly ordered
> architectures are unlikely to need it, powerpc doesn't appear to need it,
> and alpha and ia64 already have it.  Maybe this really is just a bug for ARM?
> Hans
> > -----Original Message-----
> > From: Ivan Maidanski [mailto:ivmai at mail.ru]
> > Sent: Tuesday, September 14, 2010 1:38 PM
> > To: Gregory Farnum
> > Cc: gc at linux.hpl.hp.com; Boehm, Hans
> > Subject: Re: [Gc] atomic_ops on ARM compile bug
> > 
> > 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 hq.newdream.net>:
> > 
> > > 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:
> > > https://bugs.launchpad.net/ubuntu/+source/ceph/+bug/635388
> > > (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]:
> > > g++ -DHAVE_CONFIG_H -I. -Wall -D__CEPH__ -D_FILE_OFFSET_BITS=64
> > > -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