2014-02-03 23:32:19 +08:00
|
|
|
//===-- sanitizer_mac.h -----------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-02-03 23:32:19 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is shared between various sanitizers' runtime libraries and
|
|
|
|
// provides definitions for OSX-specific functions.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SANITIZER_MAC_H
|
|
|
|
#define SANITIZER_MAC_H
|
|
|
|
|
2015-11-21 02:42:07 +08:00
|
|
|
#include "sanitizer_common.h"
|
2014-02-03 23:45:03 +08:00
|
|
|
#include "sanitizer_platform.h"
|
|
|
|
#if SANITIZER_MAC
|
2015-04-09 01:08:24 +08:00
|
|
|
#include "sanitizer_posix.h"
|
2014-02-03 23:45:03 +08:00
|
|
|
|
2014-02-03 23:32:19 +08:00
|
|
|
namespace __sanitizer {
|
|
|
|
|
Removed platform-specific ifdefs from sanitizer_procmaps.h
Summary: Removed platform-specific ifdefs for linux, mac, freebsd and netbsd from sanitizer_procmaps.h
Patch by Yicheng Wang <yichengfb@fb.com>
Reviewers: kcc, kubamracek, alekseyshl, fjricci, vitalybuka
Reviewed By: fjricci, vitalybuka
Subscribers: vitalybuka, emaste, krytarowski, llvm-commits
Differential Revision: https://reviews.llvm.org/D38098
llvm-svn: 313999
2017-09-23 01:48:24 +08:00
|
|
|
struct MemoryMappingLayoutData {
|
|
|
|
int current_image;
|
|
|
|
u32 current_magic;
|
|
|
|
u32 current_filetype;
|
|
|
|
ModuleArch current_arch;
|
|
|
|
u8 current_uuid[kModuleUUIDSize];
|
|
|
|
int current_load_cmd_count;
|
2017-11-11 05:19:20 +08:00
|
|
|
const char *current_load_cmd_addr;
|
Removed platform-specific ifdefs from sanitizer_procmaps.h
Summary: Removed platform-specific ifdefs for linux, mac, freebsd and netbsd from sanitizer_procmaps.h
Patch by Yicheng Wang <yichengfb@fb.com>
Reviewers: kcc, kubamracek, alekseyshl, fjricci, vitalybuka
Reviewed By: fjricci, vitalybuka
Subscribers: vitalybuka, emaste, krytarowski, llvm-commits
Differential Revision: https://reviews.llvm.org/D38098
llvm-svn: 313999
2017-09-23 01:48:24 +08:00
|
|
|
bool current_instrumented;
|
|
|
|
};
|
|
|
|
|
2020-05-15 05:52:35 +08:00
|
|
|
template <typename VersionType>
|
|
|
|
struct VersionBase {
|
2020-05-15 04:43:33 +08:00
|
|
|
u16 major;
|
|
|
|
u16 minor;
|
|
|
|
|
2020-05-15 05:52:35 +08:00
|
|
|
VersionBase(u16 major, u16 minor) : major(major), minor(minor) {}
|
2020-05-15 04:43:33 +08:00
|
|
|
|
2020-05-15 05:52:35 +08:00
|
|
|
bool operator==(const VersionType &other) const {
|
2020-05-15 04:43:33 +08:00
|
|
|
return major == other.major && minor == other.minor;
|
|
|
|
}
|
2020-05-15 05:52:35 +08:00
|
|
|
bool operator>=(const VersionType &other) const {
|
2020-06-04 06:24:53 +08:00
|
|
|
return major > other.major ||
|
2020-05-15 04:43:33 +08:00
|
|
|
(major == other.major && minor >= other.minor);
|
|
|
|
}
|
2020-07-29 00:44:02 +08:00
|
|
|
bool operator<(const VersionType &other) const { return !(*this >= other); }
|
2020-05-15 04:43:33 +08:00
|
|
|
};
|
|
|
|
|
2020-05-15 05:52:35 +08:00
|
|
|
struct MacosVersion : VersionBase<MacosVersion> {
|
2020-07-01 04:19:25 +08:00
|
|
|
MacosVersion(u16 major, u16 minor) : VersionBase(major, minor) {}
|
2020-05-15 05:52:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct DarwinKernelVersion : VersionBase<DarwinKernelVersion> {
|
|
|
|
DarwinKernelVersion(u16 major, u16 minor) : VersionBase(major, minor) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
MacosVersion GetMacosAlignedVersion();
|
2020-05-15 04:43:33 +08:00
|
|
|
DarwinKernelVersion GetDarwinKernelVersion();
|
2014-02-03 23:32:19 +08:00
|
|
|
|
2015-06-24 05:39:49 +08:00
|
|
|
char **GetEnviron();
|
|
|
|
|
2017-07-13 07:29:21 +08:00
|
|
|
void RestrictMemoryToMaxAddress(uptr max_address);
|
|
|
|
|
2014-02-03 23:32:19 +08:00
|
|
|
} // namespace __sanitizer
|
|
|
|
|
2014-02-03 23:45:03 +08:00
|
|
|
#endif // SANITIZER_MAC
|
2014-02-03 23:32:19 +08:00
|
|
|
#endif // SANITIZER_MAC_H
|