[llvm] [BOLT] Correctly handle entry point at FDE boundaries (PR #176173)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 06:24:19 PDT 2026


================
@@ -2067,6 +2068,152 @@ void RewriteInstance::disassemblePLT() {
   }
 }
 
+namespace {
+
+/// True when the predecessor body ends at its FDE boundary, so trailing bytes
+/// are outside both symtab size and unwind info:
+///   (1) __BOLT_FDE_FUNC* (FDE with no symtab entry), or
+///   (2) a normal symbol whose size equals its FDE address range.
+bool isCFIBoundedTailPredecessor(const BinaryFunction &BF,
+                                 const CFIReaderWriter &CFI) {
+  if (BF.getOneName().starts_with("__BOLT_FDE_FUNC"))
+    return true;
+  auto FDEI = CFI.getFDEs().find(BF.getAddress());
+  if (FDEI == CFI.getFDEs().end())
+    return false;
+  return FDEI->second->getAddressRange() == BF.getSize();
+}
+
+bool hasDataMarkerAt(DenseMap<uint64_t, MarkerSymType> &MarkerSyms,
+                     uint64_t Address) {
+  auto It = MarkerSyms.find(Address);
+  return It != MarkerSyms.end() && It->second == MarkerSymType::DATA;
+}
+
+/// AArch64 padding / filler instructions that may appear in slack but are not
+/// standalone callable functions.
+static bool isAArch64TailPaddingInst(const BinaryContext &BC,
----------------
paschalis-mpeis wrote:

nits: could drop the statics since we are in a namespace? maybe `hasDataMarkerAt` could be a lambda?

https://github.com/llvm/llvm-project/pull/176173


More information about the llvm-commits mailing list