* config/rl78/predicates.md (rl78_cmp_operator_signed): New.
[official-gcc.git] / libsanitizer / tsan / tsan_platform_mac.cc
blobb247468c8294bf4e96fd8f9221876dffd82e5d91
1 //===-- tsan_platform_mac.cc ----------------------------------------------===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of ThreadSanitizer (TSan), a race detector.
9 //
10 // Mac-specific code.
11 //===----------------------------------------------------------------------===//
13 #ifdef __APPLE__
15 #include "sanitizer_common/sanitizer_common.h"
16 #include "sanitizer_common/sanitizer_libc.h"
17 #include "sanitizer_common/sanitizer_procmaps.h"
18 #include "tsan_platform.h"
19 #include "tsan_rtl.h"
20 #include "tsan_flags.h"
22 #include <pthread.h>
23 #include <signal.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <stdarg.h>
28 #include <sys/mman.h>
29 #include <sys/syscall.h>
30 #include <sys/time.h>
31 #include <sys/types.h>
32 #include <sys/resource.h>
33 #include <sys/stat.h>
34 #include <unistd.h>
35 #include <errno.h>
36 #include <sched.h>
38 namespace __tsan {
40 ScopedInRtl::ScopedInRtl() {
43 ScopedInRtl::~ScopedInRtl() {
46 uptr GetShadowMemoryConsumption() {
47 return 0;
50 void FlushShadowMemory() {
53 #ifndef TSAN_GO
54 void InitializeShadowMemory() {
55 uptr shadow = (uptr)MmapFixedNoReserve(kLinuxShadowBeg,
56 kLinuxShadowEnd - kLinuxShadowBeg);
57 if (shadow != kLinuxShadowBeg) {
58 Printf("FATAL: ThreadSanitizer can not mmap the shadow memory\n");
59 Printf("FATAL: Make sure to compile with -fPIE and "
60 "to link with -pie.\n");
61 Die();
63 DPrintf("kLinuxShadow %zx-%zx (%zuGB)\n",
64 kLinuxShadowBeg, kLinuxShadowEnd,
65 (kLinuxShadowEnd - kLinuxShadowBeg) >> 30);
66 DPrintf("kLinuxAppMem %zx-%zx (%zuGB)\n",
67 kLinuxAppMemBeg, kLinuxAppMemEnd,
68 (kLinuxAppMemEnd - kLinuxAppMemBeg) >> 30);
70 #endif
72 const char *InitializePlatform() {
73 void *p = 0;
74 if (sizeof(p) == 8) {
75 // Disable core dumps, dumping of 16TB usually takes a bit long.
76 // The following magic is to prevent clang from replacing it with memset.
77 volatile rlimit lim;
78 lim.rlim_cur = 0;
79 lim.rlim_max = 0;
80 setrlimit(RLIMIT_CORE, (rlimit*)&lim);
83 return GetEnv(kTsanOptionsEnv);
86 void FinalizePlatform() {
87 fflush(0);
90 uptr GetTlsSize() {
91 return 0;
94 void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size,
95 uptr *tls_addr, uptr *tls_size) {
96 *stk_addr = 0;
97 *stk_size = 0;
98 *tls_addr = 0;
99 *tls_size = 0;
102 } // namespace __tsan
104 #endif // #ifdef __APPLE__