how is the eh_frame section used?

Ian Lance Taylor iant@google.com
Wed Apr 25 03:22:00 GMT 2007


Ethan Tira-Thompson <ejt@andrew.cmu.edu> writes:

> > The eh_frame data is used to unwind the stack when an exception is
> > thrown.  It records things like where to find the return address and
> > which registers are stored where.
> Ah, so eh_frame is just a table of meta-data describing the code in
> the data section, right?  (no executable code in eh_frame itself?)
> And I'm guessing it needs relocation entries in order to reference
> the sizes/positions of items linked in other sections?

Yes.

> > bfd/elf-eh-frame.c
> This file is in binutils... looking through it shows how to read/
> write the data, which is half the battle, but the data is apparently
> being generated elsewhere.

Yes.

> Do you know where I can look in gcc to find the eh_frame generation?
> (or better yet, some insight into what I would need to change to
> either make eh_frame consistent or make it use R_MIPS_PC32 type
> relocation entries?)

It's generated by gcc/dwarf2out.c.  Search for for_eh.

I think R_MIPS_32 vs. R_MIPS_PC32 would be controlled by
ASM_PREFERRED_EH_DATA_FORMAT.

Ian



More information about the Gcc-help mailing list