Skip to content

Commit

Permalink
[RuntimeDyld][MachO] Fix handling of empty eh-frame sections.
Browse files Browse the repository at this point in the history
This patch switches from an unguarded to a guarded loop for eh-frame record
fixups. In the unguarded version we would always make at least one call to
processFDE, which would then crash trying to fix up a frame that didn't exist.

Fixes <rdar://problem/24301582>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259103 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lhames committed Jan 28, 2016
1 parent 681c4b8 commit 88ffce3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ void RuntimeDyldMachOCRTPBase<Impl>::registerEHFrames() {

uint8_t *P = EHFrame->getAddress();
uint8_t *End = P + EHFrame->getSize();
do {
while (P != End) {
P = processFDE(P, DeltaForText, DeltaForEH);
} while (P != End);
}

MemMgr.registerEHFrames(EHFrame->getAddress(), EHFrame->getLoadAddress(),
EHFrame->getSize());
Expand Down
7 changes: 7 additions & 0 deletions test/ExecutionEngine/RuntimeDyld/X86/MachO_empty_ehframe.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %T/empty_eh_frame.o %s
# RUN: llvm-rtdyld -verify -triple=x86_64-apple-macosx10.9 %T/empty_eh_frame.o

.section __TEXT,__eh_frame
.macosx_version_min 10, 10

.subsections_via_symbols

0 comments on commit 88ffce3

Please sign in to comment.