From patchwork Sun May 22 21:23:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 96788 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 CEDADB6FA6 for ; Mon, 23 May 2011 07:24:10 +1000 (EST) Received: (qmail 1154 invoked by alias); 22 May 2011 21:24:09 -0000 Received: (qmail 1145 invoked by uid 22791); 22 May 2011 21:24:09 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 22 May 2011 21:23:55 +0000 Received: by wye20 with SMTP id 20so4608610wye.20 for ; Sun, 22 May 2011 14:23:54 -0700 (PDT) Received: by 10.227.165.10 with SMTP id g10mr1616310wby.91.1306099433937; Sun, 22 May 2011 14:23:53 -0700 (PDT) Received: from localhost (rsandifo.gotadsl.co.uk [82.133.89.107]) by mx.google.com with ESMTPS id z13sm3679176wbd.29.2011.05.22.14.23.51 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 May 2011 14:23:52 -0700 (PDT) From: Richard Sandiford To: "Joseph S. Myers" Mail-Followup-To: "Joseph S. Myers" , gcc-patches@gcc.gnu.org, echristo@apple.com, rdsandiford@googlemail.com Cc: gcc-patches@gcc.gnu.org, echristo@apple.com Subject: Re: Use Enum for MIPS -march=, -mtune=, -mips options References: Date: Sun, 22 May 2011 22:23:50 +0100 In-Reply-To: (Joseph S. Myers's message of "Fri, 6 May 2011 20:31:45 +0000 (UTC)") Message-ID: <87pqna4eft.fsf@firetop.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 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 "Joseph S. Myers" writes: > The processing of MIPS_CPU_STRING_DEFAULT is replaced by much simpler > use of strcmp to find a matching entry; the "from-abi" default > definition of that macro is replaced by code in mips_default_arch if > that macro is not defined. (Previously it would always have been > defined, so the previous fallback for it being undefined was dead > code.) For the record, the fallback really was needed. The "from-abi" default came from: > -/* 'from-abi' makes a good default: you get whatever the ABI requires. */ > -#ifndef MIPS_ISA_DEFAULT > -#ifndef MIPS_CPU_STRING_DEFAULT > -#define MIPS_CPU_STRING_DEFAULT "from-abi" > -#endif > -#endif so it was only used if both MIPS_CPU_STRING_DEFAULT and MIPS_ISA_DEFAULT were undefined. The default was tested here: > -#ifdef MIPS_CPU_STRING_DEFAULT > - mips_set_architecture (mips_parse_cpu (MIPS_CPU_STRING_DEFAULT)); > -#else > - mips_set_architecture (mips_cpu_info_from_isa (MIPS_ISA_DEFAULT)); > -#endif So the patch had the effect of ignoring MIPS_ISA_DEFAULT. This showed up on mipsisa64-elf, where crt0.S was assembled as MIPS I rather than MIPS64. I've applied the fix below. Tested on mipsisa64-elf and mips-linux-gnu. Richard gcc/ * config/mips/mips.c (mips_default_arch): Honor MIPS_ISA_DEFAULT. Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c 2011-05-22 22:19:08.000000000 +0100 +++ gcc/config/mips/mips.c 2011-05-22 22:20:47.000000000 +0100 @@ -15239,12 +15239,14 @@ mips_cpu_info_from_opt (int opt) static const struct mips_cpu_info * mips_default_arch (void) { -#ifdef MIPS_CPU_STRING_DEFAULT +#if defined (MIPS_CPU_STRING_DEFAULT) unsigned int i; for (i = 0; i < ARRAY_SIZE (mips_cpu_info_table); i++) if (strcmp (mips_cpu_info_table[i].name, MIPS_CPU_STRING_DEFAULT) == 0) return mips_cpu_info_table + i; gcc_unreachable (); +#elif defined (MIPS_ISA_DEFAULT) + return mips_cpu_info_from_isa (MIPS_ISA_DEFAULT); #else /* 'from-abi' makes a good default: you get whatever the ABI requires. */