Blame SOURCES/gcc11-tsan-sigstksz.patch

b9880e
From 91f8a7a34cf29ae7c465603a801326767f1cc7e9 Mon Sep 17 00:00:00 2001
b9880e
From: Martin Liska <mliska@suse.cz>
b9880e
Date: Thu, 5 Aug 2021 10:43:17 +0200
b9880e
Subject: [PATCH] sanitizer: cherry pick
b9880e
 414482751452e54710f16bae58458c66298aaf69
b9880e
b9880e
The patch is needed in order to support recent glibc (2.34).
b9880e
b9880e
libsanitizer/ChangeLog:
b9880e
b9880e
	PR sanitizer/101749
b9880e
	* sanitizer_common/sanitizer_posix_libcdep.cpp: Prevent
b9880e
	generation of dependency on _cxa_guard for static
b9880e
	initialization.
b9880e
---
b9880e
 libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp | 7 ++++---
b9880e
 1 file changed, 4 insertions(+), 3 deletions(-)
b9880e
b9880e
diff --git a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp
b9880e
index 7ff48c35851..a65b16f5290 100644
b9880e
--- a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp
b9880e
+++ b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp
b9880e
@@ -166,9 +166,10 @@ bool SupportsColoredOutput(fd_t fd) {
b9880e
 #if !SANITIZER_GO
b9880e
 // TODO(glider): different tools may require different altstack size.
b9880e
 static uptr GetAltStackSize() {
b9880e
-  // SIGSTKSZ is not enough.
b9880e
-  static const uptr kAltStackSize = SIGSTKSZ * 4;
b9880e
-  return kAltStackSize;
b9880e
+  // Note: since GLIBC_2.31, SIGSTKSZ may be a function call, so this may be
b9880e
+  // more costly that you think. However GetAltStackSize is only call 2-3 times
b9880e
+  // per thread so don't cache the evaluation.
b9880e
+  return SIGSTKSZ * 4;
b9880e
 }
b9880e
 
b9880e
 void SetAlternateSignalStack() {
b9880e
-- 
b9880e
2.27.0