[GWP-ASan] Stub out backtrace/signal functions on Fuchsia
authorKostya Kortchinsky <kostyak@google.com>
Sat, 31 Oct 2020 18:09:29 +0000 (11:09 -0700)
committerKostya Kortchinsky <kostyak@google.com>
Mon, 2 Nov 2020 21:49:50 +0000 (13:49 -0800)
The initial version of GWP-ASan on Fuchsia doesn't support crash and
signal handlers, so this just adds empty stubs to be able to compile
the project on the platform.

Differential Revision: https://reviews.llvm.org/D90537

compiler-rt/lib/gwp_asan/optional/backtrace_fuchsia.cpp [new file with mode: 0644]
compiler-rt/lib/gwp_asan/optional/segv_handler_fuchsia.cpp [new file with mode: 0644]

diff --git a/compiler-rt/lib/gwp_asan/optional/backtrace_fuchsia.cpp b/compiler-rt/lib/gwp_asan/optional/backtrace_fuchsia.cpp
new file mode 100644 (file)
index 0000000..ac7ed6c
--- /dev/null
@@ -0,0 +1,22 @@
+//===-- backtrace_fuchsia.cpp -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gwp_asan/optional/backtrace.h"
+
+// GWP-ASan on Fuchsia doesn't currently support backtraces.
+
+namespace gwp_asan {
+namespace options {
+Backtrace_t getBacktraceFunction() { return nullptr; }
+crash_handler::PrintBacktrace_t getPrintBacktraceFunction() { return nullptr; }
+} // namespace options
+
+namespace crash_handler {
+SegvBacktrace_t getSegvBacktraceFunction() { return nullptr; }
+} // namespace crash_handler
+} // namespace gwp_asan
diff --git a/compiler-rt/lib/gwp_asan/optional/segv_handler_fuchsia.cpp b/compiler-rt/lib/gwp_asan/optional/segv_handler_fuchsia.cpp
new file mode 100644 (file)
index 0000000..ec26afa
--- /dev/null
@@ -0,0 +1,22 @@
+//===-- segv_handler_fuchsia.cpp --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gwp_asan/optional/segv_handler.h"
+
+// GWP-ASan on Fuchsia doesn't currently support signal handlers.
+
+namespace gwp_asan {
+namespace crash_handler {
+void installSignalHandlers(gwp_asan::GuardedPoolAllocator * /* GPA */,
+                           Printf_t /* Printf */,
+                           PrintBacktrace_t /* PrintBacktrace */,
+                           SegvBacktrace_t /* SegvBacktrace */) {}
+
+void uninstallSignalHandlers() {}
+} // namespace crash_handler
+} // namespace gwp_asan