[PATCH] D55943: [RuntimeDyld] load all non-relocation sections with ProcessAllSections
Yonghong Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 20 10:54:50 PST 2018
yonghong-song created this revision.
yonghong-song added reviewers: lhames, labath.
Herald added subscribers: llvm-commits, aprantl.
This commit 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 to both .BTF.ext and .BTF for debugging
purpose. Since .BTF is not loaded, this patch addressed this issue
by iterating over all sections and loading any missing
non-relocation sections, after symbol/relocation processing
in loadObjectImpl().
Repository:
rL LLVM
https://reviews.llvm.org/D55943
Files:
lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
===================================================================
--- lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -382,6 +382,29 @@
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) {
+ section_iterator RelocatedSection = SI->getRelocatedSection();
+
+ // Ignore relocation sections
+ if (RelocatedSection != SE)
+ continue;
+
+ bool IsCode = SI->isText();
+ unsigned SectionID = 0;
+ if (auto SectionIDOrErr = findOrEmitSection(Obj, *SI, IsCode,
+ LocalSections))
+ SectionID = *SectionIDOrErr;
+ else
+ return SectionIDOrErr.takeError();
+
+ LLVM_DEBUG(dbgs() << "\tSectionID: " << SectionID << "\n");
+ }
+ }
+
// Give the subclasses a chance to tie-up any loose ends.
if (auto Err = finalizeLoad(Obj, LocalSections))
return std::move(Err);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55943.179103.patch
Type: text/x-patch
Size: 1237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181220/15b060cf/attachment.bin>
More information about the llvm-commits
mailing list