From patchwork Fri Oct 14 18:27:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 119898 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 7A98FB6F9F for ; Sat, 15 Oct 2011 05:31:50 +1100 (EST) Received: (qmail 24903 invoked by alias); 14 Oct 2011 18:31:45 -0000 Received: (qmail 24653 invoked by uid 22791); 14 Oct 2011 18:31:41 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 14 Oct 2011 18:31:25 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 7C517CB0223; Fri, 14 Oct 2011 20:31:25 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MHSwGbZQjRrb; Fri, 14 Oct 2011 20:31:15 +0200 (CEST) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 499D1CB0370; Fri, 14 Oct 2011 20:31:07 +0200 (CEST) From: Eric Botcazou To: David Miller Subject: Re: [PATCH] Fix target default on biarch Linux/Sparc Date: Fri, 14 Oct 2011 20:27:03 +0200 User-Agent: KMail/1.9.9 Cc: gcc-patches@gcc.gnu.org References: <20110905.182632.902579345910225033.davem@davemloft.net> In-Reply-To: <20110905.182632.902579345910225033.davem@davemloft.net> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201110142027.03838.ebotcazou@adacore.com> 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 > If you configure a biarch Linux/Sparc compiler defaulting to > 32-bit, but give --with-cpu= for a v9 cpu it erroneously > turns on 64-bit in TARGET_DEFAULT. PR target/50354 reports the breakage of the opposite case after the change: configuring for sparc64-linux --with-cpu=v8 used to build a 32-bit compiler, now the build aborts because of an architecture mismatch. > The right thing to do is what the Solaris/Sparc target does, > which is to key things off of a cpp macro (TARGET_64BIT_DEFAULT) > which is defined by a header that gets prepended to the target > header list based upon the target triplet. There is a discrepancy between Solaris and Linux: on Solaris, we don't support the weird sparc64-* --with-cpu=v8 combination, whereas it is the default for some Linux distros (e.g. Debian). So we cannot have the full symmetry here. Something like the attached patch would be sufficient. What do you think? PR target/50354 * config/sparc/linux64.h (TARGET_DEFAULT): Only override if the default processor is at least V9 and TARGET_64BIT_DEFAULT is defined. Index: config/sparc/linux64.h =================================================================== --- config/sparc/linux64.h (revision 179894) +++ config/sparc/linux64.h (working copy) @@ -31,7 +31,9 @@ along with GCC; see the file COPYING3. } \ while (0) -#ifdef TARGET_64BIT_DEFAULT +/* On Linux, the combination sparc64-* --with-cpu=v8 is supported and + selects a 32-bit compiler. */ +#if defined(TARGET_64BIT_DEFAULT) && TARGET_CPU_DEFAULT >= TARGET_CPU_v9 #undef TARGET_DEFAULT #define TARGET_DEFAULT \ (MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_STACK_BIAS + \