summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/lsan/lsan_preinit.cc
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2013-11-25 14:30:37 +0000
committerSergey Matveev <earthdok@google.com>2013-11-25 14:30:37 +0000
commit6b0f6af37403bef3f5ca658340b0ba96f54694e7 (patch)
treedcf4464beceb717ffe6247bc63b40791343744e5 /compiler-rt/lib/lsan/lsan_preinit.cc
parent2d3f8d7840de016c082d601a7e704b7c196119f0 (diff)
downloadbcm5719-llvm-6b0f6af37403bef3f5ca658340b0ba96f54694e7.tar.gz
bcm5719-llvm-6b0f6af37403bef3f5ca658340b0ba96f54694e7.zip
[lsan] Add a missing file.
llvm-svn: 195643
Diffstat (limited to 'compiler-rt/lib/lsan/lsan_preinit.cc')
-rw-r--r--compiler-rt/lib/lsan/lsan_preinit.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler-rt/lib/lsan/lsan_preinit.cc b/compiler-rt/lib/lsan/lsan_preinit.cc
new file mode 100644
index 00000000000..a631f9a3e68
--- /dev/null
+++ b/compiler-rt/lib/lsan/lsan_preinit.cc
@@ -0,0 +1,22 @@
+//===-- lsan_preinit.cc ---------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of LeakSanitizer.
+//
+// Call __lsan_init at the very early stage of process startup.
+//===----------------------------------------------------------------------===//
+
+#include "lsan.h"
+
+#if !defined(PIC)
+ // We force __lsan_init to be called before anyone else by placing it into
+ // .preinit_array section.
+ __attribute__((section(".preinit_array"), used))
+ void (*__local_lsan_preinit)(void) = __lsan_init;
+#endif
OpenPOWER on IntegriCloud