[compiler-rt] [compiler-rt][asan] Allow optional leading dot in function names in complete_stack_trace.c (PR #227967)
Riyaz Ahmad via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 23:06:07 PDT 2026
https://github.com/riyaz86a created https://github.com/llvm/llvm-project/pull/227967
On AIX/XCOFF, the symbolizer reports function names with a leading dot ('.') because each function's executable code is stored in a separate '.<funcname>' csect (the text-section entry point symbol). For example, 'read_2' is reported as '.read_2'.
The existing CHECK patterns required an exact match on the bare name, causing the test to fail on AIX:
expected: {{ *#1 0x.* in read_2 .*complete_stack_trace.c}}
actual: #1 0x... in .read_2 complete_stack_trace.c:23
Use '\.?' inside the FileCheck regex blocks to make the leading dot optional, matching both ELF (bare name) and XCOFF (dot-prefixed name) symbolizer output.
>From f11e9f203ed533446f2917dbd5bb9c02523e24d9 Mon Sep 17 00:00:00 2001
From: Riyaz Ahmad <riyaz.ahmad at ibm.com>
Date: Thu, 1 Oct 2026 02:02:14 -0400
Subject: [PATCH] [compiler-rt][asan] Allow optional leading dot in function
names in complete_stack_trace.c
On AIX/XCOFF, the symbolizer reports function names with a leading dot
('.') because each function's executable code is stored in a
separate '.<funcname>' csect (the text-section entry point symbol).
For example, 'read_2' is reported as '.read_2'.
The existing CHECK patterns required an exact match on the bare name,
causing the test to fail on AIX:
expected: {{ *#1 0x.* in read_2 .*complete_stack_trace.c}}
actual: #1 0x... in .read_2 complete_stack_trace.c:23
Use '\.?' inside the FileCheck regex blocks to make the leading dot
optional, matching both ELF (bare name) and XCOFF (dot-prefixed name)
symbolizer output.
---
.../asan/TestCases/complete_stack_trace.c | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/compiler-rt/test/asan/TestCases/complete_stack_trace.c b/compiler-rt/test/asan/TestCases/complete_stack_trace.c
index 778f39a4d65ae..91d7ed380b1a1 100644
--- a/compiler-rt/test/asan/TestCases/complete_stack_trace.c
+++ b/compiler-rt/test/asan/TestCases/complete_stack_trace.c
@@ -35,19 +35,19 @@ int main() {
// CHECK: ERROR: AddressSanitizer: heap-use-after-free on address
// CHECK: READ of size 1 at 0x{{.*}} thread T0
-// CHECK-NEXT: {{ *#0 0x.* in read_3 .*complete_stack_trace.c}}
-// CHECK-NEXT: {{ *#1 0x.* in read_2 .*complete_stack_trace.c}}
-// CHECK-NEXT: {{ *#2 0x.* in read_1 .*complete_stack_trace.c}}
-// CHECK-NEXT: {{ *#3 0x.* in main .*complete_stack_trace.c:}}[[@LINE-12]]
+// CHECK-NEXT: {{ *#0 0x.* in \.?read_3 .*complete_stack_trace.c}}
+// CHECK-NEXT: {{ *#1 0x.* in \.?read_2 .*complete_stack_trace.c}}
+// CHECK-NEXT: {{ *#2 0x.* in \.?read_1 .*complete_stack_trace.c}}
+// CHECK-NEXT: {{ *#3 0x.* in \.?main .*complete_stack_trace.c:}}[[@LINE-12]]
// CHECK: freed by thread T0 here:
-// CHECK: {{ *#[0-9]+ 0x.* in free_3 .*complete_stack_trace.c}}
-// CHECK-NEXT: {{ *#[0-9]+ 0x.* in free_2 .*complete_stack_trace.c}}
-// CHECK-NEXT: {{ *#[0-9]+ 0x.* in free_1 .*complete_stack_trace.c}}
-// CHECK-NEXT: {{ *#[0-9]+ 0x.* in main .*complete_stack_trace.c:}}[[@LINE-19]]
+// CHECK: {{ *#[0-9]+ 0x.* in \.?free_3 .*complete_stack_trace.c}}
+// CHECK-NEXT: {{ *#[0-9]+ 0x.* in \.?free_2 .*complete_stack_trace.c}}
+// CHECK-NEXT: {{ *#[0-9]+ 0x.* in \.?free_1 .*complete_stack_trace.c}}
+// CHECK-NEXT: {{ *#[0-9]+ 0x.* in \.?main .*complete_stack_trace.c:}}[[@LINE-19]]
// CHECK: previously allocated by thread T0 here:
-// CHECK: {{ *#[0-9]+ 0x.* in alloc_3 .*complete_stack_trace.c}}
-// CHECK-NEXT: {{ *#[0-9]+ 0x.* in alloc_2 .*complete_stack_trace.c}}
-// CHECK-NEXT: {{ *#[0-9]+ 0x.* in alloc_1 .*complete_stack_trace.c}}
-// CHECK-NEXT: {{ *#[0-9]+ 0x.* in main .*complete_stack_trace.c:}}[[@LINE-26]]
+// CHECK: {{ *#[0-9]+ 0x.* in \.?alloc_3 .*complete_stack_trace.c}}
+// CHECK-NEXT: {{ *#[0-9]+ 0x.* in \.?alloc_2 .*complete_stack_trace.c}}
+// CHECK-NEXT: {{ *#[0-9]+ 0x.* in \.?alloc_1 .*complete_stack_trace.c}}
+// CHECK-NEXT: {{ *#[0-9]+ 0x.* in \.?main .*complete_stack_trace.c:}}[[@LINE-26]]
More information about the llvm-commits
mailing list