GNOME Bugzilla – Bug 491990
PATCH: glib2 build problem (bc out of range) on PowerPC Mac OS X 10.5 Leopard
Last modified: 2008-01-07 03:41:17 UTC
I am the maintainer of glib2 for the MacPorts package manager system. I have several reports that glib2 2.14.2 fails to build on PowerPC Macs with Mac OS X 10.5 Leopard, giving this error: ld: bc out of range (572176 max is +/-64K) from _g_atomic_int_exchange_and_add in .libs/gatomic.o to _g_atomic_int_exchange_and_add$stub in .libs/libglib-2.0.0.1400.2.dylib in _g_atomic_int_exchange_and_add from .libs/gatomic.o collect2: ld returned 1 exit status make[4]: *** [libglib-2.0.la] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Error: Status 1 encountered during processing. This is our bug on this issue: http://trac.macports.org/projects/macports/ticket/13052 The solution is apparently a small change to gatomic.c. I'll attach a patch. The patch was created (I believe) by David DeHaven, here, where he describes why he made the changes: http://lists.macosforge.org/pipermail/macports-users/2007-September/005663.html Does this look correct to you? If so, I can apply this patch to glib2 in MacPorts until such a time as it is included in a glib release.
Created attachment 98227 [details] [review] David DeHaven solution
See also Bug #445362, which appears to be the same symptom but an entirely different diagnosis and (proposed) solution.
When I implemented this fix, a make check took +6 hours on my 2GHz G5, and rendered the system unresponsive. I am not 100% nop calls are the way to go.
I originally reported this as a problem against the Leopard linker, as per bug 445362; he indicated, as per that bug, that The use of .L prefix for labels is an ELF thing. On Mac OS X you use just L prefix. The cross platform way to do this is numbered labels and have the branches use the 'b' or 'f' suffix for back or forward. and also that The code worked before by luck. This should probably be closed as a duplicate of 445362; I'll be testing the fix on my PowerPC Leopard machine at work later today.
Guy, what was the outcome of your testing ? Anyway, I'll go ahead and mark this as a dupe. *** This bug has been marked as a duplicate of 445362 ***
The fix from 445362 worked fine; the code Just Works on Leopard with no changes now.