diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -217,6 +217,11 @@ cl::Hidden, cl::cat(BoltCategory)); +static cl::opt SkipPhdrRewrite( + "skip-phdr-rewrite", + cl::desc("Developer use only: skip updating program headers"), + cl::ReallyHidden, cl::cat(BoltCategory)); + cl::opt 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(InputFile); const ELFFile &Obj = ELF64LEFile->getELFFile(); raw_fd_ostream &OS = Out->os();