http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53284
--- Comment #2 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> 2012-05-09 11:45:10 UTC --- > --- Comment #1 from Richard Henderson <rth at gcc dot gnu.org> 2012-05-08 > 22:39:35 UTC --- > Can you investigate why configure decides that __atomic_compare_exchange_8 > is implemented inline? That it isn't inline is obvious from the recursion. That was the critical hint, thanks. Comparing i386-pc-solaris2.10 and i686-unknown-linux-gnu config.log, I see that in the Linux case the test is run as a link test and includes -fno-sync-libcalls $XCFLAGS, while in the Solaris case, it's an compile test and lacks all of them. > Was the configure change to CFLAGS in fact wrong? No, that's unrelated. The following patch works for me and lets all tests in the above configuration pass. I've chosen to add to CFLAGS rather than adding $XCFLAGS since otherwise we loose -fno-sync-libcalls. Ok for mainline? Thanks. Rainer 2012-05-09 Rainer Orth <r...@cebitec.uni-bielefeld.de> * acinclude.m4 (LIBAT_TEST_ATOMIC_BUILTIN): Add -O0 -S to CFLAGS instead of overriding. * configure: Regenerate. diff --git a/libatomic/acinclude.m4 b/libatomic/acinclude.m4 --- a/libatomic/acinclude.m4 +++ b/libatomic/acinclude.m4 @@ -67,7 +67,7 @@ AC_DEFUN([LIBAT_TEST_ATOMIC_BUILTIN],[ else old_CFLAGS="$CFLAGS" # Compile unoptimized. - CFLAGS='-O0 -S' + CFLAGS="$CFLAGS -O0 -S" if AC_TRY_EVAL(ac_compile); then if grep __atomic_ conftest.s >/dev/null 2>&1 ; then eval $2=no