From patchwork Thu Sep 6 18:40:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Howarth X-Patchwork-Id: 182259 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]) by ozlabs.org (Postfix) with SMTP id 315E62C008C for ; Fri, 7 Sep 2012 04:41:04 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1347561665; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=OQVRGNhzOUupfgiDaIHfibpJy3A=; b=ZOm1Y3jxGuSuYZK SNQED0sFmc7KQmqESvLuE0k7UyudwEq2Rg8oTM5Hg/eALeIPv4PMchkHVYZViVxe nHFs/yLA1T871wXJ7LXULTxViDTSkqyWJiidaLxPQMW/ZQn+odNIgb/WXnus3tOs uPAh0cXuybD5ztymD1ViipccZZ5s= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=rk2zvWjR2fC1lHTdvWUoN1Foem0q4XQpgGwgikENZQLVKnfqurrjYFjQHGAGB7 aoeK2YIQFuJlUpaztWjBsGAhmP5CdhnUAJoJ4xdQ3IFWIPWBPScWDmGIwkvBKWRq ZWAcbZMyH3S8L2cj4N/pZF0hEhttuVGh/4M5zMEaYCP4k=; Received: (qmail 20067 invoked by alias); 6 Sep 2012 18:40:58 -0000 Received: (qmail 20057 invoked by uid 22791); 6 Sep 2012 18:40:56 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from bromo.med.uc.edu (HELO bromo.med.uc.edu) (129.137.3.146) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 06 Sep 2012 18:40:39 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id ED864400007; Thu, 6 Sep 2012 14:40:38 -0400 (EDT) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id q86Iecic017046; Thu, 6 Sep 2012 14:40:38 -0400 Date: Thu, 6 Sep 2012 14:40:38 -0400 From: Jack Howarth To: gcc-patches@gcc.gnu.org Cc: drepper@gmail.com, dominiq@lps.ens.ft Subject: [PATCH] Fix PR bootstrap/54419 Message-ID: <20120906184038.GA17044@bromo.med.uc.edu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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 The attached patch eliminates the bootstrap failures in libstdc++-v3 of PR 54419 by having configure check for assembler support of the new rdrnd opcode and defining _GLIBCXX_X86_RDRAND in config.h if supported. Tested on x86_64-apple-darwin12 against the assembler from Xcode 4.4.1. Okay for gcc trunk? Jack ps Regenerated config.h.in in libstdc++-v3 with... autoheader -I. -I../config and configure with... autoconf -I. -I../config libstdc++-v3/ 2012-09-06 Ulrich Drepper Dominique d'Humieres Jack Howarth PR bootstrap/54419 * configure.ac: Test for rdrnd support in assembler. * src/c++11/random.cc: (__x86_rdrand): Depend on _GLIBCXX_X86_RDRAND. (random_device::_M_init): Likewise. (random_device::_M_getval): Likewise. * configure: Regenerated. * config.h.in: Regenerated. Index: libstdc++-v3/src/c++11/random.cc =================================================================== --- libstdc++-v3/src/c++11/random.cc (revision 191031) +++ libstdc++-v3/src/c++11/random.cc (working copy) @@ -50,7 +50,7 @@ namespace std _GLIBCXX_VISIBILITY(defaul return __ret; } -#if defined __i386__ || defined __x86_64__ +#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND unsigned int __attribute__ ((target("rdrnd"))) __x86_rdrand(void) @@ -75,7 +75,7 @@ namespace std _GLIBCXX_VISIBILITY(defaul if (token == "default") { -#if defined __i386__ || defined __x86_64__ +#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND unsigned int eax, ebx, ecx, edx; // Check availability of cpuid and, for now at least, also the // CPU signature for Intel's @@ -118,7 +118,7 @@ namespace std _GLIBCXX_VISIBILITY(defaul random_device::result_type random_device::_M_getval() { -#if (defined __i386__ || defined __x86_64__) +#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND if (! _M_file) return __x86_rdrand(); #endif Index: libstdc++-v3/configure.ac =================================================================== --- libstdc++-v3/configure.ac (revision 191031) +++ libstdc++-v3/configure.ac (working copy) @@ -330,6 +330,18 @@ case "$target" in esac GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_COMPAT, test $ac_ldbl_compat = yes) +ac_cv_x86_rdrand=no +case "$target" in + i?86-*-* | \ + x86_64-*-*) + AC_TRY_COMPILE(, [asm("rdrand %eax");], + [ac_cv_x86_rdrand=yes], [ac_cv_x86_rdrand=no]) +esac +if test $ac_cv_x86_rdrand = yes; then + AC_DEFINE(_GLIBCXX_X86_RDRAND, 1, + [ Defined if as can handle rdrand. ]) +fi + # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE. GLIBCXX_CONFIGURE_TESTSUITE