From 6a45f9ce82b5eb969fd30ec48ded1e8a6e6a183a Mon Sep 17 00:00:00 2001 From: Kostya Kortchinsky Date: Wed, 11 Oct 2017 21:20:04 +0000 Subject: [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 --- .../sanitizer_common/sanitizer_allocator_checks.cc | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc') 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 -- cgit v1.2.3