summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/asan/asan_allocator.cc4
-rw-r--r--compiler-rt/lib/asan/asan_internal.h2
-rw-r--r--compiler-rt/lib/asan/asan_linux.cc6
-rw-r--r--compiler-rt/lib/asan/asan_mac.cc8
-rw-r--r--compiler-rt/lib/asan/asan_rtl.cc9
5 files changed, 17 insertions, 12 deletions
diff --git a/compiler-rt/lib/asan/asan_allocator.cc b/compiler-rt/lib/asan/asan_allocator.cc
index f86dc0b0205..e2057dced8c 100644
--- a/compiler-rt/lib/asan/asan_allocator.cc
+++ b/compiler-rt/lib/asan/asan_allocator.cc
@@ -35,10 +35,6 @@
#include "asan_thread.h"
#include "asan_thread_registry.h"
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-
namespace __asan {
#define REDZONE FLAG_redzone
diff --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h
index 4207c003e63..1f078fa28ae 100644
--- a/compiler-rt/lib/asan/asan_internal.h
+++ b/compiler-rt/lib/asan/asan_internal.h
@@ -99,6 +99,8 @@ void *AsanMprotect(uintptr_t fixed_addr, size_t size);
void *AsanMmapSomewhereOrDie(size_t size, const char *where);
void AsanUnmapOrDie(void *ptr, size_t size);
+void AsanDisableCoreDumper();
+
ssize_t AsanRead(int fd, void *buf, size_t count);
ssize_t AsanWrite(int fd, const void *buf, size_t count);
int AsanClose(int fd);
diff --git a/compiler-rt/lib/asan/asan_linux.cc b/compiler-rt/lib/asan/asan_linux.cc
index cb50be9c517..bd92617cba2 100644
--- a/compiler-rt/lib/asan/asan_linux.cc
+++ b/compiler-rt/lib/asan/asan_linux.cc
@@ -244,6 +244,12 @@ void AsanThread::SetThreadStackTopAndBottom() {
CHECK(AddrIsInStack((uintptr_t)&attr));
}
+void AsanDisableCoreDumper() {
+ struct rlimit nocore;
+ nocore.rlim_cur = 0;
+ nocore.rlim_max = 0;
+ setrlimit(RLIMIT_CORE, &nocore);
+}
} // namespace __asan
diff --git a/compiler-rt/lib/asan/asan_mac.cc b/compiler-rt/lib/asan/asan_mac.cc
index 8bedf7aaae2..6d73309c6f6 100644
--- a/compiler-rt/lib/asan/asan_mac.cc
+++ b/compiler-rt/lib/asan/asan_mac.cc
@@ -22,6 +22,7 @@
#include "asan_thread_registry.h"
#include <sys/mman.h>
+#include <sys/resource.h>
#include <pthread.h>
#include <fcntl.h>
#include <unistd.h>
@@ -113,6 +114,13 @@ void AsanThread::SetThreadStackTopAndBottom() {
CHECK(AddrIsInStack((uintptr_t)&local));
}
+void AsanDisableCoreDumper() {
+ struct rlimit nocore;
+ nocore.rlim_cur = 0;
+ nocore.rlim_max = 0;
+ setrlimit(RLIMIT_CORE, &nocore);
+}
+
// Support for the following functions from libdispatch on Mac OS:
// dispatch_async_f()
// dispatch_async()
diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc
index 583a971850e..efd044c502c 100644
--- a/compiler-rt/lib/asan/asan_rtl.cc
+++ b/compiler-rt/lib/asan/asan_rtl.cc
@@ -26,7 +26,6 @@
#include <new>
#include <dlfcn.h>
-#include <execinfo.h>
#include <fcntl.h>
#include <pthread.h>
#include <signal.h>
@@ -40,9 +39,6 @@
#ifndef ANDROID
#include <sys/ucontext.h>
#endif
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <unistd.h>
// must not include <setjmp.h> on Linux
namespace __asan {
@@ -775,10 +771,7 @@ void __asan_init() {
if (__WORDSIZE == 64) {
// Disable core dumper -- it makes little sense to dump 16T+ core.
- struct rlimit nocore;
- nocore.rlim_cur = 0;
- nocore.rlim_max = 0;
- setrlimit(RLIMIT_CORE, &nocore);
+ AsanDisableCoreDumper();
}
{
OpenPOWER on IntegriCloud