A set of trivial changes to support sanitizers on FreeBSD.

Patch by Viktor Kutuzov!

llvm-svn: 202801
This commit is contained in:
Alexey Samsonov 2014-03-04 08:55:41 +00:00
parent 29a76ac646
commit a7c602ac29
11 changed files with 20 additions and 20 deletions

View File

@ -36,7 +36,7 @@
# define ASAN_INTERCEPT_MLOCKX 0
#endif
#if SANITIZER_LINUX
#if SANITIZER_FREEBSD || SANITIZER_LINUX
# define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 1
#else
# define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 0

View File

@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_common/sanitizer_platform.h"
#if SANITIZER_LINUX
#if SANITIZER_FREEBSD || SANITIZER_LINUX
#include "sanitizer_common/sanitizer_tls_get_addr.h"
#include "asan_allocator.h"
@ -153,4 +153,4 @@ INTERCEPTOR(void, malloc_stats, void) {
__asan_print_accumulated_stats();
}
#endif // SANITIZER_LINUX
#endif // SANITIZER_FREEBSD || SANITIZER_LINUX

View File

@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_common/sanitizer_platform.h"
#if SANITIZER_LINUX || SANITIZER_MAC
#if SANITIZER_POSIX
#include "asan_internal.h"
#include "asan_interceptors.h"
@ -84,4 +84,4 @@ void PlatformTSDDtor(void *tsd) {
}
} // namespace __asan
#endif // SANITIZER_LINUX || SANITIZER_MAC
#endif // SANITIZER_POSIX

View File

@ -41,7 +41,7 @@
#include <unistd.h>
#endif
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__FreeBSD__)
#include <malloc.h>
#endif

View File

@ -504,7 +504,7 @@ const uptr kPthreadDestructorIterations = 0;
// Callback type for iterating over a set of memory ranges.
typedef void (*RangeIteratorCallback)(uptr begin, uptr end, void *arg);
#if SANITIZER_LINUX && !defined(SANITIZER_GO)
#if (SANITIZER_FREEBSD || SANITIZER_LINUX) && !defined(SANITIZER_GO)
extern uptr indirect_call_wrapper;
void SetIndirectCallWrapper(uptr wrapper);

View File

@ -14,7 +14,7 @@
#define SANITIZER_LINUX_H
#include "sanitizer_platform.h"
#if SANITIZER_LINUX
#if SANITIZER_FREEBSD || SANITIZER_LINUX
#include "sanitizer_common.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_platform_limits_posix.h"
@ -86,5 +86,5 @@ void CacheBinaryName();
void ForEachMappedRegion(link_map *map, void (*cb)(const void *, uptr));
} // namespace __sanitizer
#endif // SANITIZER_LINUX
#endif // SANITIZER_FREEBSD || SANITIZER_LINUX
#endif // SANITIZER_LINUX_H

View File

@ -55,7 +55,7 @@
# define SANITIZER_ANDROID 0
#endif
#define SANITIZER_POSIX (SANITIZER_LINUX || SANITIZER_MAC)
#define SANITIZER_POSIX (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC)
#if __LP64__ || defined(_WIN64)
# define SANITIZER_WORDSIZE 64

View File

@ -546,8 +546,8 @@ namespace __sanitizer {
void (*gl_closedir)(void *dirp);
struct dirent *(*gl_readdir)(void *dirp);
void *(*gl_opendir)(const char*);
int (*gl_lstat)(const char*, struct stat*);
int (*gl_stat)(const char*, struct stat*);
int (*gl_lstat)(const char*, void* /* struct stat* */);
int (*gl_stat)(const char*, void* /* struct stat* */);
};
# endif // SANITIZER_FREEBSD

View File

@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_platform.h"
#if SANITIZER_LINUX || SANITIZER_MAC
#if SANITIZER_POSIX
#include "sanitizer_common.h"
#include "sanitizer_libc.h"
@ -269,4 +269,4 @@ bool GetCodeRangeForFile(const char *module, uptr *start, uptr *end) {
} // namespace __sanitizer
#endif // SANITIZER_LINUX || SANITIZER_MAC
#endif // SANITIZER_POSIX

View File

@ -14,7 +14,7 @@
#include "sanitizer_platform.h"
#if SANITIZER_LINUX || SANITIZER_MAC
#if SANITIZER_POSIX
#include "sanitizer_common.h"
#include "sanitizer_flags.h"
#include "sanitizer_platform_limits_posix.h"
@ -54,7 +54,7 @@ void DisableCoreDumper() {
bool StackSizeIsUnlimited() {
struct rlimit rlim;
CHECK_EQ(0, getrlimit(RLIMIT_STACK, &rlim));
return (rlim.rlim_cur == (uptr)-1);
return ((uptr)rlim.rlim_cur == (uptr)-1);
}
void SetStackSizeLimitInBytes(uptr limit) {
@ -106,7 +106,7 @@ void SetAlternateSignalStack() {
// future. It is not required by man 2 sigaltstack now (they're using
// malloc()).
void* base = MmapOrDie(kAltStackSize, __func__);
altstack.ss_sp = base;
altstack.ss_sp = (char*) base;
altstack.ss_flags = 0;
altstack.ss_size = kAltStackSize;
CHECK_EQ(0, sigaltstack(&altstack, 0));
@ -147,4 +147,4 @@ void InstallDeadlySignalHandlers(SignalHandlerType handler) {
} // namespace __sanitizer
#endif
#endif // SANITIZER_POSIX

View File

@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_platform.h"
#if SANITIZER_LINUX
#if SANITIZER_FREEBSD || SANITIZER_LINUX
#include "sanitizer_common.h"
#include "sanitizer_placement_new.h"
#include "sanitizer_procmaps.h"
@ -252,4 +252,4 @@ void GetMemoryProfile(fill_profile_f cb, uptr *stats, uptr stats_size) {
} // namespace __sanitizer
#endif // SANITIZER_LINUX
#endif // SANITIZER_FREEBSD || SANITIZER_LINUX