summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2019-01-28 21:35:23 +0000
committerYonghong Song <yhs@fb.com>2019-01-28 21:35:23 +0000
commit61bc1d7ed56b6eb6ad89c3c623078de3b20f82e5 (patch)
tree4c9d54d943603d5a1757408cccbbec2f1bb24d0b /llvm/lib/ExecutionEngine
parent27fd307b83f79fa014ce2f2ab74061d249c8ddbe (diff)
downloadbcm5719-llvm-61bc1d7ed56b6eb6ad89c3c623078de3b20f82e5.tar.gz
bcm5719-llvm-61bc1d7ed56b6eb6ad89c3c623078de3b20f82e5.zip
[RuntimeDyld] load all sections with ProcessAllSections
This patch tried to address the following use case. . bcc (https://github.com/iovisor/bcc) utilizes llvm JIT to compile for BTF target. . with -g, .BTF and .BTF.ext sections (BPF debug info) will be generated by LLVM. . .BTF does not have relocations and .BTF.ext has some relocations. . With ProcessAllSections, .BTF.ext is loaded by JIT dynamic linker and is available to application. But .BTF is not loaded. The bcc application needs both .BTF.ext and .BTF for debugging purpose, and .BTF is not loaded. This patch addressed this issue by iterating over all sections and loading any missing sections, after symbol/relocation processing in loadObjectImpl(). Signed-off-by: Yonghong Song <yhs@fb.com> Differential Revision: https://reviews.llvm.org/D55943 llvm-svn: 352432
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index ab602d9e026..473a8120b42 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -381,6 +381,25 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
Checker->registerStubMap(Obj.getFileName(), SectionID, Stubs);
}
+ // Process remaining sections
+ if (ProcessAllSections) {
+ LLVM_DEBUG(dbgs() << "Process remaining sections:\n");
+ for (section_iterator SI = Obj.section_begin(), SE = Obj.section_end();
+ SI != SE; ++SI) {
+
+ /* Ignore already loaded sections */
+ if (LocalSections.find(*SI) != LocalSections.end())
+ continue;
+
+ bool IsCode = SI->isText();
+ if (auto SectionIDOrErr =
+ findOrEmitSection(Obj, *SI, IsCode, LocalSections))
+ LLVM_DEBUG(dbgs() << "\tSectionID: " << (*SectionIDOrErr) << "\n");
+ else
+ return SectionIDOrErr.takeError();
+ }
+ }
+
// Give the subclasses a chance to tie-up any loose ends.
if (auto Err = finalizeLoad(Obj, LocalSections))
return std::move(Err);
OpenPOWER on IntegriCloud