[compiler-rt] r355113 - [NFC][Sanitizer] Weak linkage is not available on Windows
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 28 10:42:14 PST 2019
Author: yln
Date: Thu Feb 28 10:42:14 2019
New Revision: 355113
URL: http://llvm.org/viewvc/llvm-project?rev=355113&view=rev
Log:
[NFC][Sanitizer] Weak linkage is not available on Windows
The concept of weak linkage is not available on Windows. The available
workarounds in LLVM/sanitizer runtimes have their own problems. Define a
separte symbol ubsan_GetStackTrace to work around the issue now. At lest
this way it is painfully obvious that we still have to do more cleanup.
Follow-up to revision: https://reviews.llvm.org/D58651
Modified:
compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc
Modified: compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_diag.cc?rev=355113&r1=355112&r2=355113&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_diag.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag.cc Thu Feb 28 10:42:14 2019
@@ -26,11 +26,14 @@
using namespace __ubsan;
-// Weak linkage: UBSan is combined with runtimes that already provide this
-// functionality (e.g., ASan) as well as runtimes that lack it (e.g., scudo).
-SANITIZER_WEAK_CXX_DEFAULT_IMPL
-void __sanitizer::GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
- uptr pc, uptr bp, void *context, bool fast) {
+// UBSan is combined with runtimes that already provide this functionality
+// (e.g., ASan) as well as runtimes that lack it (e.g., scudo). Tried to use
+// weak linkage to resolve this issue which is not portable and breaks on
+// Windows.
+// TODO(yln): This is a temporary workaround. GetStackTrace functions will be
+// removed in the future.
+void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
+ uptr pc, uptr bp, void *context, bool fast) {
uptr top = 0;
uptr bottom = 0;
if (StackTrace::WillUseFastUnwind(fast)) {
@@ -47,7 +50,7 @@ static void MaybePrintStackTrace(uptr pc
return;
BufferedStackTrace stack;
- GetStackTrace(&stack, kStackTraceMax, pc, bp, nullptr,
+ ubsan_GetStackTrace(&stack, kStackTraceMax, pc, bp, nullptr,
common_flags()->fast_unwind_on_fatal);
stack.Print();
}
Modified: compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc?rev=355113&r1=355112&r2=355113&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_signals_standalone.cc Thu Feb 28 10:42:14 2019
@@ -38,11 +38,15 @@ void InitializeDeadlySignals() {}
#define COMMON_INTERCEPT_FUNCTION(name) INTERCEPT_FUNCTION(name)
#include "sanitizer_common/sanitizer_signal_interceptors.inc"
+// TODO(yln): Temporary workaround. Will be removed.
+void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
+ uptr pc, uptr bp, void *context, bool fast);
+
namespace __ubsan {
static void OnStackUnwind(const SignalContext &sig, const void *,
BufferedStackTrace *stack) {
- GetStackTrace(stack, kStackTraceMax, sig.pc, sig.bp, sig.context,
+ ubsan_GetStackTrace(stack, kStackTraceMax, sig.pc, sig.bp, sig.context,
common_flags()->fast_unwind_on_fatal);
}
More information about the llvm-commits
mailing list