[PATCH] D146241: [BOLT] Manage section naming/cloning in RewriteInstance

Denis Revunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 10:01:49 PDT 2023


treapster created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: All.
treapster requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

This is a first step towards -rewrite option from D144560 <https://reviews.llvm.org/D144560>.

EFMM after https://reviews.llvm.org/D135494 managed section names in the
following manner: if a section was emitted with orgSecPrefix, it updated
original BinarySection, and if it was emitted with original name, the
section was duplicated with newSecPrefix. The problem is that we can't
control what name is used to emit .text or .eh_frame, and the old code
made it impossible to rewrite these sections in-place(correct me if i'm wrong). Here we remove
all the management from EFMM and explicitly rename sections in
RewriteInstance if we want them duplicated, or don't touch them when we
rewrite, thus allowing EFMM to update them. We also have to rename some
sections like eh_frame back in case they were not emitted, which is a
bit combersome, but overall we get more flexibility over what sections
we want and under which names. In case of -reorder-data pass, i think
the simplest solution is to just create new section with .hot suffix,
and emit it under this name.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146241

Files:
  bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
  bolt/include/bolt/Rewrite/RewriteInstance.h
  bolt/lib/Core/BinaryEmitter.cpp
  bolt/lib/Passes/ReorderData.cpp
  bolt/lib/Rewrite/ExecutableFileMemoryManager.cpp
  bolt/lib/Rewrite/MachORewriteInstance.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/test/reorder-data-writable-ptload.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146241.505849.patch
Type: text/x-patch
Size: 13065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230316/faa29b32/attachment.bin>


More information about the llvm-commits mailing list