[PATCH] D135494: [BOLT] Section-handling refactoring/overhaul

Denis Revunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 10:00:50 PDT 2022


treapster added a comment.

@maksfb, it doesn't seem like we should deregister updated sections. We don't deregister .init_array or .rodata. My understanding of current logic is that when you emit a section with orgSecPrefix, EFMM will update the original section, and when you emit with original name, EFMM creates a new section and renames the old. Aside from a slight confusion, it causes troubles updating .text section, because you cannot simply emit .text with prefix the same way we do with data sections, so we always get a new BinarySection instance while we need to update the old. When we have two instances, we can't deregister old .text section since a lot of stuff depends on it. So it looks like at least for .text we'll be better off calling BC.registerOrUpdateSection() in EFMM without extra name management. But if we dive further in binary rewriting, similar issues arise with eh frames, and in that case i think it's more reasonable to keep all that renaming/duplicating stuff in RewriteInstance/BinaryEmitter since we may decide different strategy depending on the options.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135494/new/

https://reviews.llvm.org/D135494



More information about the llvm-commits mailing list