From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29486 invoked by alias); 22 Sep 2016 08:47:53 -0000 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 Received: (qmail 29312 invoked by uid 89); 22 Sep 2016 08:47:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*devel, expressed X-Spam-User: qpsmtpd, 2 recipients X-HELO: dedi548.your-server.de Received: from dedi548.your-server.de (HELO dedi548.your-server.de) (85.10.215.148) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Sep 2016 08:47:49 +0000 Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1bmzfW-0002de-A2; Thu, 22 Sep 2016 10:47:46 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bmzfV-0006AE-Vb; Thu, 22 Sep 2016 10:47:46 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 1BB3B2A180D; Thu, 22 Sep 2016 10:48:13 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id U7DEw0p-0xAA; Thu, 22 Sep 2016 10:48:12 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id AB4552A1808; Thu, 22 Sep 2016 10:48:12 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Rb0IcNZHw_Ki; Thu, 22 Sep 2016 10:48:12 +0200 (CEST) Received: from huber-linux.eb.localhost (unknown [192.168.96.129]) by mail.embedded-brains.de (Postfix) with ESMTP id 8936C2A01AE; Thu, 22 Sep 2016 10:48:12 +0200 (CEST) From: Sebastian Huber To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, devel@rtems.org, Sebastian Huber Subject: [PATCH v2] [RTEMS] Always use atomic builtins for libstdc++ Date: Thu, 22 Sep 2016 08:50:00 -0000 Message-Id: <1474534063-8867-1-git-send-email-sebastian.huber@embedded-brains.de> X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg01502.txt.bz2 v2: Fix shell script part since shell grouping is expressed by { }. libstdc++-v3/ * config/cpu/m68k/atomicity.h: Adjust comment. * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Honor explicit atomicity_dir setup via configure.host. * configure.host (rtems-*): Set atomicity_dir. * configure: Regenerate. --- libstdc++-v3/acinclude.m4 | 5 +++-- libstdc++-v3/config/cpu/m68k/atomicity.h | 3 +++ libstdc++-v3/configure | 11 ++++++----- libstdc++-v3/configure.host | 4 ++++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 6d897be..d7db435 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -3490,9 +3490,10 @@ EOF AC_LANG_RESTORE # Set atomicity_dir to builtins if all but the long long test above passes. - if test "$glibcxx_cv_atomic_bool" = yes \ + if { test "$glibcxx_cv_atomic_bool" = yes \ && test "$glibcxx_cv_atomic_short" = yes \ - && test "$glibcxx_cv_atomic_int" = yes; then + && test "$glibcxx_cv_atomic_int" = yes } \ + || test "$atomicity_dir" = "cpu/generic/atomicity_builtins"; then AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1, [Define if the compiler supports C++11 atomics.]) atomicity_dir=cpu/generic/atomicity_builtins diff --git a/libstdc++-v3/config/cpu/m68k/atomicity.h b/libstdc++-v3/config/cpu/m68k/atomicity.h index f421330..a9ddc6b 100644 --- a/libstdc++-v3/config/cpu/m68k/atomicity.h +++ b/libstdc++-v3/config/cpu/m68k/atomicity.h @@ -48,6 +48,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #elif defined(__rtems__) + // This code is only provided for reference. RTEMS uses now the atomic + // builtins and libatomic. See configure.host. + // // TAS/JBNE is unsafe on systems with strict priority-based scheduling. // Disable interrupts, which we can do only from supervisor mode. _Atomic_word diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 6332c4d..d09a7e0 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -15539,9 +15539,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Set atomicity_dir to builtins if all but the long long test above passes. - if test "$glibcxx_cv_atomic_bool" = yes \ + if { test "$glibcxx_cv_atomic_bool" = yes \ && test "$glibcxx_cv_atomic_short" = yes \ - && test "$glibcxx_cv_atomic_int" = yes; then + && test "$glibcxx_cv_atomic_int" = yes } \ + || test "$atomicity_dir" = "cpu/generic/atomicity_builtins"; then $as_echo "#define _GLIBCXX_ATOMIC_BUILTINS 1" >>confdefs.h @@ -15573,7 +15574,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15576 "configure" +#line 15577 "configure" int main() { _Decimal32 d1; @@ -15615,7 +15616,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15618 "configure" +#line 15619 "configure" template struct same { typedef T2 type; }; @@ -15649,7 +15650,7 @@ $as_echo "$enable_int128" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15652 "configure" +#line 15653 "configure" template struct same { typedef T2 type; }; diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host index c0cc3ee..eb56ab1 100644 --- a/libstdc++-v3/configure.host +++ b/libstdc++-v3/configure.host @@ -296,6 +296,10 @@ case "${host_os}" in os_include_dir="os/qnx/qnx6.1" c_model=c ;; + rtems*) + # Use libatomic if necessary and avoid libstdc++ specific atomicity support + atomicity_dir="cpu/generic/atomicity_builtins" + ;; solaris2) # This too-vague configuration does not provide enough information # to select a ctype include, and thus os_include_dir is a crap shoot. -- 1.8.4.5