[PATCH] D136205: [BOLT][NFC] Refactor EFMM initialization
Maksim Panchenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 18 15:00:37 PDT 2022
maksfb created this revision.
maksfb added reviewers: yota9, Amir, ayermolo, rafauler, yavtuk.
Herald added a subscriber: treapster.
Herald added a project: All.
maksfb requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Move EFMM initialization code to emitAndLink(), where EFMM is used.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D136205
Files:
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -407,14 +407,6 @@
NamedRegionTimer T("discoverStorage", "discover storage", TimerGroupName,
TimerGroupDesc, opts::TimeRewrite);
- // Stubs are harmful because RuntimeDyld may try to increase the size of
- // sections accounting for stubs when we need those sections to match the
- // same size seen in the input binary, in case this section is a copy
- // of the original one seen in the binary.
- BC->EFMM.reset(new ExecutableFileMemoryManager(*BC, /*AllowStubs*/ false));
- BC->EFMM->setNewSecPrefix(getNewSecPrefix());
- BC->EFMM->setOrgSecPrefix(getOrgSecPrefix());
-
auto ELF64LEFile = dyn_cast<ELF64LEObjectFile>(InputFile);
const ELFFile<ELF64LE> &Obj = ELF64LEFile->getELFFile();
@@ -3180,6 +3172,14 @@
MCAsmLayout FinalLayout(
static_cast<MCObjectStreamer *>(Streamer.get())->getAssembler());
+ // Disable stubs because RuntimeDyld may try to increase the size of
+ // sections accounting for stubs. We need those sections to match the
+ // same size seen in the input binary, in case this section is a copy
+ // of the original one seen in the binary.
+ BC->EFMM.reset(new ExecutableFileMemoryManager(*BC, /*AllowStubs=*/false));
+ BC->EFMM->setNewSecPrefix(getNewSecPrefix());
+ BC->EFMM->setOrgSecPrefix(getOrgSecPrefix());
+
RTDyld.reset(new decltype(RTDyld)::element_type(*BC->EFMM, Resolver));
RTDyld->setProcessAllSections(false);
RTDyld->loadObject(*Obj);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136205.468715.patch
Type: text/x-patch
Size: 1640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221018/a86256c2/attachment.bin>
More information about the llvm-commits
mailing list