From: "H. J. Lu" <hjl@lucon.org>
To: James E Wilson <wilson@specifixinc.com>
Cc: binutils@sources.redhat.com
Subject: Re: PATCH: Add -munwind-check=[none|warning|error]
Date: Sat, 12 Feb 2005 06:28:00 -0000 [thread overview]
Message-ID: <20050211231455.GA10558@lucon.org> (raw)
In-Reply-To: <20050211184511.GA6170@lucon.org>
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 <hongjiu.lu@intel.com>
* 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;
}
next prev parent reply other threads:[~2005-02-11 23:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-10 23:31 H. J. Lu
2005-02-11 10:55 ` James E Wilson
2005-02-11 20:02 ` H. J. Lu
2005-02-11 20:20 ` H. J. Lu
2005-02-11 23:49 ` James E Wilson
2005-02-12 6:28 ` H. J. Lu [this message]
2005-02-13 10:56 ` James E Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050211231455.GA10558@lucon.org \
--to=hjl@lucon.org \
--cc=binutils@sources.redhat.com \
--cc=wilson@specifixinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).