From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7225 invoked by alias); 9 Aug 2012 11:19:34 -0000 Received: (qmail 7216 invoked by uid 22791); 9 Aug 2012 11:19:33 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Aug 2012 11:19:20 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SzQls-0000ue-5X from Maciej_Rozycki@mentor.com ; Thu, 09 Aug 2012 04:19:20 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 9 Aug 2012 04:19:19 -0700 Received: from [172.30.3.42] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.1.289.1; Thu, 9 Aug 2012 12:19:17 +0100 Date: Thu, 09 Aug 2012 12:06:00 -0000 From: "Maciej W. Rozycki" To: Richard Sandiford CC: Subject: Re: [PATCH] MIPS/GAS: Disable PIC pseudo-ops in the MIPS16 mode In-Reply-To: <87ipmluw4g.fsf@firetop.home> Message-ID: References: <87ipmluw4g.fsf@firetop.home> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00173.txt.bz2 On Tue, 15 Nov 2011, Richard Sandiford wrote: > > gas/ > > * config/tc-mips.c (s_cpload, s_cpsetup): Fail if MIPS16 mode. > > (s_cplocal, s_cprestore, s_cpreturn): Likewise. > > I think these as_bad()s should be followed by a "return;". OK with > that change. That results in e.g.: $ cat cpload16.s .set mips16 .set noreorder foo: .cpload $25 $ mips-linux-gnu-as -KPIC cpload16.s cpload16.s: Assembler messages: cpload16.s:4: Error: .cpload not supported in MIPS16 mode cpload16.s:4: Error: unknown opcode `$25' $ I have updated the patch as follows, this now just discards any following arguments. I think there's little sense in bending backwards and parsing them properly, we don't do that for some other cases either -- see existing code nearby (that however uses s_ignore instead for a reason unknown to me, and) that doesn't even bail out (also for unknown reason -- I find it silly as finding these macros in non-PIC or wrong-ABI code is usually a sign of a user error). No regressions in the 23 MIPS targets. OK to apply? 2012-08-09 Maciej W. Rozycki gas/ * config/tc-mips.c (s_cpload, s_cpsetup): Fail if MIPS16 mode. (s_cplocal, s_cprestore, s_cpreturn): Likewise. Maciej binutils-gas-cpmips16-fix.diff Index: binutils-fsf-trunk-quilt/gas/config/tc-mips.c =================================================================== --- binutils-fsf-trunk-quilt.orig/gas/config/tc-mips.c 2012-08-09 00:44:38.000000000 +0100 +++ binutils-fsf-trunk-quilt/gas/config/tc-mips.c 2012-08-09 00:56:48.261195291 +0100 @@ -16439,6 +16439,13 @@ s_cpload (int ignore ATTRIBUTE_UNUSED) return; } + if (mips_opts.mips16) + { + as_bad (_("%s not supported in MIPS16 mode"), ".cpload"); + ignore_rest_of_line (); + return; + } + /* .cpload should be in a .set noreorder section. */ if (mips_opts.noreorder == 0) as_warn (_(".cpload not in noreorder section")); @@ -16505,6 +16512,13 @@ s_cpsetup (int ignore ATTRIBUTE_UNUSED) return; } + if (mips_opts.mips16) + { + as_bad (_("%s not supported in MIPS16 mode"), ".cpsetup"); + ignore_rest_of_line (); + return; + } + reg1 = tc_get_register (0); SKIP_WHITESPACE (); if (*input_line_pointer != ',') @@ -16597,6 +16611,13 @@ s_cplocal (int ignore ATTRIBUTE_UNUSED) return; } + if (mips_opts.mips16) + { + as_bad (_("%s not supported in MIPS16 mode"), ".cplocal"); + ignore_rest_of_line (); + return; + } + mips_gp_register = tc_get_register (0); demand_empty_rest_of_line (); } @@ -16618,6 +16639,13 @@ s_cprestore (int ignore ATTRIBUTE_UNUSED return; } + if (mips_opts.mips16) + { + as_bad (_("%s not supported in MIPS16 mode"), ".cprestore"); + ignore_rest_of_line (); + return; + } + mips_cprestore_offset = get_absolute_expression (); mips_cprestore_valid = 1; @@ -16654,6 +16682,13 @@ s_cpreturn (int ignore ATTRIBUTE_UNUSED) return; } + if (mips_opts.mips16) + { + as_bad (_("%s not supported in MIPS16 mode"), ".cpreturn"); + ignore_rest_of_line (); + return; + } + macro_start (); if (mips_cpreturn_register == -1) {