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

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 28 08:00:35 PST 2025


================
@@ -0,0 +1,47 @@
+## Test that BOLT errs when detecting the target 
+## of a direct call/branch is a invalid instruction
+
+# REQUIRES: system-linux
+# RUN: rm -rf %t && mkdir -p %t && cd %t
+# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o main.o
+# RUN: %clang %cflags -pie -Wl,-q %t/main.o -o main.exe
+# RUN: llvm-bolt %t/main.exe -o %t/main.exe.bolt -lite=0 2>&1 | FileCheck %s --check-prefix=CHECK-TARGETS
+
+# CHECK-TARGETS: BOLT-WARNING: corrupted control flow detected in function external_corrcupt, an external branch/call targets an invalid instruction at address 0x{{[0-9a-f]+}}
----------------
paschalis-mpeis wrote:

I had this nit but it somehow didn't appear in my review:

`corrcupt` -> `corrupt`

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


More information about the llvm-commits mailing list