aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2013-11-25 17:39:55 +0000
committerSergey Matveev <earthdok@google.com>2013-11-25 17:39:55 +0000
commitcf2469dc14ad84374d59f286a41cc1c9b190c0e4 (patch)
treefe5bd1eada67d3fdc341b73a0d21f767c5a21040
parent74c88796a4024922144660ed1ade519af5008fe2 (diff)
downloadcompiler-rt-cf2469dc14ad84374d59f286a41cc1c9b190c0e4.tar.gz
Merging r195643:
------------------------------------------------------------------------ r195643 | smatveev | 2013-11-25 18:30:37 +0400 (Mon, 25 Nov 2013) | 1 line [lsan] Add a missing file. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_34@195667 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/lsan/lsan_preinit.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/lsan/lsan_preinit.cc b/lib/lsan/lsan_preinit.cc
new file mode 100644
index 000000000..a631f9a3e
--- /dev/null
+++ b/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