diff --git a/bolt/lib/Passes/PatchEntries.cpp b/bolt/lib/Passes/PatchEntries.cpp index 8a2f0a39a56cc..4877e7dd8fdf3 100644 --- a/bolt/lib/Passes/PatchEntries.cpp +++ b/bolt/lib/Passes/PatchEntries.cpp @@ -98,21 +98,10 @@ Error PatchEntries::runOnFunctions(BinaryContext &BC) { }); if (!Success) { - // We can't change output layout for AArch64 due to LongJmp pass - if (BC.isAArch64()) { - if (opts::ForcePatch) { - BC.errs() << "BOLT-ERROR: unable to patch entries in " << Function - << "\n"; - return createFatalBOLTError(""); - } - - continue; - } - // If the original function entries cannot be patched, then we cannot // safely emit new function body. BC.errs() << "BOLT-WARNING: failed to patch entries in " << Function - << ". The function will not be optimized.\n"; + << ". The function will not be optimized\n"; Function.setIgnored(); continue; } diff --git a/bolt/lib/Rewrite/BinaryPassManager.cpp b/bolt/lib/Rewrite/BinaryPassManager.cpp index dd48653931eb9..996d2e972599d 100644 --- a/bolt/lib/Rewrite/BinaryPassManager.cpp +++ b/bolt/lib/Rewrite/BinaryPassManager.cpp @@ -497,6 +497,10 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) { // memory profiling data. Manager.registerPass(std::make_unique()); + // Patch original function entries + if (BC.HasRelocations) + Manager.registerPass(std::make_unique()); + if (BC.isAArch64()) { Manager.registerPass( std::make_unique(PrintAdrRelaxation)); @@ -524,10 +528,6 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) { // Assign each function an output section. Manager.registerPass(std::make_unique()); - // Patch original function entries - if (BC.HasRelocations) - Manager.registerPass(std::make_unique()); - // This pass turns tail calls into jumps which makes them invisible to // function reordering. It's unsafe to use any CFG or instruction analysis // after this point.