This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Dwarf2 FDE CIE offset


Why is the dwarf2 unwind FDE CIE offset calculated as
". - section_start_label" while dwarf2 debug info uses
"section_start_label - 0"?  In particular, why the sign change?

I've been implementing section groups for gcc, with the aim of being able
to discard .eh_frame and .debug_frame info when garbage collecting an
unused function.  This involves splitting the .eh_frame section into
multiple sections.  The header stays in .eh_frame, and per function info
goes into .eh_frame0, .eh_frame1 etc.
eg.

        .section        .eh_frame,"aw",@progbits
.Lframe1:
        .4byte  .LECIE1-.LSCIE1
.LSCIE1:
        .4byte  0x0
        .byte   0x1
        .string "zPR"
        .uleb128 0x1
        .sleb128 -4
        .byte   0x41
        .uleb128 0x6
        .byte   0x9b
        .4byte  DW.ref.__gxx_personality_v0-.
        .byte   0x1b
        .byte   0xc
        .uleb128 0x1
        .uleb128 0x0
        .align 2
.LECIE1:
        .section        .eh_frame0,"awG",@progbits,__cxa_allocate_exception
.LSFDE1:
        .4byte  .LEFDE1-.LASFDE1
.LASFDE1:
        .4byte  .LASFDE1-.Lframe1
        .4byte  .LFB1-.
        .4byte  .LFE1-.LFB1
        .uleb128 0x0
        .byte   0x4
        .4byte  .LCFI0-.LFB1
        .byte   0xe
        .uleb128 0x20
        .byte   0x4
        .4byte  .LCFI1-.LCFI0
        .byte   0x9e
        .uleb128 0x2
        .byte   0x4
        .4byte  .LCFI2-.LCFI1
        .byte   0x9f
        .uleb128 0x1
        .byte   0x4
        .4byte  .LCFI4-.LCFI2
        .byte   0x9d
        .uleb128 0x3
        .byte   0x2f
        .uleb128 0x41
        .uleb128 0x1
        .align 2
.LEFDE1:


Now the problem with using ". - section_start_label" for the CIE offset,
ie. ".4byte .LASFDE1-.Lframe1" becomes apparent as the assembler can't
subtract two symbols in different sections.

If gcc used "section_start_label - ." instead, then the assembler could
use a pc-relative reloc referring to .Lframe1.  Any hope of a change
here?

-- 
Alan Modra


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]