Skip to content

[LowerTypeTests] Add debug info to jump table entries#192736

Merged
vitalybuka merged 7 commits into
mainfrom
users/vitalybuka/spr/lowertypetests-add-debug-info-to-jump-table-entries
Apr 23, 2026
Merged

[LowerTypeTests] Add debug info to jump table entries#192736
vitalybuka merged 7 commits into
mainfrom
users/vitalybuka/spr/lowertypetests-add-debug-info-to-jump-table-entries

Conversation

@vitalybuka

@vitalybuka vitalybuka commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:

#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0

Created using spr 1.3.7
@llvmbot

llvmbot commented Apr 17, 2026

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-llvm-transforms

Author: Vitaly Buka (vitalybuka)

Changes

When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.


Full diff: https://github.com/llvm/llvm-project/pull/192736.diff

3 Files Affected:

  • (modified) llvm/lib/Transforms/IPO/LowerTypeTests.cpp (+35)
  • (modified) llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll (+11-4)
  • (modified) llvm/test/Transforms/LowerTypeTests/x86-jumptable.ll (+22-8)
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index a390b983b1ded..cf653ab15beea 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1529,11 +1529,46 @@ Triple::ArchType LowerTypeTestsModule::selectJumpTableArmEncoding(
   return ArmCount > ThumbCount ? Triple::arm : Triple::thumb;
 }
 
+static llvm::DILocation *createDebugInfo(Function *F) {
+  Module &M = *F->getParent();
+  DICompileUnit *CU = nullptr;
+  auto CUs = M.debug_compile_units();
+  if (!CUs.empty())
+    CU = *CUs.begin();
+
+  DIBuilder DIB(M, /*AllowUnresolved=*/true, CU);
+  llvm::DIFile *File = DIB.createFile("ubsan_interface.h", "sanitizer");
+  if (!CU) {
+    CU = DIB.createCompileUnit(
+        DISourceLanguageName(dwarf::DW_LANG_C), File, "llvm", true, "", 0, "",
+        DICompileUnit::DebugEmissionKind::LineTablesOnly);
+  }
+
+  DISubroutineType *DIFnTy = DIB.createSubroutineType(nullptr);
+
+  llvm::DISubprogram *NormalSP = DIB.createFunction(
+      File, F->getName(), StringRef(), File, 0, DIFnTy, 0,
+      DINode::FlagArtificial, DISubprogram::SPFlagDefinition);
+  F->setSubprogram(NormalSP);
+
+  llvm::DISubprogram *InlineSP = DIB.createFunction(
+      File, "__ubsan_check_cfi_icall_jt", StringRef(), File, 0, DIFnTy, 0,
+      DINode::FlagArtificial, DISubprogram::SPFlagDefinition);
+
+  DIB.finalize();
+
+  return llvm::DILocation::get(
+      M.getContext(), 0, 0, InlineSP,
+      llvm::DILocation::get(M.getContext(), 0, 0, NormalSP));
+}
+
 void LowerTypeTestsModule::createJumpTable(
     Function *F, ArrayRef<GlobalTypeMember *> Functions,
     Triple::ArchType JumpTableArch) {
   BasicBlock *BB = BasicBlock::Create(M.getContext(), "entry", F);
   IRBuilder<> IRB(BB);
+  if (ClAnnotateDebugInfo)
+    IRB.SetCurrentDebugLocation(createDebugInfo(F));
 
   InlineAsm *JumpTableAsm = createJumpTableEntryAsm(JumpTableArch);
 
diff --git a/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll b/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll
index 00c11b5b85bc7..e3e6de3d76c31 100644
--- a/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll
+++ b/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll
@@ -85,9 +85,9 @@ define i1 @foo(ptr %p) {
 ; AARCH64_DBG: Function Attrs: naked noinline
 ; AARCH64_DBG-LABEL: @.cfi.jumptable(
 ; AARCH64_DBG-NEXT:  entry:
-; AARCH64_DBG-NEXT:    call void asm sideeffect "bti c\0Ab $0\0A", "s"(ptr @f.cfi)
-; AARCH64_DBG-NEXT:    call void asm sideeffect "bti c\0Ab $0\0A", "s"(ptr @g.cfi)
-; AARCH64_DBG-NEXT:    unreachable
+; AARCH64_DBG-NEXT:    call void asm sideeffect "bti c\0Ab $0\0A", "s"(ptr @f.cfi), !dbg [[DBG6:![0-9]+]]
+; AARCH64_DBG-NEXT:    call void asm sideeffect "bti c\0Ab $0\0A", "s"(ptr @g.cfi), !dbg [[DBG6]]
+; AARCH64_DBG-NEXT:    unreachable, !dbg [[DBG6]]
 ;
 ;.
 ; AARCH64: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
@@ -102,5 +102,12 @@ define i1 @foo(ptr %p) {
 ; AARCH64: [[META1:![0-9]+]] = !{i32 0, !"typeid1"}
 ;.
 ; AARCH64_DBG: [[META0:![0-9]+]] = !{i32 4, !"branch-target-enforcement", i32 1}
-; AARCH64_DBG: [[META1:![0-9]+]] = !{i32 0, !"typeid1"}
+; AARCH64_DBG: [[META1:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: [[META2:![0-9]+]], producer: "llvm", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly)
+; AARCH64_DBG: [[META2]] = !DIFile(filename: "{{.*}}ubsan_interface.h", directory: {{.*}})
+; AARCH64_DBG: [[META3:![0-9]+]] = !{i32 0, !"typeid1"}
+; AARCH64_DBG: [[META4:![0-9]+]] = distinct !DISubprogram(name: ".cfi.jumptable", scope: [[META2]], file: [[META2]], type: [[META5:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META1]])
+; AARCH64_DBG: [[META5]] = !DISubroutineType(types: null)
+; AARCH64_DBG: [[DBG6]] = !DILocation(line: 0, scope: [[META7:![0-9]+]], inlinedAt: [[META8:![0-9]+]])
+; AARCH64_DBG: [[META7]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall_jt", scope: [[META2]], file: [[META2]], type: [[META5]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META1]])
+; AARCH64_DBG: [[META8]] = !DILocation(line: 0, scope: [[META4]])
 ;.
diff --git a/llvm/test/Transforms/LowerTypeTests/x86-jumptable.ll b/llvm/test/Transforms/LowerTypeTests/x86-jumptable.ll
index 4a8cb0166cc12..e752392b1f058 100644
--- a/llvm/test/Transforms/LowerTypeTests/x86-jumptable.ll
+++ b/llvm/test/Transforms/LowerTypeTests/x86-jumptable.ll
@@ -112,9 +112,9 @@ define i1 @foo(ptr %p) {
 ;
 ; X86_32_DBG-LABEL: @.cfi.jumptable(
 ; X86_32_DBG-NEXT:  entry:
-; X86_32_DBG-NEXT:    call void asm sideeffect "endbr32\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @f.cfi)
-; X86_32_DBG-NEXT:    call void asm sideeffect "endbr32\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @g.cfi)
-; X86_32_DBG-NEXT:    unreachable
+; X86_32_DBG-NEXT:    call void asm sideeffect "endbr32\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @f.cfi), !dbg [[DBG6:![0-9]+]]
+; X86_32_DBG-NEXT:    call void asm sideeffect "endbr32\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @g.cfi), !dbg [[DBG6]]
+; X86_32_DBG-NEXT:    unreachable, !dbg [[DBG6]]
 ;
 ;
 ; X86_64_DBG-LABEL: @f.cfi(
@@ -135,9 +135,9 @@ define i1 @foo(ptr %p) {
 ;
 ; X86_64_DBG-LABEL: @.cfi.jumptable(
 ; X86_64_DBG-NEXT:  entry:
-; X86_64_DBG-NEXT:    call void asm sideeffect "endbr64\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @f.cfi)
-; X86_64_DBG-NEXT:    call void asm sideeffect "endbr64\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @g.cfi)
-; X86_64_DBG-NEXT:    unreachable
+; X86_64_DBG-NEXT:    call void asm sideeffect "endbr64\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @f.cfi), !dbg [[DBG6:![0-9]+]]
+; X86_64_DBG-NEXT:    call void asm sideeffect "endbr64\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @g.cfi), !dbg [[DBG6]]
+; X86_64_DBG-NEXT:    unreachable, !dbg [[DBG6]]
 ;
 ;.
 ; X86_32: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
@@ -163,8 +163,22 @@ define i1 @foo(ptr %p) {
 ; X86_64: [[META1:![0-9]+]] = !{i32 0, !"typeid1"}
 ;.
 ; X86_32_DBG: [[META0:![0-9]+]] = !{i32 8, !"cf-protection-branch", i32 1}
-; X86_32_DBG: [[META1:![0-9]+]] = !{i32 0, !"typeid1"}
+; X86_32_DBG: [[META1:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: [[META2:![0-9]+]], producer: "llvm", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly)
+; X86_32_DBG: [[META2]] = !DIFile(filename: "{{.*}}ubsan_interface.h", directory: {{.*}})
+; X86_32_DBG: [[META3:![0-9]+]] = !{i32 0, !"typeid1"}
+; X86_32_DBG: [[META4:![0-9]+]] = distinct !DISubprogram(name: ".cfi.jumptable", scope: [[META2]], file: [[META2]], type: [[META5:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META1]])
+; X86_32_DBG: [[META5]] = !DISubroutineType(types: null)
+; X86_32_DBG: [[DBG6]] = !DILocation(line: 0, scope: [[META7:![0-9]+]], inlinedAt: [[META8:![0-9]+]])
+; X86_32_DBG: [[META7]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall_jt", scope: [[META2]], file: [[META2]], type: [[META5]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META1]])
+; X86_32_DBG: [[META8]] = !DILocation(line: 0, scope: [[META4]])
 ;.
 ; X86_64_DBG: [[META0:![0-9]+]] = !{i32 8, !"cf-protection-branch", i32 1}
-; X86_64_DBG: [[META1:![0-9]+]] = !{i32 0, !"typeid1"}
+; X86_64_DBG: [[META1:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: [[META2:![0-9]+]], producer: "llvm", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly)
+; X86_64_DBG: [[META2]] = !DIFile(filename: "{{.*}}ubsan_interface.h", directory: {{.*}})
+; X86_64_DBG: [[META3:![0-9]+]] = !{i32 0, !"typeid1"}
+; X86_64_DBG: [[META4:![0-9]+]] = distinct !DISubprogram(name: ".cfi.jumptable", scope: [[META2]], file: [[META2]], type: [[META5:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META1]])
+; X86_64_DBG: [[META5]] = !DISubroutineType(types: null)
+; X86_64_DBG: [[DBG6]] = !DILocation(line: 0, scope: [[META7:![0-9]+]], inlinedAt: [[META8:![0-9]+]])
+; X86_64_DBG: [[META7]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall_jt", scope: [[META2]], file: [[META2]], type: [[META5]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META1]])
+; X86_64_DBG: [[META8]] = !DILocation(line: 0, scope: [[META4]])
 ;.

@vitalybuka vitalybuka requested review from fmayer, pcc and thurstond April 17, 2026 20:56
vitalybuka added a commit that referenced this pull request Apr 21, 2026
…als (#192734)

Debug information will be updated in the
#192736,
so we want to track the difference.
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Apr 21, 2026
…-check-globals (#192734)

Debug information will be updated in the
llvm/llvm-project#192736,
so we want to track the difference.
cpullvm-upstream-sync Bot pushed a commit to navaneethshan/cpullvm-toolchain-1 that referenced this pull request Apr 21, 2026
…-check-globals (#192734)

Debug information will be updated in the
llvm/llvm-project#192736,
so we want to track the difference.
Created using spr 1.3.7

[skip ci]
Created using spr 1.3.7
@github-actions

github-actions Bot commented Apr 21, 2026

Copy link
Copy Markdown

🐧 Linux x64 Test Results

  • 194071 tests passed
  • 5107 tests skipped

✅ The build succeeded and all tests passed.

@pcc pcc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this make the debug info more confusing? Previously debuggers would see the jump table entry symbols from the ELF symbol table, but now it looks like they will just see a symbol name ".cfi.jumptable"? I think I would expect each jump table entry to have separate .debug_line entry named after the function, with the __ubsan_check_cfi_icall_jt inlined inside it.

vitalybuka added a commit that referenced this pull request Apr 21, 2026
… info (#192735)

It just recommits test copied from non dbg version.

Implementation is #192736.
vitalybuka added a commit that referenced this pull request Apr 22, 2026
… info (#192735) (#193358)

It just recommits test copied from non dbg version.

Implementation is #192736.

This is the same as #192735, accidentally merged into spr/users branch.
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Apr 22, 2026
… with debug info (#192735) (#193358)

It just recommits test copied from non dbg version.

Implementation is llvm/llvm-project#192736.

This is the same as #192735, accidentally merged into spr/users branch.
kastiglione and others added 2 commits April 21, 2026 20:21
Created using spr 1.3.7

[skip ci]
Created using spr 1.3.7
@vitalybuka vitalybuka changed the base branch from users/vitalybuka/spr/main.lowertypetests-add-debug-info-to-jump-table-entries to main April 22, 2026 03:22
@vitalybuka vitalybuka requested a review from pcc April 22, 2026 03:23
@vitalybuka

Copy link
Copy Markdown
Contributor Author

Won't this make the debug info more confusing? Previously debuggers would see the jump table entry symbols from the ELF symbol table, but now it looks like they will just see a symbol name ".cfi.jumptable"? I think I would expect each jump table entry to have separate .debug_line entry named after the function, with the __ubsan_check_cfi_icall_jt inlined inside it.

done

cpullvm-upstream-sync Bot pushed a commit to navaneethshan/cpullvm-toolchain-1 that referenced this pull request Apr 22, 2026
… with debug info (#192735) (#193358)

It just recommits test copied from non dbg version.

Implementation is llvm/llvm-project#192736.

This is the same as #192735, accidentally merged into spr/users branch.

@pcc pcc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/llvm;://g throughout the patch

Created using spr 1.3.7
@vitalybuka vitalybuka enabled auto-merge (squash) April 23, 2026 03:08
@vitalybuka vitalybuka merged commit abb4ff5 into main Apr 23, 2026
9 of 10 checks passed
@boomanaiden154 boomanaiden154 restored the users/vitalybuka/spr/lowertypetests-add-debug-info-to-jump-table-entries branch April 23, 2026 05:03
boomanaiden154 added a commit that referenced this pull request Apr 23, 2026
Reverts #192736

Seems to cause buildbot failures in cross-project-tests, including on
the premerge postcommit builder.

https://lab.llvm.org/staging/#/builders/192/builds/28251
cpullvm-upstream-sync Bot pushed a commit to navaneethshan/cpullvm-toolchain-1 that referenced this pull request Apr 23, 2026
…ies" (#193663)

Reverts llvm/llvm-project#192736

Seems to cause buildbot failures in cross-project-tests, including on
the premerge postcommit builder.

https://lab.llvm.org/staging/#/builders/192/builds/28251
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Apr 23, 2026
…ies" (#193663)

Reverts llvm/llvm-project#192736

Seems to cause buildbot failures in cross-project-tests, including on
the premerge postcommit builder.

https://lab.llvm.org/staging/#/builders/192/builds/28251
linuxlonelyeagle pushed a commit to linuxlonelyeagle/llvm-project that referenced this pull request Apr 23, 2026
… info (llvm#192735) (llvm#193358)

It just recommits test copied from non dbg version.

Implementation is llvm#192736.

This is the same as llvm#192735, accidentally merged into spr/users branch.
vitalybuka added a commit that referenced this pull request Apr 23, 2026
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0
```

This is reland of #192736, reverted with #193663.
This version don't update debug info for "Cross-DSO CFI" mode.
@github-actions github-actions Bot deleted the users/vitalybuka/spr/lowertypetests-add-debug-info-to-jump-table-entries branch April 23, 2026 08:50
llvm-upstreamsync Bot pushed a commit to qualcomm/cpullvm-toolchain that referenced this pull request Apr 24, 2026
…-check-globals (#192734)

Debug information will be updated in the
llvm/llvm-project#192736,
so we want to track the difference.
llvm-upstreamsync Bot pushed a commit to qualcomm/cpullvm-toolchain that referenced this pull request Apr 24, 2026
… with debug info (#192735) (#193358)

It just recommits test copied from non dbg version.

Implementation is llvm/llvm-project#192736.

This is the same as #192735, accidentally merged into spr/users branch.
llvm-upstreamsync Bot pushed a commit to qualcomm/cpullvm-toolchain that referenced this pull request Apr 24, 2026
…ies" (#193663)

Reverts llvm/llvm-project#192736

Seems to cause buildbot failures in cross-project-tests, including on
the premerge postcommit builder.

https://lab.llvm.org/staging/#/builders/192/builds/28251
vitalybuka added a commit to vitalybuka/llvm-project that referenced this pull request Apr 28, 2026
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
llvm#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0
```
vitalybuka added a commit to vitalybuka/llvm-project that referenced this pull request Apr 28, 2026
…93670)

When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
```

This is reland of llvm#192736, reverted with llvm#193663.
This version don't update debug info for "Cross-DSO CFI" mode.
vitalybuka added a commit to vitalybuka/llvm-project that referenced this pull request Apr 28, 2026
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
llvm#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0
```
yingopq pushed a commit to yingopq/llvm-project that referenced this pull request Apr 29, 2026
… info (llvm#192735) (llvm#193358)

It just recommits test copied from non dbg version.

Implementation is llvm#192736.

This is the same as llvm#192735, accidentally merged into spr/users branch.
yingopq pushed a commit to yingopq/llvm-project that referenced this pull request Apr 29, 2026
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
llvm#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
llvm#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0
```
yingopq pushed a commit to yingopq/llvm-project that referenced this pull request Apr 29, 2026
…193663)

Reverts llvm#192736

Seems to cause buildbot failures in cross-project-tests, including on
the premerge postcommit builder.

https://lab.llvm.org/staging/#/builders/192/builds/28251
yingopq pushed a commit to yingopq/llvm-project that referenced this pull request Apr 29, 2026
…93670)

When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
llvm#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
llvm#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0
```

This is reland of llvm#192736, reverted with llvm#193663.
This version don't update debug info for "Cross-DSO CFI" mode.
KHicketts pushed a commit to KHicketts/llvm-project that referenced this pull request Apr 30, 2026
…als (llvm#192734)

Debug information will be updated in the
llvm#192736,
so we want to track the difference.
KHicketts pushed a commit to KHicketts/llvm-project that referenced this pull request Apr 30, 2026
… info (llvm#192735) (llvm#193358)

It just recommits test copied from non dbg version.

Implementation is llvm#192736.

This is the same as llvm#192735, accidentally merged into spr/users branch.
KHicketts pushed a commit to KHicketts/llvm-project that referenced this pull request Apr 30, 2026
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
llvm#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
llvm#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0
```
KHicketts pushed a commit to KHicketts/llvm-project that referenced this pull request Apr 30, 2026
…193663)

Reverts llvm#192736

Seems to cause buildbot failures in cross-project-tests, including on
the premerge postcommit builder.

https://lab.llvm.org/staging/#/builders/192/builds/28251
KHicketts pushed a commit to KHicketts/llvm-project that referenced this pull request Apr 30, 2026
…93670)

When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
llvm#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
llvm#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0
```

This is reland of llvm#192736, reverted with llvm#193663.
This version don't update debug info for "Cross-DSO CFI" mode.
vitalybuka added a commit to vitalybuka/llvm-project that referenced this pull request May 1, 2026
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
llvm#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0
```
vitalybuka added a commit to vitalybuka/llvm-project that referenced this pull request May 2, 2026
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
#1: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
llvm#2: .cfi.jumptable.81 at sanitizer/ubsan_interface.h:0:0
```
vitalybuka added a commit that referenced this pull request May 2, 2026
[LowerTypeTests] Add debug info to jump table entries (#192736)
    
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
#1: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
```

Following up on previous attempts #192736 and #193670, this PR is
essentially #192736 but with the `(.cfi_jt)` and
`__ubsan_check_cfi_icall_jt`
frames swapped. While the specific order of `__ubsan_check_cfi_icall_jt`
isn't strictly necessary, swapping them helps maintain existing
diagnostics
behavior.
Additionally, the diagnostics must remove `ubsan_interface.h` to allow
for a fallback to printing the module name.
See "Commits" tab for details.
enferex pushed a commit to enferex/llvm-project that referenced this pull request May 5, 2026
[LowerTypeTests] Add debug info to jump table entries (llvm#192736)
    
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
llvm#1: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
```

Following up on previous attempts llvm#192736 and llvm#193670, this PR is
essentially llvm#192736 but with the `(.cfi_jt)` and
`__ubsan_check_cfi_icall_jt`
frames swapped. While the specific order of `__ubsan_check_cfi_icall_jt`
isn't strictly necessary, swapping them helps maintain existing
diagnostics
behavior.
Additionally, the diagnostics must remove `ubsan_interface.h` to allow
for a fallback to printing the module name.
See "Commits" tab for details.
moar55 pushed a commit to moar55/llvm-project that referenced this pull request May 12, 2026
[LowerTypeTests] Add debug info to jump table entries (llvm#192736)
    
When Control Flow Integrity (CFI) is enabled, jump tables are used to
redirect indirect calls. Previously, these jump table entries lacked
debug information, making it difficult for profilers and debuggers to
attribute execution time correctly.

Now stack trace, when stopped on jump table entry will looks like this:
```
#0: c::c() (.cfi_jt) at sanitizer/ubsan_interface.h:0:0
#1: __ubsan_check_cfi_icall_jt at sanitizer/ubsan_interface.h:0
```

Following up on previous attempts llvm#192736 and llvm#193670, this PR is
essentially llvm#192736 but with the `(.cfi_jt)` and
`__ubsan_check_cfi_icall_jt`
frames swapped. While the specific order of `__ubsan_check_cfi_icall_jt`
isn't strictly necessary, swapping them helps maintain existing
diagnostics
behavior.
Additionally, the diagnostics must remove `ubsan_interface.h` to allow
for a fallback to printing the module name.
See "Commits" tab for details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants