From patchwork Tue Apr 15 15:21:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 339310 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 CF44D14008F for ; Wed, 16 Apr 2014 01:21:41 +1000 (EST) 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:mime-version:content-type; q=dns; s=default; b=aBVJBpe6o/7M2XZSjk8zjiX23EgvOALR7f9woATs7axF2X+6eK yMHuQYv+jnHKHUt5Da8ApgghCA89W2gQykM4UFv4MJyICYZokbgUgWtw5fl2sZgK b5ri3sQIpfDduOU0LXJFTs6RSmyfLLWcTVsb1yZRqesmj15jlRVHYwLfQ= 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:mime-version:content-type; s= default; bh=ib+HrvT7y1FOj3p+Jj2fesOOscI=; b=VPuV/lMEAbfE9/2efdxv 8XvNKOVY+etxyBSzFjhvP6XwrkC/Ow57+gH1JhmKkrac+PX+oGhd83pJ+gZNjvre CRxXlD20z3QkHVp6Ct5epL8l30m73dta1QkVZl3DgfDVIyynw2W1pXAp1uPH2KWj qGTuaTrnw7IjHWCioTmEocc= Received: (qmail 29144 invoked by alias); 15 Apr 2014 15:21:34 -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 29132 invoked by uid 89); 15 Apr 2014 15:21:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp-relay.CeBiTec.Uni-Bielefeld.DE Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Apr 2014 15:21:32 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id E6069F5F; Tue, 15 Apr 2014 17:21:29 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Yha7kaoXTFrL; Tue, 15 Apr 2014 17:21:27 +0200 (CEST) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.110]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 14A61F5E; Tue, 15 Apr 2014 17:21:26 +0200 (CEST) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.14.7+Sun/8.14.7/Submit) id s3FFLQTZ001209; Tue, 15 Apr 2014 17:21:26 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Paolo Bonzini , Uros Bizjak Subject: [build] Correctly detect native TLS support with 64-bit gas on Solaris/x86 (PR target/60817) Date: Tue, 15 Apr 2014 17:21:26 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes As reported in the PR, gcc/configure currently fails to detect native TLS support on x86_64-*-solaris2* with a 64-bit gas since it feeds it 32-bit TLS code. I haden't noticed this so far since I've been using a 32-bit gas here (no idea why). The following patch fixes this by making sure 64-bit code is both used for 64-bit-default configurations and the necessary assembler flags passed. I've chosen to merge the i?86 and x86_64 cases to avoid duplicating considerable amounts of code. When using the native Solaris assembler, the relocs need to be in lower case as already done for 32-bit. Tested by configuring for x86_64-pc-solaris2.11 with 32-bit gas, 64-bit gas, /bin/as, i386-pc-solaris2.11 with 32-bit gas and /bin/as, x86_64-unknown-linux-gnu, and i686-unknown-linux-gnu and checking that native TLS support is detected correctly. Ok for mainline or should I rather bootstrap the change on a couple of those configurations? Thanks. Rainer 2014-04-15 Rainer Orth PR target/60817 * configure.ac (set_have_as_tls): Merge i[34567]86-*-* and x86_64-*-* cases. Pass necessary as flags on 64-bit Solaris/x86. Use lowercase relocs for x86_64-*-*. * configure: Regenerate. diff --git a/gcc/configure.ac b/gcc/configure.ac --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2959,7 +2959,7 @@ foo: .long 25 tls_first_major=2 tls_first_minor=17 ;; - i[34567]86-*-* | x86_64-*-solaris2.1[0-9]*) + i[34567]86-*-* | x86_64-*-*) case "$target" in i[34567]86-*-solaris2.*) on_solaris=yes @@ -2991,6 +2991,8 @@ changequote(,)dnl tls_section_flag=T tls_as_opt="--fatal-warnings" fi + case "$target" in + i[34567]86-*-*) conftest_s="$conftest_s foo: .long 25 .text @@ -3007,20 +3009,23 @@ foo: .long 25 leal foo@ntpoff(%ecx), %eax" ;; x86_64-*-*) - conftest_s=' - .section ".tdata","awT",@progbits + if test x$on_solaris = xyes; then + case $gas_flag in + yes) tls_as_opt="$tls_as_opt --64" ;; + no) tls_as_opt="$tls_as_opt -xarch=amd64" ;; + esac + fi + conftest_s="$conftest_s foo: .long 25 .text movq %fs:0, %rax - leaq foo@TLSGD(%rip), %rdi - leaq foo@TLSLD(%rip), %rdi - leaq foo@DTPOFF(%rax), %rdx - movq foo@GOTTPOFF(%rip), %rax - movq $foo@TPOFF, %rax' - tls_first_major=2 - tls_first_minor=14 - tls_section_flag=T - tls_as_opt=--fatal-warnings + leaq foo@tlsgd(%rip), %rdi + leaq foo@tlsld(%rip), %rdi + leaq foo@dtpoff(%rax), %rdx + movq foo@gottpoff(%rip), %rax + movq \$foo@tpoff, %rax" + ;; + esac ;; ia64-*-*) conftest_s='