Hi, I had a question about interpretation of FDE's CIE_pointer field (for .debug_frame)
The spec say (from dwarf4 version although it really doesn't matter): "2. CIE_pointer (4 or 8 bytes, see Section 7.4) A constant offset into the .debug_frame section that denotes the CIE that is associated with this FDE." Does "offset" above mean offset from current location (in FDE) to CIE or does it mean offset from start of .debug_frame to the CIE. Per Ian Lance Taylor's blog, and if I'm interpreting it correctly, (http://www.airs.com/blog/archives/460) it seems to be latter. However the example given in spec it seems to have a direct reference to CIE "Address Value Comment ------------------------------------- fde 40 ... fde+4 cie CIE_pointer" --> This is direct reference to CIE (not relative) The context is ARC GNU toolchain form Synopsys. ARC gcc 4.8 is currently generating something like this: .section .debug_frame,"",@progbits .Lframe0: .4byte @.LECIE0-@.LSCIE0 --> CIE .LSCIE0: .4byte 0xffffffff .... .LECIE0: ... .LSFDE0: .4byte @.LEFDE0-@.LASFDE0 --> FDE .LASFDE0: .4byte @.Lframe0 --> CIE pointer - direct reference to CI (not offset from start of .debug_frame) .... This direct reference to start of CIE is causing objdump to reference invalid CIE and hence print invalid CFI - although the CFI itself is valid since the code_factor and such are seeded from a bogus CIE. 00000060 00000014 80e0c000 FDE cie=48b25ff8 pc=80a680d4..80a6810a ... ^^^^^^ Looking at gcc 4.8 source : gcc/dwarf2out.c : It seems to hint that the CIE_pointer needs to be relative to .debug_frame (just as I think) + if (for_eh) + dw2_asm_output_delta (4, l1, section_start_label, "FDE CIE offset"); + else + dw2_asm_output_offset (DWARF_OFFSET_SIZE, section_start_label, + debug_frame_section, "FDE CIE offset"); However to not generate a direct reference, most targets need to implement ASM_OUTPUT_DWARF_OFFSET which is not really the case. So the questions are 1. Is the current encoding of CIE_pointer in FDE correct 2. If yes, then objdump/readelf are at fault ? 2. If not, why do most targets don't implement the above macro. -Vineet