[llvm-branch-commits] [llvm-branch] r236068 - Merging r234975:
Tom Stellard
thomas.stellard at amd.com
Tue Apr 28 17:41:58 PDT 2015
Author: tstellar
Date: Tue Apr 28 19:41:57 2015
New Revision: 236068
URL: http://llvm.org/viewvc/llvm-project?rev=236068&view=rev
Log:
Merging r234975:
------------------------------------------------------------------------
r234975 | lhames | 2015-04-14 23:39:22 -0400 (Tue, 14 Apr 2015) | 5 lines
[RuntimeDyld] Make sure we emit MachO __eh_frame and __gcc_except_tab sections,
even if there are no references to them in the code.
This allows exceptions thrown from JIT'd code to be caught by the JIT itself.
------------------------------------------------------------------------
Modified:
llvm/branches/release_36/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
llvm/branches/release_36/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
Modified: llvm/branches/release_36/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp?rev=236068&r1=236067&r2=236068&view=diff
==============================================================================
--- llvm/branches/release_36/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp (original)
+++ llvm/branches/release_36/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp Tue Apr 28 19:41:57 2015
@@ -177,25 +177,30 @@ bool RuntimeDyldMachO::isCompatibleFile(
}
template <typename Impl>
-void RuntimeDyldMachOCRTPBase<Impl>::finalizeLoad(const ObjectFile &ObjImg,
+void RuntimeDyldMachOCRTPBase<Impl>::finalizeLoad(const ObjectFile &Obj,
ObjSectionToIDMap &SectionMap) {
unsigned EHFrameSID = RTDYLD_INVALID_SECTION_ID;
unsigned TextSID = RTDYLD_INVALID_SECTION_ID;
unsigned ExceptTabSID = RTDYLD_INVALID_SECTION_ID;
- ObjSectionToIDMap::iterator i, e;
- for (i = SectionMap.begin(), e = SectionMap.end(); i != e; ++i) {
- const SectionRef &Section = i->first;
+ for (const auto &Section : Obj.sections()) {
StringRef Name;
Section.getName(Name);
- if (Name == "__eh_frame")
- EHFrameSID = i->second;
- else if (Name == "__text")
- TextSID = i->second;
+
+ // Force emission of the __text, __eh_frame, and __gcc_except_tab sections
+ // if they're present. Otherwise call down to the impl to handle other
+ // sections that have already been emitted.
+ if (Name == "__text")
+ TextSID = findOrEmitSection(Obj, Section, true, SectionMap);
+ else if (Name == "__eh_frame")
+ EHFrameSID = findOrEmitSection(Obj, Section, false, SectionMap);
else if (Name == "__gcc_except_tab")
- ExceptTabSID = i->second;
- else
- impl().finalizeSection(ObjImg, i->second, Section);
+ ExceptTabSID = findOrEmitSection(Obj, Section, true, SectionMap);
+ else {
+ auto I = SectionMap.find(Section);
+ if (I != SectionMap.end())
+ impl().finalizeSection(Obj, I->second, Section);
+ }
}
UnregisteredEHFrameSections.push_back(
EHFrameRelatedSections(EHFrameSID, TextSID, ExceptTabSID));
Modified: llvm/branches/release_36/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s?rev=236068&r1=236067&r2=236068&view=diff
==============================================================================
--- llvm/branches/release_36/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s (original)
+++ llvm/branches/release_36/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s Tue Apr 28 19:41:57 2015
@@ -31,6 +31,13 @@ insn3:
movl $0, %eax
retq
+# Test processing of the __eh_frame section.
+# rtdyld-check: *{8}(section_addr(test_x86-64.o, __eh_frame) + 0x20) = eh_frame_test - (section_addr(test_x86-64.o, __eh_frame) + 0x20)
+eh_frame_test:
+ .cfi_startproc
+ retq
+ .cfi_endproc
+
.comm y,4,2
.section __DATA,__data
More information about the llvm-branch-commits
mailing list