Commit Graph

3 Commits

Author SHA1 Message Date
Rui Ueyama f8b285c037 Refactor EHOutputSection.
This patch refactors EHOutputSection using SectionPiece struct.
EHRegion class was removed since we can now directly use SectionPiece.

An incomplete support of large CIE/FDE record (> 2^32 bytes) was removed
because it silently created broken executable. There are several places
in the existing code that "size" field is always 4 bytes and at offset 4
in the record, which is not true for 64-bit size records. We will have to
support that in future, but it is better to error out instead of creating
malformed eh_frame sections.

llvm-svn: 270382
2016-05-22 23:16:14 +00:00
Rui Ueyama 1b45cca6d7 ELF: Simplify readEntryLength.
I removed "CIE/FIE size is too large" error because that was not
checking for correct error conditions. [UINT_MAX - 4, UINT_MAX) is
a correct range as a size of a CIE/FDE record. It's just that the
size cannot be larger than the section size.

llvm-svn: 259951
2016-02-05 23:24:05 +00:00
George Rimar 003be4fd58 [ELF] - implement support of extended length field for CIE/FDE records of eh_frame.
Ian Lance Taylor writes: "Read 4 bytes. If they are not 0xffffffff, they are the length of the CIE or FDE record. Otherwise the next 64 bits holds the length, and this is a 64-bit DWARF format. This is like .debug_frame." (http://www.airs.com/blog/archives/460), that also consistent with spec (https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html).

Patch implements support of described extended length field and also adds few more checks for safety.

Differential revision: http://reviews.llvm.org/D15532

llvm-svn: 255883
2015-12-17 09:23:40 +00:00