From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15470 invoked by alias); 11 Dec 2009 04:20:10 -0000 Received: (qmail 15428 invoked by uid 22791); 11 Dec 2009 04:20:05 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from adelie.canonical.com (HELO adelie.canonical.com) (91.189.90.139) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Dec 2009 04:19:58 +0000 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NIwyw-00023w-Ps; Fri, 11 Dec 2009 04:19:54 +0000 Received: from dslb-088-073-103-141.pools.arcor-ip.net ([88.73.103.141] helo=[192.168.42.17]) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NIwyw-00042p-8N; Fri, 11 Dec 2009 04:19:54 +0000 Message-ID: <4B21C863.405@ubuntu.com> Date: Fri, 11 Dec 2009 08:48:00 -0000 From: Matthias Klose User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7pre) Gecko/20091206 Shredder/3.0.1pre MIME-Version: 1.0 To: Paolo Carlini CC: "libstdc++@gcc.gnu.org" , Richard Earnshaw , Andrew Haley , Jakub Jelinek , Alexandre Oliva , Nathan Froyd , GCC Patches , GCJ-patches Subject: Re: [ping2] Re: [ping] Re: [patch] PR40134, use a linker script on arm-linux to link with -lgcc_s -lgcc References: <4A530F5C.4040500@ubuntu.com> <20090707091425.GB4462@tyan-ft48-01.lab.bos.redhat.com> <4A5B32BB.5010308@ubuntu.com> <20090909112436.GV14664@tyan-ft48-01.lab.bos.redhat.com> <4AAA8510.8060906@ubuntu.com> <4AB8C07D.3010807@ubuntu.com> <4AB8F3C2.60909@redhat.com> <4ABB2CB3.8090800@ubuntu.com> <4ABB30DE.6050502@redhat.com> <4ABB3BE6.4060800@ubuntu.com> <4ABB4C9B.3070200@redhat.com> <1255527525.4842.29.camel@e200601-lin.cambridge.arm.com> <4ADF0B67.9070505@ubuntu.com> <4AEA2FF1.6060508@ubuntu.com> <4AEA3318.6060607@oracle.com> <4AEF025A.5060403@ubuntu.com> <4AEF08BF.4020500@oracle.com> <4AFC5187.2010909@ubuntu.com> <4AFC54A0.7080109@oracle.com> <4B1F7F16.8050708@ubuntu.com> <4B1F80DF.5020402@oracle.com> In-Reply-To: <4B1F80DF.5020402@oracle.com> Content-Type: multipart/mixed; boundary="------------030502050805010106020200" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-12/txt/msg00575.txt.bz2 This is a multi-part message in MIME format. --------------030502050805010106020200 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 692 On 09.12.2009 11:50, Paolo Carlini wrote: > On 12/09/2009 11:42 AM, Matthias Klose wrote: >> would a patch acceptable to run these link tests on linux only? > > Sure. If you can cook up something (e.g, a version of the configure code > I wrote at the time) running only where it's safe to run it (I think > linux targets are all safe), fine with me! the attached patch enables the link tests on linux, kfreebsd, and hurd targets. checked with the (Debian) kfreebsd and hurd maintainers that this is the right thing to do (although there doesn't exist an active port of these on arm or hppa. tested on i486-linux-gnu, arm-linux-gnueabi and hppa-linux-gnu. ok for the trunk? Matthias --------------030502050805010106020200 Content-Type: text/plain; name="pr40133.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr40133.diff" Content-length: 7519 libstdc++-v3/ 2009-12-09 Paolo Carlini Matthias Klose PR libstdc++/40133 * acinclude.m4 ([GLIBCXX_ENABLE_ATOMIC_BUILTINS]): On *-*-linux*, *-*-kfreebsd*-gnu | *-*-gnu* targets do link tests when possible. * configure: Regenerate. Index: libstdc++-v3/acinclude.m4 =================================================================== --- a/src/libstdc++-v3/acinclude.m4 (revision 155104) +++ b/src/libstdc++-v3/acinclude.m4 (working copy) @@ -2438,8 +2438,7 @@ dnl that are used should be checked. dnl dnl Note: -dnl libgomp and libgfortran do this with a link test, instead of an asm test. -dnl see: CHECK_SYNC_FETCH_AND_ADD +dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD. dnl dnl Defines: dnl _GLIBCXX_ATOMIC_BUILTINS_1 @@ -2451,12 +2450,120 @@ AC_LANG_SAVE AC_LANG_CPLUSPLUS old_CXXFLAGS="$CXXFLAGS" - + + # Do link tests if possible, instead asm tests, limited to some platforms + atomic_builtins_link_tests=no + if test x$gcc_no_link != xyes; then + # Can do link tests. Limit to some tested platforms + case "$host" in + *-*-linux* | *-*-kfreebsd*-gnu | *-*-gnu*) + atomic_builtins_link_tests=yes + ;; + esac + fi + + if test x$atomic_builtins_link_tests = xyes; then + + # Do link tests. + + CXXFLAGS="$CXXFLAGS -fno-exceptions" + + AC_MSG_CHECKING([for atomic builtins for bool]) + AC_CACHE_VAL(glibcxx_cv_atomic_bool, [ + AC_TRY_LINK( + [ ], + [typedef bool atomic_type; + atomic_type c1; + atomic_type c2; + const atomic_type c3(0); + __sync_fetch_and_add(&c1, c2); + __sync_val_compare_and_swap(&c1, c3, c2); + __sync_lock_test_and_set(&c1, c3); + __sync_lock_release(&c1); + __sync_synchronize();], + [glibcxx_cv_atomic_bool=yes], + [glibcxx_cv_atomic_bool=no]) + ]) + if test $glibcxx_cv_atomic_bool = yes; then + AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1, + [Define if builtin atomic operations for bool are supported on this host.]) + fi + AC_MSG_RESULT($glibcxx_cv_atomic_bool) + + AC_MSG_CHECKING([for atomic builtins for short]) + AC_CACHE_VAL(glibcxx_cv_atomic_short, [ + AC_TRY_LINK( + [ ], + [typedef short atomic_type; + atomic_type c1; + atomic_type c2; + const atomic_type c3(0); + __sync_fetch_and_add(&c1, c2); + __sync_val_compare_and_swap(&c1, c3, c2); + __sync_lock_test_and_set(&c1, c3); + __sync_lock_release(&c1); + __sync_synchronize();], + [glibcxx_cv_atomic_short=yes], + [glibcxx_cv_atomic_short=no]) + ]) + if test $glibcxx_cv_atomic_short = yes; then + AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1, + [Define if builtin atomic operations for short are supported on this host.]) + fi + AC_MSG_RESULT($glibcxx_cv_atomic_short) + + AC_MSG_CHECKING([for atomic builtins for int]) + AC_CACHE_VAL(glibcxx_cv_atomic_int, [ + AC_TRY_LINK( + [ ], + [typedef int atomic_type; + atomic_type c1; + atomic_type c2; + const atomic_type c3(0); + __sync_fetch_and_add(&c1, c2); + __sync_val_compare_and_swap(&c1, c3, c2); + __sync_lock_test_and_set(&c1, c3); + __sync_lock_release(&c1); + __sync_synchronize();], + [glibcxx_cv_atomic_int=yes], + [glibcxx_cv_atomic_int=no]) + ]) + if test $glibcxx_cv_atomic_int = yes; then + AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1, + [Define if builtin atomic operations for int are supported on this host.]) + fi + AC_MSG_RESULT($glibcxx_cv_atomic_int) + + AC_MSG_CHECKING([for atomic builtins for long long]) + AC_CACHE_VAL(glibcxx_cv_atomic_long_long, [ + AC_TRY_LINK( + [ ], + [typedef long long atomic_type; + atomic_type c1; + atomic_type c2; + const atomic_type c3(0); + __sync_fetch_and_add(&c1, c2); + __sync_val_compare_and_swap(&c1, c3, c2); + __sync_lock_test_and_set(&c1, c3); + __sync_lock_release(&c1); + __sync_synchronize();], + [glibcxx_cv_atomic_long_long=yes], + [glibcxx_cv_atomic_long_long=no]) + ]) + if test $glibcxx_cv_atomic_long_long = yes; then + AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1, + [Define if builtin atomic operations for long long are supported on this host.]) + fi + AC_MSG_RESULT($glibcxx_cv_atomic_long_long) + + else + + # Do asm tests. + # Compile unoptimized. CXXFLAGS='-O0 -S' - # Fake what AC_TRY_COMPILE does, without linking as this is - # unnecessary for a builtins test. + # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF [#]line __oline__ "configure" @@ -2478,14 +2585,14 @@ AC_MSG_CHECKING([for atomic builtins for bool]) if AC_TRY_EVAL(ac_compile); then if grep __sync_ conftest.s >/dev/null 2>&1 ; then - enable_atomic_builtinsb=no + glibcxx_cv_atomic_bool=no else AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1, [Define if builtin atomic operations for bool are supported on this host.]) - enable_atomic_builtinsb=yes + glibcxx_cv_atomic_bool=yes fi fi - AC_MSG_RESULT($enable_atomic_builtinsb) + AC_MSG_RESULT($glibcxx_cv_atomic_bool) rm -f conftest* cat > conftest.$ac_ext << EOF @@ -2508,14 +2615,14 @@ AC_MSG_CHECKING([for atomic builtins for short]) if AC_TRY_EVAL(ac_compile); then if grep __sync_ conftest.s >/dev/null 2>&1 ; then - enable_atomic_builtinss=no + glibcxx_cv_atomic_short=no else AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1, [Define if builtin atomic operations for short are supported on this host.]) - enable_atomic_builtinss=yes + glibcxx_cv_atomic_short=yes fi fi - AC_MSG_RESULT($enable_atomic_builtinss) + AC_MSG_RESULT($glibcxx_cv_atomic_short) rm -f conftest* cat > conftest.$ac_ext << EOF @@ -2539,14 +2646,14 @@ AC_MSG_CHECKING([for atomic builtins for int]) if AC_TRY_EVAL(ac_compile); then if grep __sync_ conftest.s >/dev/null 2>&1 ; then - enable_atomic_builtinsi=no + glibcxx_cv_atomic_int=no else AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1, [Define if builtin atomic operations for int are supported on this host.]) - enable_atomic_builtinsi=yes + glibcxx_cv_atomic_int=yes fi fi - AC_MSG_RESULT($enable_atomic_builtinsi) + AC_MSG_RESULT($glibcxx_cv_atomic_int) rm -f conftest* cat > conftest.$ac_ext << EOF @@ -2569,22 +2676,23 @@ AC_MSG_CHECKING([for atomic builtins for long long]) if AC_TRY_EVAL(ac_compile); then if grep __sync_ conftest.s >/dev/null 2>&1 ; then - enable_atomic_builtinsll=no + glibcxx_cv_atomic_long_long=no else AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1, [Define if builtin atomic operations for long long are supported on this host.]) - enable_atomic_builtinsll=yes + glibcxx_cv_atomic_long_long=yes fi fi - AC_MSG_RESULT($enable_atomic_builtinsll) + AC_MSG_RESULT($glibcxx_cv_atomic_long_long) rm -f conftest* + fi CXXFLAGS="$old_CXXFLAGS" AC_LANG_RESTORE # Set atomicity_dir to builtins if either of above tests pass. - if test $enable_atomic_builtinsi = yes || test $enable_atomic_builtinsb = yes ; then + if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then atomicity_dir=cpu/generic/atomicity_builtins fi --------------030502050805010106020200--