summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorserge-sans-paille <sguelton@redhat.com>2021-05-14 11:45:10 +0200
committerTom Stellard <tstellar@redhat.com>2021-06-22 00:43:08 -0400
commit385a6f37fefbeb1397f1c3733f328bb2b0403e2b (patch)
treeba57df67e2bfce35760410ceede1a983669a0069
parentcc08a27d2ecc1458a8871c989add0b49afc24f12 (diff)
Prevent generation of dependency on _cxa_guard for static initialization
This fixes an issue introduced by https://reviews.llvm.org/D70662 Function-scope static initialization are guarded in C++, so we should probably not use it because it introduces a dependency on __cxa_guard* symbols. In the context of clang, libasan is linked statically, and it currently needs to the odd situation where compiling C code with clang and asan requires -lstdc++ Differential Revision: https://reviews.llvm.org/D102475 (cherry picked from commit 414482751452e54710f16bae58458c66298aaf69)
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
index 2b10bdd37293..12603da1750d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
@@ -166,9 +166,10 @@ bool SupportsColoredOutput(fd_t fd) {
#if !SANITIZER_GO
// TODO(glider): different tools may require different altstack size.
static uptr GetAltStackSize() {
- // SIGSTKSZ is not enough.
- static const uptr kAltStackSize = SIGSTKSZ * 4;
- return kAltStackSize;
+ // Note: since GLIBC_2.31, SIGSTKSZ may be a function call, so this may be
+ // more costly that you think. However GetAltStackSize is only call 2-3 times
+ // per thread so don't cache the evaluation.
+ return SIGSTKSZ * 4;
}
void SetAlternateSignalStack() {