[PATCH] D30335: [LLD] Add terminator to .eh_frame sections

Mark Kettenis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 24 05:30:46 PST 2017


kettenis created this revision.

Currenlty ld.lld does not add a terminator (a CIE with its length field set to zero) to the .eh_frame sections it generates.
While the relevant standards (the AMD64 SysV ABI and the Linux LSB) are not explicit about this, such a terminator
is expected by some unwinder implementations and seems to be always emitted by ld.bfd.  In addition to that, the
Linux LSB

  https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html#EHFRAME

explicitly says that

  The .eh_frame section shall contain 1 or more Call Frame Information (CFI) records.

Currently, if the .eh_frame sections of the input files only contain terminators, ld.lld emits a zero=sized .eh_frame section
which clearly doesn't meet that requirement.

The diff makes sure a terminator gets added to each .eh_frame section and adjusts all the relevant tests to account
for that.  An additional test isn't needed as these adjustments mean that the existence of the terminator is tested for by
several tests already.


https://reviews.llvm.org/D30335

Files:
  tools/lld/ELF/OutputSections.cpp
  tools/lld/test/ELF/eh-frame-hdr.s
  tools/lld/test/ELF/eh-frame-merge.s
  tools/lld/test/ELF/ehframe-relocation.s
  tools/lld/test/ELF/invalid-fde-rel.s
  tools/lld/test/ELF/linkerscript/eh-frame-hdr.s
  tools/lld/test/ELF/linkerscript/symbols-synthetic.s
  tools/lld/test/ELF/map-file.s
  tools/lld/test/ELF/relocatable-eh-frame.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30335.89650.patch
Type: text/x-patch
Size: 5149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170224/68a6cbad/attachment-0001.bin>


More information about the llvm-commits mailing list