From patchwork Wed Sep 11 21:23:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 274369 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CEA972C0170 for ; Thu, 12 Sep 2013 07:24:16 +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=qrb+qyQjjhhInuzIaeer2ecl5sj15IJrBR4heK/3ORGDZ5Cp+i 5roUJw29ZOTuOZdvnIj7jbzpttr+YcQ1T3gSOzo/xQ78c8Pn7FgXuV5dXHbDhoze ge9Pfa05VTN4buc1C7oDYTSS1BRz5knratQ3Qewd5H6LlqANIwDH3Kjds= 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=dLnZ6+wawubdAaWTfyPgx8QZzhU=; b=a2rGA3do8P/OsjmCv12R 0bTwzuYAjV97htC+oEIjNhmzKeZjvrgcNSHCluOU644m6kY2RM+7Z5y8RwLiNPKP HxuqP8GEWceKQgYAgaP9ZwfY8R8DSKgqVrSHCiF4qUdUViw1krGkamJrGJOtH6ug oZs9fdBoHm/WkGNkpVcJbbo= Received: (qmail 27889 invoked by alias); 11 Sep 2013 21:24:10 -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 27879 invoked by uid 89); 11 Sep 2013 21:24:09 -0000 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Sep 2013 21:24:09 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=AWL, BAYES_00, KHOP_PGP_SIGNED, RDNS_NONE, SPF_HELO_FAIL autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1VJrtM-00057E-OC from Thomas_Schwinge@mentor.com ; Wed, 11 Sep 2013 14:24:04 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 11 Sep 2013 14:24:04 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Wed, 11 Sep 2013 22:24:02 +0100 From: Thomas Schwinge To: CC: , Subject: gcc_GAS_FLAGS: Add more gcc_cv_as_flags overrides User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Wed, 11 Sep 2013 23:23:47 +0200 Message-ID: <87zjrjcasc.fsf@schwinge.name> MIME-Version: 1.0 Hi! In a toolchain where GCC has been configured for --target=i686-pc-linux-gnu, and where an x86_64 multilib has also been configured, by default GCC will generate code for 32-bit mode, and for 64-bit mode only when -m64 is passed. Per ASM_SPEC definition, the -m64 option is translated to --64 when invoking the assembler. This is working fine. What however is not working fine is GCC's very own configure testing. When using said toolchain for building on/for x86_64-linux-gnu by configuring a native GCC build with CC='gcc -m64' CXX='g++ -m64', I'm seeing the following happen in [GCC]/gcc/configure: configure:23559: checking assembler for thread-local storage support configure:23572: [...]/bin/as --fatal-warnings -o conftest.o conftest.s >&5 conftest.s: Assembler messages: conftest.s:5: Error: bad register name `%rax' [...] configure: failed program was .section ".tdata","awT",@progbits foo: .long 25 .text movq %fs:0, %rax [...] configure:23586: result: no In this toolchain, an unadorned invocation of as will default to 32-bit mode, and enter 64-bit mode only when an explicit --64 is passed -- which is not done here. This is, from a quick glance, the "inverse" thing as has once been discussed in , . Wanting to use this toolchain, do I have to configure GCC pointing to an assembler that defaults to 64-bit mode, or use something like --with-as='as --64' (not checked whether that works), or should the GCC configure system deduce from $CXX' -m64 that it needs to pass --64 to the assembler (à la ASM_SPEC as indicated above), or is the following patch the way to go, or something else? H.J., the gnux32 change is just a guess; please comment if that's not right. (And, of course, this is not a problem specific to *-*-linux*, but changing that is for another day.) gcc/ * acinclude.m4 (gcc_GAS_FLAGS): Add more gcc_cv_as_flags overrides. * configure: Regenerate. Grüße, Thomas --- gcc/acinclude.m4 +++ gcc/acinclude.m4 @@ -444,8 +444,16 @@ AC_DEFUN([gcc_GAS_FLAGS], [AC_CACHE_CHECK([assembler flags], gcc_cv_as_flags, [ case "$target" in i[[34567]]86-*-linux*) - dnl Always pass --32 to ia32 Linux assembler. - gcc_cv_as_flags="--32" + dnl Override the default, which may be incompatible. + gcc_cv_as_flags=--32 + ;; + x86_64-*-linux-gnux32) + dnl Override the default, which may be incompatible. + gcc_cv_as_flags=--x32 + ;; + x86_64-*-linux*) + dnl Override the default, which may be incompatible. + gcc_cv_as_flags=--64 ;; powerpc*-*-darwin*) dnl Always pass -arch ppc to assembler.