sync code with last improvements from OpenBSD
This commit is contained in:
parent
5903cbe575
commit
62d64fa864
841 changed files with 83929 additions and 40755 deletions
|
@ -291,7 +291,7 @@ protected:
|
|||
Builder.defineMacro("__HAIKU__");
|
||||
Builder.defineMacro("__ELF__");
|
||||
DefineStd(Builder, "unix", Opts);
|
||||
if (this->HasFloat128)
|
||||
if (this->HasFloat128)
|
||||
Builder.defineMacro("__FLOAT128__");
|
||||
}
|
||||
|
||||
|
@ -454,6 +454,7 @@ protected:
|
|||
// OpenBSD defines; list based off of gcc output
|
||||
|
||||
Builder.defineMacro("__OpenBSD__");
|
||||
Builder.defineMacro("__SecBSD__");
|
||||
DefineStd(Builder, "unix", Opts);
|
||||
Builder.defineMacro("__ELF__");
|
||||
if (Opts.POSIXThreads)
|
||||
|
|
|
@ -35,7 +35,8 @@ uintptr_t GetCurrentProcess(void);
|
|||
#include <machine/sysarch.h>
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__) && (defined(__arm__) || defined(__mips__) || defined(__riscv))
|
||||
#if defined(__OpenBSD__) || defined(__SecBSD__) && \
|
||||
(defined(__arm__) || defined(__mips__) || defined(__riscv))
|
||||
// clang-format off
|
||||
#include <sys/types.h>
|
||||
#include <machine/sysarch.h>
|
||||
|
@ -65,7 +66,8 @@ void __clear_cache(void *start, void *end) {
|
|||
#elif defined(_WIN32) && (defined(__arm__) || defined(__aarch64__))
|
||||
FlushInstructionCache(GetCurrentProcess(), start, end - start);
|
||||
#elif defined(__arm__) && !defined(__APPLE__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
|
||||
defined(__SecBSD__)
|
||||
struct arm_sync_icache_args arg;
|
||||
|
||||
arg.addr = (uintptr_t)start;
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
#endif // *BSD
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#if defined(__OpenBSD__) || defined(__SecBSD__) ||
|
||||
#include <machine/endian.h>
|
||||
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define SANITIZER_PLATFORM_H
|
||||
|
||||
#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
|
||||
!defined(__OpenBSD__) && \
|
||||
!defined(__OpenBSD__) && !defined(__SecBSD__) && \
|
||||
!defined(__APPLE__) && !defined(_WIN32) && !defined(__Fuchsia__) && \
|
||||
!(defined(__sun__) && defined(__svr4__))
|
||||
# error "This operating system is not supported"
|
||||
|
@ -50,7 +50,7 @@
|
|||
# define SANITIZER_NETBSD 0
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#if defined(__OpenBSD__) || defined(__SecBSD__)
|
||||
# define SANITIZER_OPENBSD 1
|
||||
#else
|
||||
# define SANITIZER_OPENBSD 0
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
// Other platforms should be easy to add, and probably work as-is.
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || \
|
||||
defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || \
|
||||
(defined(__sun__) && defined(__svr4__)) || defined(_WIN32) || \
|
||||
defined(__Fuchsia__)
|
||||
defined(__SecBSD__) || (defined(__sun__) && defined(__svr4__)) || \
|
||||
defined(_WIN32) || defined(__Fuchsia__)
|
||||
#define CAN_SANITIZE_UB 1
|
||||
#else
|
||||
# define CAN_SANITIZE_UB 0
|
||||
|
|
|
@ -395,7 +395,20 @@ private:
|
|||
// Futex Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if defined(SYS_futex)
|
||||
#ifdef __SecBSD__
|
||||
#include <sys/futex.h>
|
||||
|
||||
void PlatformFutexWait(int* addr, int expect) {
|
||||
constexpr int WAIT = 0;
|
||||
futex((volatile uint32_t *)addr, WAIT, expect, NULL, NULL);
|
||||
__tsan_acquire(addr);
|
||||
}
|
||||
void PlatformFutexWake(int* addr) {
|
||||
constexpr int WAKE = 1;
|
||||
__tsan_release(addr);
|
||||
futex((volatile uint32_t *)addr, WAKE, INT_MAX, NULL, NULL);
|
||||
}
|
||||
#elif defined(SYS_futex)
|
||||
void PlatformFutexWait(int* addr, int expect) {
|
||||
constexpr int WAIT = 0;
|
||||
syscall(SYS_futex, addr, WAIT, expect, 0);
|
||||
|
|
|
@ -29,14 +29,12 @@
|
|||
#define LLVM_THREADING_USE_STD_CALL_ONCE 1
|
||||
#elif defined(LLVM_ON_UNIX) && \
|
||||
(defined(_LIBCPP_VERSION) || \
|
||||
!(defined(__NetBSD__) || defined(__OpenBSD__) || \
|
||||
(defined(__ppc__) || defined(__PPC__))))
|
||||
!(defined(__NetBSD__) || defined(__OpenBSD__) || defined(__SecBSD__)))
|
||||
// std::call_once from libc++ is used on all Unix platforms. Other
|
||||
// implementations like libstdc++ are known to have problems on NetBSD,
|
||||
// OpenBSD and PowerPC.
|
||||
#define LLVM_THREADING_USE_STD_CALL_ONCE 1
|
||||
#elif defined(LLVM_ON_UNIX) && \
|
||||
((defined(__ppc__) || defined(__PPC__)) && defined(__LITTLE_ENDIAN__))
|
||||
#elif defined(LLVM_ON_UNIX) && defined(__LITTLE_ENDIAN__)
|
||||
#define LLVM_THREADING_USE_STD_CALL_ONCE 1
|
||||
#else
|
||||
#define LLVM_THREADING_USE_STD_CALL_ONCE 0
|
||||
|
|
|
@ -71,13 +71,14 @@ extern char **environ;
|
|||
|
||||
#include <sys/types.h>
|
||||
#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && \
|
||||
!defined(__linux__) && !defined(__FreeBSD_kernel__) && !defined(_AIX)
|
||||
!defined(__linux__) && !defined(__FreeBSD_kernel__) && !defined(_AIX) && \
|
||||
!defined(__SecBSD__)
|
||||
#include <sys/statvfs.h>
|
||||
#define STATVFS statvfs
|
||||
#define FSTATVFS fstatvfs
|
||||
#define STATVFS_F_FRSIZE(vfs) vfs.f_frsize
|
||||
#else
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__)
|
||||
#if defined(__OpenBSD__) || defined(__SecBSD__) || defined(__FreeBSD__)
|
||||
#include <sys/mount.h>
|
||||
#include <sys/param.h>
|
||||
#elif defined(__linux__)
|
||||
|
@ -125,7 +126,8 @@ const file_t kInvalidFile = -1;
|
|||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
|
||||
defined(__minix) || defined(__FreeBSD_kernel__) || defined(__linux__) || \
|
||||
defined(__CYGWIN__) || defined(__DragonFly__) || defined(_AIX) || defined(__GNU__)
|
||||
defined(__CYGWIN__) || defined(__DragonFly__) || defined(_AIX) || \
|
||||
defined(__GNU__) || defined(__SecBSD__)
|
||||
static int
|
||||
test_dir(char ret[PATH_MAX], const char *dir, const char *bin)
|
||||
{
|
||||
|
@ -234,7 +236,8 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
|
|||
if (getprogpath(exe_path, argv0) != NULL)
|
||||
return exe_path;
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__minix) || \
|
||||
defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(_AIX)
|
||||
defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(_AIX) || \
|
||||
defined(__SecBSD__)
|
||||
const char *curproc = "/proc/curproc/file";
|
||||
char exe_path[PATH_MAX];
|
||||
if (sys::fs::exists(curproc)) {
|
||||
|
|
|
@ -332,7 +332,7 @@ static ManagedStatic<std::mutex> TermColorMutex;
|
|||
#endif
|
||||
|
||||
static bool terminalHasColors(int fd) {
|
||||
#if defined(__OpenBSD__)
|
||||
#if defined(__OpenBSD__) || defined(__SecBSD__)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <pthread.h>
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__SecBSD__)
|
||||
#include <pthread_np.h> // For pthread_getthreadid_np() / pthread_set_name_np()
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
#include <lwp.h> // For _lwp_self()
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#if defined(__OpenBSD__) || defined(__SecBSD__)
|
||||
#include <unistd.h> // For getthrid()
|
||||
#endif
|
||||
|
||||
|
@ -119,7 +119,7 @@ uint64_t llvm::get_threadid() {
|
|||
return uint64_t(pthread_getthreadid_np());
|
||||
#elif defined(__NetBSD__)
|
||||
return uint64_t(_lwp_self());
|
||||
#elif defined(__OpenBSD__)
|
||||
#elif defined(__OpenBSD__) || defined(__SecBSD__)
|
||||
return uint64_t(getthrid());
|
||||
#elif defined(__ANDROID__)
|
||||
return uint64_t(gettid());
|
||||
|
@ -144,7 +144,7 @@ static constexpr uint32_t get_max_thread_name_length_impl() {
|
|||
#endif
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
return 16;
|
||||
#elif defined(__OpenBSD__)
|
||||
#elif defined(__OpenBSD__) || defined(__SecBSD__)
|
||||
return 32;
|
||||
#else
|
||||
return 0;
|
||||
|
@ -175,7 +175,7 @@ void llvm::set_thread_name(const Twine &Name) {
|
|||
::pthread_setname_np(::pthread_self(), NameStr.data());
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__SecBSD__)
|
||||
::pthread_set_name_np(::pthread_self(), NameStr.data());
|
||||
#elif defined(__NetBSD__)
|
||||
::pthread_setname_np(::pthread_self(), "%s",
|
||||
|
@ -230,7 +230,7 @@ void llvm::get_thread_name(SmallVectorImpl<char> &Name) {
|
|||
::pthread_getname_np(::pthread_self(), buf, len);
|
||||
|
||||
Name.append(buf, buf + strlen(buf));
|
||||
#elif defined(__OpenBSD__)
|
||||
#elif defined(__OpenBSD__) || defined(__SecBSD__)
|
||||
constexpr uint32_t len = get_max_thread_name_length_impl();
|
||||
char buf[len];
|
||||
::pthread_get_name_np(::pthread_self(), buf, len);
|
||||
|
|
|
@ -2156,7 +2156,8 @@ TEST_F(FileSystemTest, permissions) {
|
|||
// AIX and Solaris without root will mask off (i.e., lose) the sticky bit
|
||||
// on files.
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && \
|
||||
!defined(_AIX) && !(defined(__sun__) && defined(__svr4__))
|
||||
!defined(_AIX) && !(defined(__sun__) && defined(__svr4__)) && \
|
||||
!defined(__SecBSD__)
|
||||
EXPECT_EQ(fs::setPermissions(TempPath, fs::sticky_bit), NoError);
|
||||
EXPECT_TRUE(CheckPermissions(fs::sticky_bit));
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define BENCHMARK_OS_FREEBSD 1
|
||||
#elif defined(__NetBSD__)
|
||||
#define BENCHMARK_OS_NETBSD 1
|
||||
#elif defined(__OpenBSD__)
|
||||
#elif defined(__OpenBSD__) || defined(__SecBSD__)
|
||||
#define BENCHMARK_OS_OPENBSD 1
|
||||
#elif defined(__linux__)
|
||||
#define BENCHMARK_OS_LINUX 1
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
# define GTEST_OS_NACL 1
|
||||
#elif defined __NetBSD__
|
||||
# define GTEST_OS_NETBSD 1
|
||||
#elif defined __OpenBSD__
|
||||
#elif defined __OpenBSD_ || defined(__SecBSD__)
|
||||
# define GTEST_OS_OPENBSD 1
|
||||
#elif defined __QNX__
|
||||
# define GTEST_OS_QNX 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue