GNOME Bugzilla – Bug 137006
Investigate asm contstraints in gatomic.c
Last modified: 2011-05-28 21:00:09 UTC
glib/gatomic.c failed to built for me with a "inconsistent asm constraints" error. I made a couple of changes and it seems to work. I'll attatch a patch.
Created attachment 25574 [details] [review] patch to fix glib/gatomic.c for PPC. There are two superfluos (I think) asm constraints in g_atomic_int_add() and g_atomic_int_exchange_and_add().
See recent discussion on gtk-devel-list.
I'm hesitant to remove the constraints without fully understanding why they aren't needed. At cursory glance, I don't think they are, since I think they are simply there to force reloads of any register cached values of *atomic, since glibc has these as #defines and not functions. But I'd like a second opinion. I'm going to apply Sebastian's patch to disable the asm when compiling with -O0, and will punt this for future investigation.
Fri Mar 12 15:21:22 2004 Manish Singh <yosh@gimp.org> * glib/gatomic.c: Non-optimizing compile fails for two asm statements on PowerPC. Use generic implementaton for those cases. Spotted by Christof Petig <christof@petig-baender.de>, fix by Sebastian Wilhelmi. Bug #137006 has a possible alternate solution, but we'll be conservative for now.
Shouldn't this bug be closed now ?
See above "... and will punt this for future investigation."
Still can't compile gatomic.c from CVS (as of pre 2.5.3) on a powerpc-ibm-aix5.2.0.0 using gcc-3.3.2. I always get assembler errors in g_atomic_int_compare_and_exchange/g_atomic_pointer_compare_and_exchange, and with optimization -O2, in g_atomic_int_exchange_and_add/g_atomic_int_add too. I don't use gas, if this does matter.
The asm implementation has been removed in a rewrite of gatomic.c