forked from OSchip/llvm-project
[Darwin] Remove obsolete OS version checks
The oldest supported deployment target currently is 10.7 [1]. We can
remove a few outdated checks.
[1] 3db893b371/compiler-rt/cmake/config-ix.cmake (L397)
Reviewed By: delcypher
Differential Revision: https://reviews.llvm.org/D79958
This commit is contained in:
parent
58f7c938a1
commit
b3ca4f3431
|
@ -134,11 +134,7 @@ extern const short *_tolower_tab_;
|
|||
|
||||
// Platform-specific options.
|
||||
#if SANITIZER_MAC
|
||||
namespace __sanitizer {
|
||||
bool PlatformHasDifferentMemcpyAndMemmove();
|
||||
}
|
||||
#define PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE \
|
||||
(__sanitizer::PlatformHasDifferentMemcpyAndMemmove())
|
||||
#define PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE false
|
||||
#elif SANITIZER_WINDOWS64
|
||||
#define PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE false
|
||||
#else
|
||||
|
|
|
@ -629,8 +629,6 @@ MacosVersion GetMacosVersionInternal() {
|
|||
if (*p != '.') return MACOS_VERSION_UNKNOWN;
|
||||
|
||||
switch (major) {
|
||||
case 9: return MACOS_VERSION_LEOPARD;
|
||||
case 10: return MACOS_VERSION_SNOW_LEOPARD;
|
||||
case 11: return MACOS_VERSION_LION;
|
||||
case 12: return MACOS_VERSION_MOUNTAIN_LION;
|
||||
case 13: return MACOS_VERSION_MAVERICKS;
|
||||
|
@ -662,15 +660,6 @@ MacosVersion GetMacosVersion() {
|
|||
return result;
|
||||
}
|
||||
|
||||
bool PlatformHasDifferentMemcpyAndMemmove() {
|
||||
// On OS X 10.7 memcpy() and memmove() are both resolved
|
||||
// into memmove$VARIANT$sse42.
|
||||
// See also https://github.com/google/sanitizers/issues/34.
|
||||
// TODO(glider): need to check dynamically that memcpy() and memmove() are
|
||||
// actually the same function.
|
||||
return GetMacosVersion() == MACOS_VERSION_SNOW_LEOPARD;
|
||||
}
|
||||
|
||||
uptr GetRSS() {
|
||||
struct task_basic_info info;
|
||||
unsigned count = TASK_BASIC_INFO_COUNT;
|
||||
|
|
|
@ -33,9 +33,7 @@ struct MemoryMappingLayoutData {
|
|||
enum MacosVersion {
|
||||
MACOS_VERSION_UNINITIALIZED = 0,
|
||||
MACOS_VERSION_UNKNOWN,
|
||||
MACOS_VERSION_LEOPARD,
|
||||
MACOS_VERSION_SNOW_LEOPARD,
|
||||
MACOS_VERSION_LION,
|
||||
MACOS_VERSION_LION, // macOS 10.7; oldest currently supported
|
||||
MACOS_VERSION_MOUNTAIN_LION,
|
||||
MACOS_VERSION_MAVERICKS,
|
||||
MACOS_VERSION_YOSEMITE,
|
||||
|
|
|
@ -61,12 +61,10 @@ INTERCEPTOR(malloc_zone_t *, malloc_create_zone,
|
|||
malloc_zone_t *new_zone = (malloc_zone_t *)p;
|
||||
internal_memcpy(new_zone, &sanitizer_zone, sizeof(sanitizer_zone));
|
||||
new_zone->zone_name = NULL; // The name will be changed anyway.
|
||||
if (GetMacosVersion() >= MACOS_VERSION_LION) {
|
||||
// Prevent the client app from overwriting the zone contents.
|
||||
// Library functions that need to modify the zone will set PROT_WRITE on it.
|
||||
// This matches the behavior of malloc_create_zone() on OSX 10.7 and higher.
|
||||
mprotect(new_zone, allocated_size, PROT_READ);
|
||||
}
|
||||
// Prevent the client app from overwriting the zone contents.
|
||||
// Library functions that need to modify the zone will set PROT_WRITE on it.
|
||||
// This matches the behavior of malloc_create_zone() on OSX 10.7 and higher.
|
||||
mprotect(new_zone, allocated_size, PROT_READ);
|
||||
// We're explicitly *NOT* registering the zone.
|
||||
return new_zone;
|
||||
}
|
||||
|
@ -75,11 +73,9 @@ INTERCEPTOR(void, malloc_destroy_zone, malloc_zone_t *zone) {
|
|||
COMMON_MALLOC_ENTER();
|
||||
// We don't need to do anything here. We're not registering new zones, so we
|
||||
// don't to unregister. Just un-mprotect and free() the zone.
|
||||
if (GetMacosVersion() >= MACOS_VERSION_LION) {
|
||||
uptr page_size = GetPageSizeCached();
|
||||
uptr allocated_size = RoundUpTo(sizeof(sanitizer_zone), page_size);
|
||||
mprotect(zone, allocated_size, PROT_READ | PROT_WRITE);
|
||||
}
|
||||
uptr page_size = GetPageSizeCached();
|
||||
uptr allocated_size = RoundUpTo(sizeof(sanitizer_zone), page_size);
|
||||
mprotect(zone, allocated_size, PROT_READ | PROT_WRITE);
|
||||
if (zone->zone_name) {
|
||||
COMMON_MALLOC_FREE((void *)zone->zone_name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue