Skip to content

Commit 594e06b

Browse files
committedMay 25, 2016
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
1 parent 5c33b91 commit 594e06b

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed
 

‎lld/ELF/EhFrame.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ template <class ELFT> uint8_t getFdeEncoding(ArrayRef<uint8_t> D) {
111111
if (Version != 1 && Version != 3)
112112
fatal("FDE version 1 or 3 expected, but got " + Twine((unsigned)Version));
113113

114-
const unsigned char *AugEnd = std::find(D.begin() + 1, D.end(), '\0');
114+
const unsigned char *AugEnd = std::find(D.begin(), D.end(), '\0');
115115
if (AugEnd == D.end())
116116
fatal("corrupted CIE");
117117
StringRef Aug(reinterpret_cast<const char *>(D.begin()), AugEnd - D.begin());

‎lld/test/ELF/Inputs/no-augmentation.o

3.55 KB
Binary file not shown.

‎lld/test/ELF/no-augmentation.test

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: llvm-mc -filetype=obj -triple=mips64-unknown-freebsd %s -o %t.o
2+
// RUN: ld.lld --eh-frame-hdr %t.o %p/Inputs/no-augmentation.o -o %t \
3+
// RUN: | FileCheck -allow-empty %s
4+
5+
// REQUIRES: mips
6+
7+
// CHECK-NOT: corrupted or unsupported CIE information
8+
9+
.global __start
10+
__start:

0 commit comments

Comments
 (0)
Please sign in to comment.