summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/ubsan/ubsan_init.h
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-07-25 22:24:34 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-07-25 22:24:34 +0000
commit6eb53d6460183b51a2cde13b30031572af65d3fe (patch)
treee324c3a92b6405f0d49bd9bcf6bcd0d1809a0c3f /compiler-rt/lib/ubsan/ubsan_init.h
parentac4b69e40bfebe502c8bee936539b352b0c14fa2 (diff)
downloadbcm5719-llvm-6eb53d6460183b51a2cde13b30031572af65d3fe.tar.gz
bcm5719-llvm-6eb53d6460183b51a2cde13b30031572af65d3fe.zip
[UBSan] Call UBSan initialization as early as possible.
Specifically, use .preinit_array initialization on Linux and dynamic global initializer on another platforms. Historically UBSan didn't have any initialization code and its runtime was stateless. This is no longer the case - UBSan relies on some non-trivial functionality from sanitizer_common (e.g. online symbolization) and is now configurable by runtime flags. Additionally, we've dropped support for enabling UBSan only for a few shared objects, so UBSan is now always linked into the main executable, so now we can use similar initialization as all the rest sanitizers. llvm-svn: 213983
Diffstat (limited to 'compiler-rt/lib/ubsan/ubsan_init.h')
-rw-r--r--compiler-rt/lib/ubsan/ubsan_init.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_init.h b/compiler-rt/lib/ubsan/ubsan_init.h
new file mode 100644
index 00000000000..18356cfca61
--- /dev/null
+++ b/compiler-rt/lib/ubsan/ubsan_init.h
@@ -0,0 +1,24 @@
+//===-- ubsan_init.h --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Initialization function for UBSan runtime.
+//
+//===----------------------------------------------------------------------===//
+#ifndef UBSAN_INIT_H
+#define UBSAN_INIT_H
+
+namespace __ubsan {
+
+// NOTE: This function might take a lock (if .preinit_array initialization is
+// not used). It's generally a bad idea to call it on a fast path.
+void InitIfNecessary();
+
+} // namespace __ubsan
+
+#endif // UBSAN_INIT_H
OpenPOWER on IntegriCloud