From patchwork Thu Sep 22 08:47:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 673223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sfqsK4ZGkz9rxv for ; Thu, 22 Sep 2016 18:48:37 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=UQxCopeo; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=i6ICnouwKhAF GUGAIWgDfMP7pM1tH0qk1mcZrHLDfL0dufUTlzhKQzKgflaoBjt0HDLNkseJBd1d hs92AkF1tCDURkPi/Y5pJbbYP43IRZmNqhjPO/2el/M5ipfZu5Ll/ut6FlARuNS3 sO4cmobtF/pNsqodKgsn9OYgDMu1giM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=nsYP9oI9b9dFeDPogF 4yk7qIJ2A=; b=UQxCopeoVkTfJmsacaeCEibj5spZvNudksA7yOmftaL3FEOzyX Mw6tZ9iriPvP9XSI+7z95A0Pqy0HTePfuDqv/D5X49ZRo6e5VMPwK7DZ2zQ3cKfQ rEWtYS8hXbtHPtuGxNu9oBVxlo5AV7xHiAXjfI05D1wMkfyPvJUhYyxsE= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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 10:47:43 +0200 Message-Id: <1474534063-8867-1-git-send-email-sebastian.huber@embedded-brains.de> X-IsSubscribed: yes 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.