how is the eh_frame section used?

Ethan Tira-Thompson ejt@andrew.cmu.edu
Tue Apr 24 22:52:00 GMT 2007


> 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?

> 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.

Of particular interest to me is a change which occurred from gcc 3.3  
branch to 3.4 and beyond: in 3.3 the eh_frame section used to contain  
only R_MIPS_PC32 entries, which didn't need to be listed in the  
relocation table I generate.  In 3.4 R_MIPS_32 entries are used  
instead, which I do need to handle.  (So another angle of attack is  
to figure out how to switch back to R_MIPS_PC32 relocation entries so  
I don't have to muck around in eh_frame to begin with...)

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?)

thanks,
-ethan



More information about the Gcc-help mailing list