summaryrefslogtreecommitdiff
path: root/lib/ubsan
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2017-09-18 22:43:28 +0000
committerVitaly Buka <vitalybuka@google.com>2017-09-18 22:43:28 +0000
commit084609f437ce6bc03d716b612f441d9bc7aff1bf (patch)
tree585c4ff6b8205dfa9252f6840f60bd6480c12149 /lib/ubsan
parent7055da967bd6e8d188d6821bc1ab63bebfb363de (diff)
[ubsan] Add file missing from r313583
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan')
-rw-r--r--lib/ubsan/ubsan_init_standalone_preinit.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/ubsan/ubsan_init_standalone_preinit.cc b/lib/ubsan/ubsan_init_standalone_preinit.cc
new file mode 100644
index 000000000..229ecc5c8
--- /dev/null
+++ b/lib/ubsan/ubsan_init_standalone_preinit.cc
@@ -0,0 +1,26 @@
+//===-- ubsan_init_standalone_preinit.cc
+//------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Initialization of standalone UBSan runtime.
+//
+//===----------------------------------------------------------------------===//
+
+#include "ubsan_platform.h"
+#if !CAN_SANITIZE_UB
+#error "UBSan is not supported on this platform!"
+#endif
+
+#include "sanitizer_common/sanitizer_internal_defs.h"
+#include "ubsan_init.h"
+
+#if SANITIZER_CAN_USE_PREINIT_ARRAY
+__attribute__((section(".preinit_array"), used)) void (*__local_ubsan_preinit)(
+ void) = __ubsan::InitAsStandalone;
+#endif // SANITIZER_CAN_USE_PREINIT_ARRAY