Exceptions with dwarf2 unwind

Don Bowman don@pixsci.com
Sun Apr 19 19:06:00 GMT 1998


Can someone explain a little how the exceptions with dwarf2
unwind work?

Do most targets use the crtbegin/crtend? Or do they use collect2?

After loading the object, I call __register_frame(__EH_FRAME_BEGIN__).
This works ok.
When the exception occurs, it ends up in __frame_state_for,
and then down into frame_init.
Sometimes when I get to count_fdes(...) I get a fault while
traversing the .eh_frame. If I don't get a fault, then
I usually end up calling __terminate() since __frame_state_for
doesn't find an fde for the pc.

I'm using binutils 980418 configured as mips-wrs-vxworks (which
is really mips-gnu-elf). Neither the linker nor the assembler
do anything special with the .eh_frame nor the .gcc_except_table
sections -- they simply get emitted into the objects.
When I link, I'm linking with '-r' (I'm working with VxWorks,
and objects are always linked relocateable). I end up with
an amalgamated .eh_frame and .gcc_except_table section. I linked
crtbegin.o on the beginning, and crtend.o on the end, which
gives me the __EH_FRAME_BEGIN_ symbol at the start of the .eh_frame
section.

Dumping the .eh_frame section out, it looks good for a while,
and then there's something in it in which the lengths don't
make sense.

I'm not using collect2.

This usually comes from one of the objects in libgcc that I'm
pulling in:
(_eh.o, tinfo.o, tinfo2.o, exception.o, new.o, opdel.o, frame.o).

I'm not sure if its how they were built, or just a coincidence
since I'm only linking the one other file.

So:

1: Are all of the files in libgcc meant to be compiled with
exceptions enabled?
2: Is linking crtbegin.o and crtend.o like this the way to go?
(and how would you do that automatically in the specs file)
3: How does one make a multilib'd version of crtbegin.o and crtend.o?
I need them made for both big & little endian.
4: Has anyone made objdump aware of the format of the dwarf2 unwind?
I'm thinking this would be handy for debugging.
5: Do I need to write a linker script or something to correctly
merge the .eh_frame and .gcc_except_table sections? Are there
any potential problems with alignment which might be throwing
this off when objects are joined? I notice there are some .byte 
fields in the structure generated.

--don



More information about the Gcc mailing list