Skip to content

Commit 385a6f3

Browse files
serge-sans-pailletstellar
authored andcommitted
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 4144827)
1 parent cc08a27 commit 385a6f3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ bool SupportsColoredOutput(fd_t fd) {
166166
#if !SANITIZER_GO
167167
// TODO(glider): different tools may require different altstack size.
168168
static uptr GetAltStackSize() {
169-
// SIGSTKSZ is not enough.
170-
static const uptr kAltStackSize = SIGSTKSZ * 4;
171-
return kAltStackSize;
169+
// Note: since GLIBC_2.31, SIGSTKSZ may be a function call, so this may be
170+
// more costly that you think. However GetAltStackSize is only call 2-3 times
171+
// per thread so don't cache the evaluation.
172+
return SIGSTKSZ * 4;
172173
}
173174

174175
void SetAlternateSignalStack() {

0 commit comments

Comments
 (0)