[PATCH] D44168: [ELF] Add .eh_frame pieces to map file

Rafael Ávila de Espíndola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 15 15:23:39 PDT 2018


rafael added a comment.

Andrew Ng via Phabricator <reviews at reviews.llvm.org> writes:

> andrewng added a comment.
> 
> Looking at the EhFrameSection writing and finalize code, it would seem that
>  some kind of alignment is being applied. This aligning is also the reason
>  why for x86_64 the mapping of CIE/FDE's to the output is so fragmented,
>  because all input we have seen is 4-byte aligned, but LLD uses 8-byte
>  alignment for the output.

Both gcc and clang produce an alignment of 8 for a trivial function:

[ 6] .eh_frame         PROGBITS        0000000000000000 000078 000038 00 A  0   0  8

The reason for doing that in an unfortunate backwards compatibility
problem. If a section whose size is not a multiple of 8 is followed by a
section aligned to 8 bytes we would have a zero padding which would be
interpreted as the terminator.

We (MC) could produce .eh_frame whose sizes are always multiples of 8
but the alignment is set to 4, but no one ever bothered to implement
that.

Cheers,
Rafael


Repository:
  rL LLVM

https://reviews.llvm.org/D44168





More information about the llvm-commits mailing list