The new assembler with unwind table bug fix

Jim Wilson wilson@specifixinc.com
Wed Feb 4 07:17:00 GMT 2004


On Fri, 2004-01-16 at 14:56, H. J. Lu wrote:
> On Thu, Jan 15, 2004 at 05:09:17PM -0800, David Mosberger wrote:
> >         .proc foo
> >         .prologue
> > foo:    .save rp, r2
> >         nop 0
> >         .align 64
> >         .endp foo
> > The region length should be 15, but instead it comes out as 1.  It
> > seems that .align is handled correctly only inside .body, not inside
> > .prologue, which must work, too.

We can fix this by emitting a dummy unwind record at the end of the
function, for use in calculating region lengths.

However, some of the behavior here is intentional.  There is a comment
                /* In the absence of an explicit .body directive,
                   the prologue ends after the last instruction
                   covered by an unwind directive.  */
So gas is deliberately making prologue regions as small as possible when
there is no explicit body region.  This seems wise from an efficiency
standpoint, but it also seems wrong to do this unless we create an
implicit body region to cover the rest of the function, and we aren't
doing that.

This code comes from a patch that you wrote, see the 2000-05-24
gas/config/tc-ia64.c change.  Unfortunately I don't see it in the
binutils mailing list archives, so it must have been handled on another
mailing list, one of the trillian lists perhaps.

I think I could make this work correctly by putting code in
optimize_unw_records to detect this case and insert the implicit body
directive.  This would re-use some of the code that I am deleting from
fixup_unw_records.  I haven't tried to do this yet.  It isn't clear how
important it is.  This case seems rare.  Advice welcome.

I have attached the patch I have so far.  This gives the results you
want for your testcase, and also modifications of it with .body added,
and/or a nop added after the .align.  This was tested with the binutils
testsuite, there are no regressions.  This was tested with a linux
kernel build, there were no unwind info changes according to readelf -u.

I haven't checked this in yet pending a decision on whether we need to
automatically shorten prologue regions which are not followed by body
regions.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmp.file.2
Type: text/x-troff-man
Size: 8614 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20040204/3d8698dd/attachment.bin>


More information about the Binutils mailing list