ELF: Handle empty CIE augmentation string

"A zero length string indicates that no augmentation data is present."

The FreeBSD/mips toolchain (GCC 4.2.1) generates .debug_frame sections
containing CIE records that have an empty augmentation string.

Differential Revision: http://reviews.llvm.org/D19928

llvm-svn: 270706
This commit is contained in:
Ed Maste 2016-05-25 14:45:28 +00:00
parent 5c33b91bbe
commit 594e06b879
3 changed files with 11 additions and 1 deletions

View File

@ -111,7 +111,7 @@ template <class ELFT> uint8_t getFdeEncoding(ArrayRef<uint8_t> D) {
if (Version != 1 && Version != 3)
fatal("FDE version 1 or 3 expected, but got " + Twine((unsigned)Version));
const unsigned char *AugEnd = std::find(D.begin() + 1, D.end(), '\0');
const unsigned char *AugEnd = std::find(D.begin(), D.end(), '\0');
if (AugEnd == D.end())
fatal("corrupted CIE");
StringRef Aug(reinterpret_cast<const char *>(D.begin()), AugEnd - D.begin());

Binary file not shown.

View File

@ -0,0 +1,10 @@
// RUN: llvm-mc -filetype=obj -triple=mips64-unknown-freebsd %s -o %t.o
// RUN: ld.lld --eh-frame-hdr %t.o %p/Inputs/no-augmentation.o -o %t \
// RUN: | FileCheck -allow-empty %s
// REQUIRES: mips
// CHECK-NOT: corrupted or unsupported CIE information
.global __start
__start: