This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: Fix handle implicit nops for unwind records
- From: "H. J. Lu" <hjl at lucon dot org>
- To: davidm at hpl dot hp dot com
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 16 Jan 2004 14:52:29 -0800
- Subject: PATCH: Fix handle implicit nops for unwind records
- References: <20040114223735.GA6409@lucon.org> <16390.62551.380598.60698@napali.hpl.hp.com>
On Thu, Jan 15, 2004 at 12:13:11PM -0800, David Mosberger wrote:
> Hi HJ,
>
> One thing it still doesn't seem to get right is if there are implicit
> nops at the beginning of a region. For example:
>
> $ cat t.S
> .proc foo
> .prologue
> .save rp, r2
> .body
> foo: br.call.sptk.many rp=syscall_trace
> .endp foo
> $ as t.S
> $ readelf -u a.out
>
> Unwind section '.IA_64.unwind' at offset 0x68 contains 1 entries:
>
> <foo>: [0x0-0x10], info at +0x0
> v1, flags=0x0 (), len=8 bytes
> R1:prologue(rlen=0)
> P7:rp_when(t=0)
> P3:rp_gr(reg=r2)
> R1:body(rlen=1)
> R1:prologue(rlen=0)
> R1:prologue(rlen=0)
>
> As you can see, "as" thinks the body consists only of 1 instruction,
> even though the assembler had to insert two nop's for bundling
> reasons. Perhaps this kind of problem is easier to fix now that you
> moved the emission of the unwind info to a later point?
>
> Thanks,
> --david
The problem is emit_one_bundle doesn't update unwind records for
implicit nops. This patch seems to work for me.
H.J.
----
2004-01-16 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-ia64.c (emit_one_bundle): Handle unwind records
for implicit nops.
--- gas/config/tc-ia64.c.imp 2004-01-07 11:49:19.000000000 -0800
+++ gas/config/tc-ia64.c 2004-01-16 14:39:09.000000000 -0800
@@ -6277,6 +6319,16 @@ emit_one_bundle ()
}
break;
}
+
+ /* Set slot counts for non prologue/body unwind records. */
+ for (ptr = md.slot[curr].unwind_record; ptr; ptr = ptr->next)
+ if (ptr->r.type != prologue && ptr->r.type != prologue_gr
+ && ptr->r.type != body)
+ {
+ ptr->slot_number = (unsigned long) f + i;
+ ptr->slot_frag = frag_now;
+ }
+ md.slot[curr].unwind_record = NULL;
continue; /* try next slot */
}
@@ -6375,8 +6427,8 @@ emit_one_bundle ()
if (unwind.list)
{
- unwind.list->next_slot_number = (unsigned long) f + 16;
- unwind.list->next_slot_frag = frag_now;
+ unwind.list->next_slot_number = (unsigned long) f + 16;
+ unwind.list->next_slot_frag = frag_now;
}
}