[llvm] [BOLT] Add validation for direct call/branch targets, bypassing invalid functions (PR #165406)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 4 01:00:23 PST 2025


================
@@ -2320,6 +2320,16 @@ class BinaryFunction {
   /// zero-value bytes.
   bool isZeroPaddingAt(uint64_t Offset) const;
 
+  /// Validates if the target of an external direct branch/call is a valid
+  /// executable instruction.
+  /// Return true if the target is valid, false otherwise.
+  bool validateExternalBranch(uint64_t TargetAddress);
+
+  /// Validates if the target of an internal direct branch/call is a valid
+  /// executable instruction.
+  /// Return true if the target is valid, false otherwise.
+  bool validateInternalBranch();
----------------
maksfb wrote:

nit: rename to `validateInternalBranches()`

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


More information about the llvm-commits mailing list