[PATCH] D155758: [BOLT] Add h4xx0r flag to skip updating program headers

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 15:06:52 PDT 2023


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

`-skip-phdr-rewrite` FTW


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155758

Files:
  bolt/lib/Rewrite/RewriteInstance.cpp


Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -217,6 +217,11 @@
   cl::Hidden,
   cl::cat(BoltCategory));
 
+static cl::opt<bool> SkipPhdrRewrite(
+    "skip-phdr-rewrite",
+    cl::desc("Developer use only: skip updating program headers"),
+    cl::ReallyHidden, cl::cat(BoltCategory));
+
 cl::opt<bool>
 TrapOldCode("trap-old-code",
   cl::desc("insert traps in old function bodies (relocation mode)"),
@@ -3642,6 +3647,9 @@
 }
 
 void RewriteInstance::patchELFPHDRTable() {
+  if (opts::SkipPhdrRewrite)
+    return;
+
   auto ELF64LEFile = cast<ELF64LEObjectFile>(InputFile);
   const ELFFile<ELF64LE> &Obj = ELF64LEFile->getELFFile();
   raw_fd_ostream &OS = Out->os();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155758.542216.patch
Type: text/x-patch
Size: 826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230719/8e4fe37b/attachment.bin>


More information about the llvm-commits mailing list