From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1345 invoked by alias); 11 Feb 2005 23:15:08 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 1161 invoked from network); 11 Feb 2005 23:14:58 -0000 Received: from unknown (HELO rwcrmhc12.comcast.net) (216.148.227.85) by sourceware.org with SMTP; 11 Feb 2005 23:14:58 -0000 Received: from lucon.org ([24.6.212.230]) by comcast.net (rwcrmhc12) with ESMTP id <2005021123145701400s0be9e>; Fri, 11 Feb 2005 23:14:57 +0000 Received: by lucon.org (Postfix, from userid 1000) id 9272365603; Fri, 11 Feb 2005 15:14:55 -0800 (PST) Date: Sat, 12 Feb 2005 06:28:00 -0000 From: "H. J. Lu" To: James E Wilson Cc: binutils@sources.redhat.com Subject: Re: PATCH: Add -munwind-check=[none|warning|error] Message-ID: <20050211231455.GA10558@lucon.org> References: <20050210172938.GA17132@lucon.org> <1108089017.24473.184.camel@aretha.corp.specifixinc.com> <20050211184511.GA6170@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050211184511.GA6170@lucon.org> User-Agent: Mutt/1.4.1i X-SW-Source: 2005-02/txt/msg00270.txt.bz2 On Fri, Feb 11, 2005 at 10:45:11AM -0800, H. J. Lu wrote: > On Thu, Feb 10, 2005 at 06:30:17PM -0800, James E Wilson wrote: > > On Thu, 2005-02-10 at 09:29, H. J. Lu wrote: > > > Here is the updated patch to add -munwind-check=[none|warning|error]. > > > I documented this new option. > > > > My feeling on this issue in general that we should be emitting a > > diagnostic here always. This new code is finding latent bugs in the > > unwind info. This is a correctness issue. If we let the latent bugs > > through, then they will only be found if an exception is generated and > > the stack unwound, at which point it is far too late to recover from the > > mistake. This makes it very important for the assembler to give a > > diagnostic when we find a problem. I can live with this being a warning > > for now, to avoid compatibility problems, but it really is important > > that people fix their code if they want it to work correctly. > > > > Here is the new patch. I removed the -munwind-check=none option. I also > included the patch for the .endp check. IAS does ignore the name > after .endp. But checking it is a good idea. People will get a > warning unless they fix the code. > > It turned out that I need to return non-0 for warnings to work. Also I need to return -1 to indicate that a warning has been issued so that a second one isn't needed. H.J. ------ 2005-02-11 H.J. Lu * config/tc-ia64.c (unwind_diagnostic): Return -1 for warning and 0 for error. (in_procedure): Return -1 for warning. (in_prologue): Likewise. (in_body): Likewise. --- gas/config/tc-ia64.c.warn 2005-02-11 13:21:20.056751130 -0800 +++ gas/config/tc-ia64.c 2005-02-11 15:08:03.424884229 -0800 @@ -3063,50 +3063,80 @@ dot_special_section (which) set_section ((char *) special_section_name[which]); } -static void +/* Return -1 for warning and 0 for error. */ + +static int unwind_diagnostic (const char * region, const char *directive) { if (md.unwind_check == unwind_check_warning) - as_warn (".%s outside of %s", directive, region); + { + as_warn (".%s outside of %s", directive, region); + return -1; + } else { as_bad (".%s outside of %s", directive, region); ignore_rest_of_line (); + return 0; } } +/* Return 1 if a directive is in a procedure, -1 if a diretive isn't in + a procedure but the unwind diretive check is set to warning, 0 if + a diretive isn't in a procedure and the unwind diretive check is set + to error. */ + static int in_procedure (const char *directive) { if (unwind.proc_start && (!unwind.saved_text_seg || strcmp (directive, "endp") == 0)) return 1; - unwind_diagnostic ("procedure", directive); - return 0; + return unwind_diagnostic ("procedure", directive); } +/* Return 1 if a directive is in a prologue, -1 if a diretive isn't in + a prologue but the unwind diretive check is set to warning, 0 if + a diretive isn't in a prologue and the unwind diretive check is set + to error. */ + static int in_prologue (const char *directive) { - if (in_procedure (directive)) + int in = in_procedure (directive); + if (in) { /* We are in a procedure. Check if we are in a prologue. */ if (unwind.prologue) return 1; - unwind_diagnostic ("prologue", directive); + /* We only want to issue one message. */ + if (in == 1) + return unwind_diagnostic ("prologue", directive); + else + return -1; } return 0; } +/* Return 1 if a directive is in a body, -1 if a diretive isn't in + a body but the unwind diretive check is set to warning, 0 if + a diretive isn't in a body and the unwind diretive check is set + to error. */ + static int in_body (const char *directive) { - if (in_procedure (directive)) + int in = in_procedure (directive); + if (in) { /* We are in a procedure. Check if we are in a body. */ if (unwind.body) return 1; - unwind_diagnostic ("body region", directive); + /* We only want to issue one message. */ + if (in == 1) + return unwind_diagnostic ("body region", directive); + else + return -1; } return 0; }