summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2017-10-11 21:20:04 +0000
committerKostya Kortchinsky <kostyak@google.com>2017-10-11 21:20:04 +0000
commit6a45f9ce82b5eb969fd30ec48ded1e8a6e6a183a (patch)
treec8890830266033a9c49e4bb7b9cb70a4f617f871 /compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc
parentc928e1f5958a3bd748337cfd95d334202a0a9557 (diff)
downloadbcm5719-llvm-6a45f9ce82b5eb969fd30ec48ded1e8a6e6a183a.tar.gz
bcm5719-llvm-6a45f9ce82b5eb969fd30ec48ded1e8a6e6a183a.zip
[sanitizer] Move the errno/ENOMEM allocator checks logic to separate .cc
Summary: This is a new attempt at D38706, which had 2 issues. The first one was that it broke TSan, because `sanitizer_errno.h` was not directly included in `tsan_mman.cc`. This fixes the include. The second one was that it broke the nolibc build, because `__errno_location` couldn't be found. This adds the new .cc to the libcdep list instead of the base one. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D38743 llvm-svn: 315509
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc
new file mode 100644
index 00000000000..dc263dbef5f
--- /dev/null
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc
@@ -0,0 +1,23 @@
+//===-- sanitizer_allocator_checks.cc ---------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Various checks shared between ThreadSanitizer, MemorySanitizer, etc. memory
+// allocators.
+//
+//===----------------------------------------------------------------------===//
+
+#include "sanitizer_errno.h"
+
+namespace __sanitizer {
+
+void SetErrnoToENOMEM() {
+ errno = errno_ENOMEM;
+}
+
+} // namespace __sanitizer
OpenPOWER on IntegriCloud