summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/InputSection.cpp2
-rw-r--r--lld/test/ELF/eh-frame-marker.s6
2 files changed, 7 insertions, 1 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index cc3e939a0fb..cfce1f15a7a 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -414,10 +414,10 @@ void EhInputSection<ELFT>::split() {
ArrayRef<uint8_t> Data = this->getSectionData();
for (size_t Off = 0, End = Data.size(); Off != End;) {
size_t Size = readEhRecordSize<ELFT>(Data.slice(Off));
+ this->Pieces.emplace_back(Off, Data.slice(Off, Size));
// The empty record is the end marker.
if (Size == 4)
break;
- this->Pieces.emplace_back(Off, Data.slice(Off, Size));
Off += Size;
}
}
diff --git a/lld/test/ELF/eh-frame-marker.s b/lld/test/ELF/eh-frame-marker.s
new file mode 100644
index 00000000000..b6c0a7b37ee
--- /dev/null
+++ b/lld/test/ELF/eh-frame-marker.s
@@ -0,0 +1,6 @@
+// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
+// RUN: ld.lld %t.o -o %t.so -shared
+// We used to crash on this.
+ .section .eh_frame
+foo:
+ .long 0
OpenPOWER on IntegriCloud