[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
Fri Dec 5 14:50:23 PST 2025


================
@@ -1431,13 +1431,30 @@ void BinaryContext::processInterproceduralReferences() {
             << TargetFunction->getPrintName() << '\n';
       }
 
+      const uint64_t TargetOffset = Address - TargetFunction->getAddress();
----------------
maksfb wrote:

Thanks - looks much cleaner. I suggest we move this code inside `handleExternalBranchTarget()` and check for the return value. I we see a branch into the middle of instruction, it's safer to ignore both functions.

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


More information about the llvm-commits mailing list