http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55488
Bug #: 55488 Summary: Implement cold calls in tsan run-time Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer AssignedTo: unassig...@gcc.gnu.org ReportedBy: konstantin.s.serebry...@gmail.com CC: do...@gcc.gnu.org, dvyu...@gcc.gnu.org, ja...@gcc.gnu.org, k...@gcc.gnu.org, w...@gcc.gnu.org The hottest functions in tsan run-time make two cold calls: __tsan_report_race and __tsan_trace_switch If these calls are implemented via regular calling convention, they ruin the performance since the compiler creates too many spills. So, we've manually implemented a cold-call calling convention using a separate assembly file, libsanitizer/tsan/tsan_rtl_amd64.S Currently, this hack is disabled in GCC causing the tsan run-time to be slower than it could be: libsanitizer/tsan/tsan_rtl.h: #if 0 && TSAN_DEBUG == 0 ... #define HACKY_CALL(f) \ We need to enable building/linking the file libsanitizer/tsan/tsan_rtl_amd64.S and enable the HACKY_CALL in libsanitizer/tsan/tsan_rtl.h. This will eliminate the only difference left between the gcc version and upstream. Or maybe gcc has another way to implement a cold call?