diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp @@ -68,8 +68,10 @@ } else if (last && 0 == internal_strcmp(last, "__tsan_thread_start_func")) { last_frame->ClearAll(); last_frame2->next = nullptr; - // Strip global ctors init. - } else if (last && 0 == internal_strcmp(last, "__do_global_ctors_aux")) { + // Strip global ctors init, .preinit_array and main caller. + } else if (last && (0 == internal_strcmp(last, "__do_global_ctors_aux") || + 0 == internal_strcmp(last, "__libc_csu_init") || + 0 == internal_strcmp(last, "__libc_start_main"))) { last_frame->ClearAll(); last_frame2->next = nullptr; // If both are 0, then we probably just failed to symbolize. diff --git a/compiler-rt/test/tsan/java_symbolization.cpp b/compiler-rt/test/tsan/java_symbolization.cpp --- a/compiler-rt/test/tsan/java_symbolization.cpp +++ b/compiler-rt/test/tsan/java_symbolization.cpp @@ -62,11 +62,9 @@ // CHECK: #1 MyOuterFunc MyOuterFile.java:4321:65 // CHECK: #2 Caller1 CallerFile.java:111:22 // CHECK: #3 Caller2 CallerFile.java:333:44 -// On Linux/glibc #4 is __libc_start_main, but can be something else elsewhere. -// CHECK: #4 +// CHECK-NOT: #4 // CHECK: Location is heap block of size 32 at {{.*}} allocated by main thread: // CHECK: #0 Allocer1 Alloc.java:11:222 // CHECK: #1 Allocer2 Alloc.java:33:444 -// On Linux/glibc #2 is __libc_start_main, but can be something else elsewhere. -// CHECK: #2 +// CHECK-NOT: #2 // CHECK: DONE