EH frame optimization bug
Daniel Jacobowitz
drow@mvista.com
Tue Sep 30 19:06:00 GMT 2003
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?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
More information about the Binutils
mailing list