[compiler-rt] 4144827 - Prevent generation of dependency on _cxa_guard for static initialization
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 9 00:40:39 PDT 2021
Author: serge-sans-paille
Date: 2021-06-09T09:38:59+02:00
New Revision: 414482751452e54710f16bae58458c66298aaf69
URL: https://github.com/llvm/llvm-project/commit/414482751452e54710f16bae58458c66298aaf69
DIFF: https://github.com/llvm/llvm-project/commit/414482751452e54710f16bae58458c66298aaf69.diff
LOG: 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
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
index d1d8e509c4dba..12137a1aaa4df 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):
diff erent tools may require
diff erent 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() {
More information about the llvm-commits
mailing list