Reducing eh_frame table size

Bruno Haible haible@ilog.fr
Mon Nov 17 13:49:00 GMT 1997


Hi,

The size of exception handling tables emitted by g++ in DWARF2 format
could be reduced by about 20% if the following modification was made in
the assembler, for the targets supporting the ELF object format.

A new pseudo-opcode ".dwarf_advance" is introduced. Its argument its
a difference between two labels in the same segmemt (like the 2nd argument
of the ".size" pseudo-op). It expands as follows:

        .dwarf_advance Label2-Label1
==>
        .if Label2-Label1 < 0x10000
        .if Label2-Label1 < 0x100
        .if Label2-Label1 < 0x40
        .byte   Label2-Label1+0x40
        .else
        .byte   0x2
        .byte   Label2-Label1
        .endif
        .else
        .byte   0x3
        .2byte  Label2-Label1
        .endif
        .else
        .byte   0x4
        .4byte  Label2-Label1
        .endif

Unfortunately, the .if expansion doesn't work as is, because Label2-Label1
is not a constant expression; its value is only at the end of the assembly.
One can assume that Label1 and Label2 are in the same segment, and that the
segment containing the .dwarf_advance op is different from this.

As I see it, gas would need just a few modifications to write.c:relax_segment()
in order to support this.

Can we hope that this will be implemented in gas in the near future?

Bruno



More information about the Gcc mailing list