From ea2f800bbc37dcde07109a2319f9d1e5ae789651 Mon Sep 17 00:00:00 2001 From: Kostya Kortchinsky Date: Tue, 10 Oct 2017 15:35:11 +0000 Subject: [PATCH] [sanitizer] Revert D38706 Summary: D38706 breaks tsan and the nolibc build. Reverting while working on a fix. Reviewers: alekseyshl Subscribers: kubamracek, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D38739 llvm-svn: 315320 --- .../lib/sanitizer_common/CMakeLists.txt | 1 - .../sanitizer_allocator_checks.cc | 23 ------------------- .../sanitizer_allocator_checks.h | 9 ++------ 3 files changed, 2 insertions(+), 31 deletions(-) delete mode 100644 compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc diff --git a/compiler-rt/lib/sanitizer_common/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/CMakeLists.txt index 749c71a74ca4..e62b24544e53 100644 --- a/compiler-rt/lib/sanitizer_common/CMakeLists.txt +++ b/compiler-rt/lib/sanitizer_common/CMakeLists.txt @@ -3,7 +3,6 @@ set(SANITIZER_SOURCES_NOTERMINATION sanitizer_allocator.cc - sanitizer_allocator_checks.cc sanitizer_common.cc sanitizer_deadlock_detector1.cc sanitizer_deadlock_detector2.cc diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc deleted file mode 100644 index dc263dbef5fc..000000000000 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.cc +++ /dev/null @@ -1,23 +0,0 @@ -//===-- 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 diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.h index b61a8b2eb3b6..b72f541a494c 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.h @@ -15,22 +15,17 @@ #ifndef SANITIZER_ALLOCATOR_CHECKS_H #define SANITIZER_ALLOCATOR_CHECKS_H +#include "sanitizer_errno.h" #include "sanitizer_internal_defs.h" #include "sanitizer_common.h" #include "sanitizer_platform.h" namespace __sanitizer { -// The following is defined in a separate compilation unit to avoid pulling in -// sanitizer_errno.h in this header, which leads to conflicts when other system -// headers include errno.h. This is usually the result of an unlikely event, -// and as such we do not care as much about having it inlined. -void SetErrnoToENOMEM(); - // A common errno setting logic shared by almost all sanitizer allocator APIs. INLINE void *SetErrnoOnNull(void *ptr) { if (UNLIKELY(!ptr)) - SetErrnoToENOMEM(); + errno = errno_ENOMEM; return ptr; }