[llvm] [BOLT][AArch64] Don't change layout in PatchEntries (PR #71278)

Vladislav Khmelevsky via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 4 04:08:26 PDT 2023


https://github.com/yota9 created https://github.com/llvm/llvm-project/pull/71278

Due to LongJmp pass that is executed before PatchEntries we can't ignore
the function here since it would change pre-calculated output layout.
This is also attemp to fix #70771


>From 1d9b395612e2880b08f81e64adcc406426890731 Mon Sep 17 00:00:00 2001
From: Vladislav Khmelevsky <och95 at yandex.ru>
Date: Sat, 4 Nov 2023 15:00:31 +0400
Subject: [PATCH] [BOLT][AArch64] Don't change layout in PatchEntries

Due to LongJmp pass that is executed before PatchEntries we can't ignore
the function here since it would change pre-calculated output layout.
This is also attemp to fix #70771
---
 bolt/lib/Passes/PatchEntries.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/bolt/lib/Passes/PatchEntries.cpp b/bolt/lib/Passes/PatchEntries.cpp
index 02a044d8b2f69f5..fb66d3abca5c580 100644
--- a/bolt/lib/Passes/PatchEntries.cpp
+++ b/bolt/lib/Passes/PatchEntries.cpp
@@ -98,6 +98,17 @@ void PatchEntries::runOnFunctions(BinaryContext &BC) {
     });
 
     if (!Success) {
+      // We can't change output layout for AArch64 due to LongJmp pass
+      if (BC.IsAArch64()) {
+        if (ForcePatch) {
+          errs() << "BOLT-ERROR: unable to patch entries in " << Function
+                 << "\n";
+          exit(1);
+        }
+
+        continue;
+      }
+
       // If the original function entries cannot be patched, then we cannot
       // safely emit new function body.
       errs() << "BOLT-WARNING: failed to patch entries in " << Function



More information about the llvm-commits mailing list