4 Commits

Author SHA1 Message Date
Maksim Panchenko
8ea59ec607
[BOLT] Use rewriter interface for updating binary build ID (#94273)
Move functionality for patching build ID into a separate rewriter class
and change the way we do the patching. Support build ID in different
note sections in order to update the build ID in the Linux kernel binary
which puts in into ".notes" section instead of ".note.gnu.build-id".
2024-06-03 21:39:47 -07:00
Maksim Panchenko
aa1968c2eb
[BOLT] Add metadata pre-emit finalization interface (#79925)
Some metadata needs to be updated/finalized before the binary context is
emitted into the binary. Add the interface and use it for Linux ORC
update invocation.
2024-01-29 17:27:33 -08:00
Maksim Panchenko
dd630d831c [BOLT][NFC] Add post-CFG processing to MetadataRewriter interface
Add MetadataRewriter::postCFGInitializer().

Reviewed By: jobnoorman

Differential Revision: https://reviews.llvm.org/D155153
2023-07-13 11:09:57 -07:00
Maksim Panchenko
c9b1f06288 [BOLT] Introduce MetadataRewriter interface
Introduce the MetadataRewriter interface to handle updates for various
types of auxiliary data stored in a binary file.

To implement metadata processing using this new interface, all metadata
rewriters should derive from the RewriterBase class and implement
one or more of the following methods, depending on the timing of metadata
read and write operations:

  * preCFGInitializer()
  * postCFGInitializer() // TBD
  * preEmitFinalizer()   // TBD
  * postEmitFinalizer()

By adopting this approach, we aim to simplify the RewriteInstance class
and improve its scalability to accommodate new extensions of file formats,
including various metadata types of the Linux Kernel.

Differential Revision: https://reviews.llvm.org/D154020
2023-07-06 11:09:51 -07:00