This is the mail archive of the gcc-help@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]

Re: FDEs in .eh_frame section


Martin Kirchengast <martin_kir_@hotmail.com> writes:

> what is the data format of "initial_location" and "address_range" in
> the .eh_frame section of an ELF64 binary? I read the DWARF
> specification which says:
>
> "initial_location (target address): An addressing-unit sized constant indicating the address of the first location associated with this table entry."
>
> and
>
> "address_range (target address): An addressing unit sized constant indicating the number of bytes of program instructions described by this entry."
>
> Because I'm building for x86-64 I thought that must be 64 bit, but
> that seems to be wrong.

Yes.  It's a 32-bit value for most targets.  Note that the value is
normally PC relative--it's the offset from the FDE to the address which
it covers.  So 32 bits is normally sufficient.  The number of bytes is
also normally 32 bits.


> 00000020 0000001c 00000024 FDE cie=00000000 pc=000000ec..000000f6

> Contents of section .eh_frame:
> Â3b78 1c000000 00000000 017a5052 00017810Â .........zPR..x.
> Â3b88 0a005423 00000000 00001b0c 07089001Â ..T#............
> Â3b98 1c000000 24000000 4cc5ffff 0a000000Â ....$...L.......
> Â3ba8 00410e10 4386020d 06450c07 08000000Â .A..C....E......
>
> According to the above output of readelf the value of address_range
> should be 0xf6 - 0xec = 0xa. This value is at address 0x3ba4 and seems
> to be 32 bit wide. initial_location hast to be at address 0x3ba0, is
> 32 bit wide too and has a quite weird value. So please tell what am I
> doing wrong here?

The initial_location value is at 0x3ba0 is 0xffffc54c.  0x3ba0 +
0xffffc54c == 0xec, which is the value you want.

Ian


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