summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/OutputSections.cpp4
-rw-r--r--lld/test/ELF/eh-frame-marker.s2
2 files changed, 5 insertions, 1 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 35b11113894..743ca0dd8b5 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -992,6 +992,10 @@ template <class RelTy>
void EhOutputSection<ELFT>::addSectionAux(EhInputSection<ELFT> *Sec,
ArrayRef<RelTy> Rels) {
SectionPiece &CiePiece = Sec->Pieces[0];
+ // The empty record is the end marker.
+ if (CiePiece.Data.size() == 4)
+ return;
+
CieRecord *Cie = addCie(CiePiece, Sec, Rels);
for (size_t I = 1, End = Sec->Pieces.size(); I != End; ++I) {
diff --git a/lld/test/ELF/eh-frame-marker.s b/lld/test/ELF/eh-frame-marker.s
index b6c0a7b37ee..a5de2a7c3d4 100644
--- a/lld/test/ELF/eh-frame-marker.s
+++ b/lld/test/ELF/eh-frame-marker.s
@@ -1,5 +1,5 @@
// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
-// RUN: ld.lld %t.o -o %t.so -shared
+// RUN: ld.lld --eh-frame-hdr %t.o -o %t.so -shared
// We used to crash on this.
.section .eh_frame
foo:
OpenPOWER on IntegriCloud