EH frame optimization bug

Daniel Jacobowitz drow@mvista.com
Thu Oct 2 18:43:00 GMT 2003


On Tue, Sep 30, 2003 at 03:05:59PM -0400, Daniel Jacobowitz wrote:
> Testcase derived from glibc.  Take the attached files and link them:
>   ld -o bin connect.o send.o dumb.o
> 
> readelf -wf bin -> segfault.
> 
> The problem is that we've got GAS-produced .eh_frame sections that look like
> this:
>   [ 5] .eh_frame         PROGBITS        00000000 000098 000040 00   A  0  0  4
> 
> 00000000 00000012 00000000 CIE
> 
> 00000016 00000026 0000001a FDE cie=00000000 pc=0000001e..00000074
> 
> Then we have two almost identical object files (built from the same source
> file, actually).  We optimize them to share a CIE.
> 
> 00000000 00000012 00000000 CIE
> 00000016 00000026 0000001a FDE cie=00000000 pc=08048080..080480d6
> 00000040 00000026 00000044 FDE cie=00000000 pc=080480e0..08048136
> 
> That second FDE now ends at 0x6a.  The next .eh_frame section is align-4. 
> Two bytes padding get added, and everything blows up.
> 
> Something similar came up a few months ago but I can't find the reference
> now.  What's the right thing to do here?  My instinct says, grow the last
> FDE before the padding, but I have no idea how to do that.  Is the alignment
> of a .eh_frame section mandated?

Ooops!

HJ pointed out that I didn't attach the testcase.  Here it is.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20031002/184241e2/attachment.tar>


More information about the Binutils mailing list