This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Don't error on bad name in ia64 .endp
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Jan Beulich <JBeulich at novell dot com>
- Cc: davidm at hpl dot hp dot com, binutils at sources dot redhat dot com
- Date: Fri, 4 Feb 2005 11:36:16 -0800
- Subject: Re: PATCH: Don't error on bad name in ia64 .endp
- References: <s20328c3.005@emea1-mh.id2.novell.com>
On Fri, Feb 04, 2005 at 08:48:54AM +0100, Jan Beulich wrote:
> I guess you'd want to set default_name to "" instead of NULL, or else
> the 'none' cases could produce SEGV-s. Jan
>
Thanks for catching that. Here is the update.
H.J.
---
gas/
2005-02-03 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-ia64.c (dot_endp): When the name is missing or
couldn't be found, use the one from the last .proc if
md.unwind_check isn't error. Warn if md.unwind_check is
warning.
gas/testcase
2005-02-03 H.J. Lu <hongjiu.lu@intel.com>
* gas/ia64/ia64.exp: Pass -munwind-check=error for proc.
--- gas/config/tc-ia64.c.endp 2005-02-03 12:00:43.000000000 -0800
+++ gas/config/tc-ia64.c 2005-02-04 11:33:10.723391536 -0800
@@ -4363,7 +4363,7 @@ dot_endp (dummy)
long where;
segT saved_seg;
subsegT saved_subseg;
- char *name, *p, c;
+ char *name, *default_name, *p, c;
symbolS *sym;
switch (in_procedure ("endp"))
@@ -4449,6 +4449,11 @@ dot_endp (dummy)
subseg_set (saved_seg, saved_subseg);
+ if (unwind.proc_start)
+ default_name = (char *) S_GET_NAME (unwind.proc_start);
+ else
+ default_name = NULL;
+
/* Parse names of main and alternate entry points and set symbol sizes. */
while (1)
{
@@ -4457,10 +4462,47 @@ dot_endp (dummy)
c = get_symbol_end ();
p = input_line_pointer;
if (!*name)
- as_bad ("Empty argument of .endp");
- else
+ {
+ switch (md.unwind_check)
+ {
+ case warning:
+ if (default_name)
+ {
+ as_warn ("Empty argument of .endp. Use the default name `%s'",
+ default_name);
+ name = default_name;
+ }
+ else
+ as_warn ("Empty argument of .endp");
+ break;
+ case none:
+ if (default_name)
+ name = default_name;
+ break;
+ case error:
+ as_bad ("Empty argument of .endp");
+ break;
+ }
+ }
+ if (*name)
{
sym = symbol_find (name);
+ if (!sym && default_name && default_name != name)
+ {
+ /* We have a bad name. Try the default one if needed. */
+ switch (md.unwind_check)
+ {
+ case warning:
+ as_warn ("`%s' was not defined within procedure. Use the default name `%s'",
+ name, default_name);
+ case none:
+ name = default_name;
+ sym = symbol_find (name);
+ break;
+ case error:
+ break;
+ }
+ }
if (!sym || !S_IS_DEFINED (sym))
as_bad ("`%s' was not defined within procedure", name);
else if (unwind.proc_start
--- gas/testsuite/gas/ia64/ia64.exp.endp 2005-02-03 12:00:43.000000000 -0800
+++ gas/testsuite/gas/ia64/ia64.exp 2005-02-03 12:00:43.000000000 -0800
@@ -67,7 +67,7 @@ if [istarget "ia64-*"] then {
run_dump_test "bundling"
run_list_test "label" ""
run_list_test "last" ""
- run_list_test "proc" ""
+ run_list_test "proc" "-munwind-check=error"
run_list_test "slot2" ""
run_list_test "unwind-err" "-munwind-check=error"
}