forked from OSchip/llvm-project
OpenBSD UBsan support enabling SANITIZER_OPENBSD widely
Summary: Adding OpenBSD platform Patch by: David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: srhines, kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44049 llvm-svn: 326651
This commit is contained in:
parent
c18102fed5
commit
310cd2509c
|
@ -24,7 +24,7 @@
|
|||
|
||||
#if SANITIZER_FREEBSD || SANITIZER_MAC
|
||||
# define __errno_location __error
|
||||
#elif SANITIZER_ANDROID || SANITIZER_NETBSD
|
||||
#elif SANITIZER_ANDROID || SANITIZER_NETBSD || SANITIZER_OPENBSD
|
||||
# define __errno_location __errno
|
||||
#elif SANITIZER_SOLARIS
|
||||
# define __errno_location ___errno
|
||||
|
|
|
@ -39,7 +39,8 @@
|
|||
#endif
|
||||
|
||||
// TLS is handled differently on different platforms
|
||||
#if SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_FREEBSD
|
||||
#if SANITIZER_LINUX || SANITIZER_NETBSD || \
|
||||
SANITIZER_FREEBSD || SANITIZER_OPENBSD
|
||||
# define SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE \
|
||||
__attribute__((tls_model("initial-exec"))) thread_local
|
||||
#else
|
||||
|
@ -100,7 +101,7 @@
|
|||
// FIXME: do we have anything like this on Mac?
|
||||
#ifndef SANITIZER_CAN_USE_PREINIT_ARRAY
|
||||
#if ((SANITIZER_LINUX && !SANITIZER_ANDROID) || \
|
||||
SANITIZER_FREEBSD) && !defined(PIC)
|
||||
SANITIZER_FREEBSD || SANITIZER_OPENBSD) && !defined(PIC)
|
||||
# define SANITIZER_CAN_USE_PREINIT_ARRAY 1
|
||||
// Before Solaris 11.4, .preinit_array is fully supported only with GNU ld.
|
||||
// FIXME: Check for those conditions.
|
||||
|
@ -159,7 +160,8 @@ typedef long pid_t;
|
|||
typedef int pid_t;
|
||||
#endif
|
||||
|
||||
#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_MAC || \
|
||||
#if SANITIZER_FREEBSD || SANITIZER_NETBSD || \
|
||||
SANITIZER_OPENBSD || SANITIZER_MAC || \
|
||||
(SANITIZER_LINUX && defined(__x86_64__))
|
||||
typedef u64 OFF_T;
|
||||
#else
|
||||
|
@ -170,7 +172,7 @@ typedef u64 OFF64_T;
|
|||
#if (SANITIZER_WORDSIZE == 64) || SANITIZER_MAC
|
||||
typedef uptr operator_new_size_type;
|
||||
#else
|
||||
# if defined(__s390__) && !defined(__s390x__)
|
||||
# if defined(SANITIZER_OPENBSD) || defined(__s390__) && !defined(__s390x__)
|
||||
// Special case: 31-bit s390 has unsigned long as size_t.
|
||||
typedef unsigned long operator_new_size_type;
|
||||
# else
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
|
||||
#include "sanitizer_platform.h"
|
||||
|
||||
#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC || SANITIZER_NETBSD
|
||||
#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC || \
|
||||
SANITIZER_NETBSD || SANITIZER_OPENBSD
|
||||
|
||||
#include "sanitizer_libignore.h"
|
||||
#include "sanitizer_flags.h"
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#define SANITIZER_PLATFORM_H
|
||||
|
||||
#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
|
||||
!defined(__APPLE__) && !defined(_WIN32) && !defined(__Fuchsia__) && \
|
||||
!(defined(__sun__) && defined(__svr4__))
|
||||
!defined(__OpenBSD__) && !defined(__APPLE__) && !defined(_WIN32) && \
|
||||
!defined(__Fuchsia__) && !(defined(__sun__) && defined(__srv4__))
|
||||
# error "This operating system is not supported"
|
||||
#endif
|
||||
|
||||
|
@ -37,6 +37,12 @@
|
|||
# define SANITIZER_NETBSD 0
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
# define SANITIZER_OPENBSD 1
|
||||
#else
|
||||
# define SANITIZER_OPENBSD 0
|
||||
#endif
|
||||
|
||||
#if defined(__sun__) && defined(__svr4__)
|
||||
# define SANITIZER_SOLARIS 1
|
||||
#else
|
||||
|
@ -100,7 +106,7 @@
|
|||
|
||||
#define SANITIZER_POSIX \
|
||||
(SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC || \
|
||||
SANITIZER_NETBSD || SANITIZER_SOLARIS)
|
||||
SANITIZER_NETBSD || SANITIZER_OPENBSD || SANITIZER_SOLARIS)
|
||||
|
||||
#if __LP64__ || defined(_WIN64)
|
||||
# define SANITIZER_WORDSIZE 64
|
||||
|
@ -296,7 +302,8 @@
|
|||
# define SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT 0
|
||||
#endif
|
||||
|
||||
#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD || SANITIZER_SOLARIS
|
||||
#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD || \
|
||||
SANITIZER_OPENBSD || SANITIZER_SOLARIS
|
||||
# define SANITIZER_MADVISE_DONTNEED MADV_FREE
|
||||
#else
|
||||
# define SANITIZER_MADVISE_DONTNEED MADV_DONTNEED
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
// This header should NOT include any other headers from sanitizer runtime.
|
||||
#include "sanitizer_internal_defs.h"
|
||||
#include "sanitizer_platform_limits_netbsd.h"
|
||||
#include "sanitizer_platform_limits_openbsd.h"
|
||||
#include "sanitizer_platform_limits_posix.h"
|
||||
#include "sanitizer_platform_limits_solaris.h"
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "sanitizer_common.h"
|
||||
#include "sanitizer_flags.h"
|
||||
#include "sanitizer_platform_limits_netbsd.h"
|
||||
#include "sanitizer_platform_limits_openbsd.h"
|
||||
#include "sanitizer_platform_limits_posix.h"
|
||||
#include "sanitizer_platform_limits_solaris.h"
|
||||
#include "sanitizer_posix.h"
|
||||
|
@ -42,7 +43,7 @@
|
|||
#if SANITIZER_FREEBSD
|
||||
// The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even before
|
||||
// that, it was never implemented. So just define it to zero.
|
||||
#undef MAP_NORESERVE
|
||||
#undef MAP_NORESERVE
|
||||
#define MAP_NORESERVE 0
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ static const u32 kStackTraceMax = 256;
|
|||
# define SANITIZER_CAN_FAST_UNWIND 0
|
||||
#elif SANITIZER_WINDOWS
|
||||
# define SANITIZER_CAN_FAST_UNWIND 0
|
||||
#elif SANITIZER_OPENBSD
|
||||
# define SANITIZER_CAN_FAST_UNWIND 0
|
||||
#else
|
||||
# define SANITIZER_CAN_FAST_UNWIND 1
|
||||
#endif
|
||||
|
@ -30,7 +32,7 @@ static const u32 kStackTraceMax = 256;
|
|||
// Fast unwind is the only option on Mac for now; we will need to
|
||||
// revisit this macro when slow unwind works on Mac, see
|
||||
// https://github.com/google/sanitizers/issues/137
|
||||
#if SANITIZER_MAC
|
||||
#if SANITIZER_MAC || SANITIZER_OPENBSD
|
||||
# define SANITIZER_CAN_SLOW_UNWIND 0
|
||||
#else
|
||||
# define SANITIZER_CAN_SLOW_UNWIND 1
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD || SANITIZER_SOLARIS
|
||||
#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD || \
|
||||
SANITIZER_OPENBSD || SANITIZER_SOLARIS
|
||||
# define SYSCALL(name) SYS_ ## name
|
||||
#else
|
||||
# define SYSCALL(name) __NR_ ## name
|
||||
|
|
Loading…
Reference in New Issue