From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15607 invoked by alias); 12 Sep 2012 11:27:40 -0000 Received: (qmail 15585 invoked by uid 22791); 12 Sep 2012 11:27:39 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Sep 2012 11:27:25 +0000 Received: by pbcwy7 with SMTP id wy7so2117757pbc.20 for ; Wed, 12 Sep 2012 04:27:24 -0700 (PDT) Received: by 10.66.85.133 with SMTP id h5mr31723813paz.10.1347449244683; Wed, 12 Sep 2012 04:27:24 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id gf8sm11259488pbc.52.2012.09.12.04.27.21 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 04:27:23 -0700 (PDT) Message-ID: <50507196.9060907@gnu.org> Date: Wed, 12 Sep 2012 11:27:00 -0000 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0 MIME-Version: 1.0 To: Rainer Orth CC: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [v3, build] Clear hardware capabilities on libstdc++.so with Sun as References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2012-09/txt/msg00793.txt.bz2 Il 12/09/2012 11:26, Rainer Orth ha scritto: > Since the use of rdrand was introduced in src/c++11/random.cc, all > execution tests involving libstdc++.so.6 fail on Solaris 10 and 11/x86 > with a sufficiently recent native assembler that supports rdrand: either > Solaris 10/x86 patch 119961-11 or Solaris 11.1 builds (haven't checked > which one). The problem is that as tags src/c++11/random.o as needing > RDRAND support: > > % file random.o > random.o: ELF 32-bit LSB relocatable 80386 Version 1 [CMOV RDRAND] > > which is propagated to libstdc++.so.6 and causes the runtime linker to > fail the execution if the hardware doesn't support that hardware > capability, although rdrand is executed only if the cpuid indicates the > support is present. > > The usual solution so far has been to clear the hardware capability > using a linker map (as in libitm, cf. libitm/clearcap.map). > Unfortunately, this doesn't work here: as can be seen with elfdump, > RDRAND is set in a second mask (CA_SUNW_HW_2) since all bits in > CA_SUNW_HW_1 are already used: > > % elfdump -H random.o > > Capabilities Section: .SUNW_cap > > Object Capabilities: > index tag value > [0] CA_SUNW_HW_1 0x20 [ CMOV ] > [1] CA_SUNW_HW_2 0x1 [ RDRAND ] > > The old (v1) linker map syntax has no support for clearing that > bit/mask, and while the v2 map syntax does, we cannot universally assume > it's present on Solaris 10: while recent linker patches include it, > older ones don't and ld and as can be updated independently. > > So I've settled for a different solution instead: Sun assemblers with > hardware capability support also have a -nH switch to suppress their > generation, thus I'm testing for that and use it if possible. > > This is exactly what the following patch does. > > Bootstrapped without regressions on i386-pc-solaris2.1[01] with affected > versions of Sun as and gas 2.22. Results with gas are unchanged, with > Sun as all failures are gone. x86_64-unknown-linux-gnu bootstrap is > running to make sure nothing breaks there. > > Ok for mainline if that passes? > > Rainer > > > 2012-09-11 Rainer Orth > > * acinclude.m4 (GLIBCXX_CHECK_ASSEMBLER_HWCAP): Define. > * configure.ac: Call GLIBCXX_CHECK_ASSEMBLER_HWCAP. > * fragment.am (CONFIG_CXXFLAGS): Add $(HWCAP_FLAGS). > * configure: Regenerate. > * Makefile.in: Regenerate. > * doc/Makefile.in: Regenerate. > * include/Makefile.in: Regenerate. > * libsupc++/Makefile.in: Regenerate. > * po/Makefile.in: Regenerate. > * python/Makefile.in: Regenerate. > * src/Makefile.in: Regenerate. > * src/c++11/Makefile.in: Regenerate. > * src/c++98/Makefile.in: Regenerate. > * testsuite/Makefile.in: Regenerate. > > > > Ok. Paolo