On Mon, Jun 24, 2013 at 12:43:15PM +0530, Vineet Gupta wrote: > Pardon me if I sound dense (not really my area of expertise), wowever, the 2nd > word in FDE above (@.Lframe0) is a direct reference to start of .debbug_frame > shouldn't it be something like > > @.Lframe0 - @.Lframe0 > > i.e. zero. > > Or do you think asseblmer/linker need to "interpret it" like that.
On most targets, .debug_* sections are placed at address 0, so absolute relocations are the same as relocations relative to the start of the section. Note, in any case, it is always supposed to be start of the .debug_frame section, not start of the contribution of the current translation unit to the .debug_frame section. So if you have two compilation units, one has 250 bytes in .debug_frame section and second has some CIE at offset 0, after linking FDEs from the second CU would use CIE_pointer 250, not 0. So, either .debug_* sections are placed at address 0 and then absolute relocations will do the trick, or you need some kind of section relative relocation (e.g. ia64 has it I think). This isn't specific just to .debug_frame, e.g. DW_FORM_strp/DW_FORM_sec_offset encoded values in .debug_info or .debug_abbrev offsets in .debug_info CU header, DW_OP_call_ref arguments, .debug_aranges/.debug_pubtypes/.debug_pubnames offsets to .debug_info all have these requirements. Jakub