[compiler-rt] r346155 - [Sanitizers] Disable SANITIZER_CAN_FAST_UNWIND on all SPARC targets
Rainer Orth via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 5 11:22:55 PST 2018
Author: ro
Date: Mon Nov 5 11:22:54 2018
New Revision: 346155
URL: http://llvm.org/viewvc/llvm-project?rev=346155&view=rev
Log:
[Sanitizers] Disable SANITIZER_CAN_FAST_UNWIND on all SPARC targets
While testing my to-be-submitted Solaris sanitizer support on gcc mainline, I ran into
an issue on Solaris/SPARC (sparc-sun-solaris2.11). Initially libasan.so failed to link:
Undefined first referenced
symbol in file
__sanitizer::BufferedStackTrace::FastUnwindStack(unsigned long, unsigned long, unsigned long, unsigned long, unsigned int) /var/gcc/gcc-9.0.0-20181024/11.5-gcc-gas/sparc-sun-solaris2.11/./libsanitizer/asan/.libs/libasan.so
This happens because SANITIZER_CAN_FAST_UNWIND is enabled on non-Linux
SPARC targets (cf. sanitizer_stacktrace.h), but the guard around the SPARCv8-only
definition in sanitizer_stacktrace_sparc.cc only works with clang:
clang predefines __sparcv8__ on non-Solaris, and __sparcv8 only on Solaris
gcc predefines __sparcv8 on Solaris, but __sparc_v8__ on non-Solaris
The attached patch allows for all three variants.
However, disabling SANITIZER_CAN_FAST_UNWIND on all SPARC targets
fixes a couple of testsuite failures in the Solaris asan testsuite, so for now it's better
to keep it disabled everywhere.
This allowed the libsanitizer build to complete and gave reasonable (though slightly
worse than on Solaris/x86) testsuite results.
Differential Revision: https://reviews.llvm.org/D54099
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_sparc.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h?rev=346155&r1=346154&r2=346155&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h Mon Nov 5 11:22:54 2018
@@ -19,7 +19,7 @@ namespace __sanitizer {
static const u32 kStackTraceMax = 256;
-#if SANITIZER_LINUX && (defined(__sparc__) || defined(__mips__))
+#if defined(__sparc__) || (SANITIZER_LINUX && defined(__mips__))
# define SANITIZER_CAN_FAST_UNWIND 0
#elif SANITIZER_WINDOWS
# define SANITIZER_CAN_FAST_UNWIND 0
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_sparc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_sparc.cc?rev=346155&r1=346154&r2=346155&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_sparc.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_sparc.cc Mon Nov 5 11:22:54 2018
@@ -15,7 +15,7 @@
// This file is ported to Sparc v8, but it should be easy to port to
// Sparc v9.
-#if defined(__sparcv8__)
+#if defined(__sparcv8__) || defined(__sparcv8) || defined(__sparc_v8__)
#include "sanitizer_common.h"
#include "sanitizer_stacktrace.h"
@@ -55,4 +55,5 @@ void BufferedStackTrace::FastUnwindStack
} // namespace __sanitizer
-#endif // !defined(__sparcv8__)
+#endif // !defined(__sparcv8__) && !defined(__sparcv8) &&
+ // !defined(__sparc_v8__)
More information about the llvm-commits
mailing list