Loading...
common/Array.h dyld-1340 dyld-1235.2
--- dyld/dyld-1340/common/Array.h
+++ dyld/dyld-1235.2/common/Array.h
@@ -25,8 +25,6 @@
 #define Array_h
 
 #include <algorithm>
-#include <span>
-
 #include <stdint.h>
 #include <stdio.h>
 #include <assert.h>
@@ -36,9 +34,7 @@
 #if !TARGET_OS_EXCLAVEKIT
 #include <mach/mach.h>
 #endif
-
 #include "Allocator.h"
-#include "StringUtils.h"
 
 namespace dyld3 {
 
@@ -171,26 +167,18 @@
        // MAXCOUNT is not specified, keep doubling size
        _overflowBufferSize = round_page(std::max(this->_allocCount * 2, n) * sizeof(T));
     }
-#if !DYLD_FEATURE_EMBEDDED_PAGE_ALLOCATOR
+#if !TARGET_OS_EXCLAVEKIT
     int kr = ::vm_allocate(mach_task_self(), (vm_address_t*)&_overflowBuffer, (vm_size_t)_overflowBufferSize, VM_FLAGS_ANYWHERE | VM_MAKE_TAG(VM_MEMORY_DYLD));
 #else
     _overflowBuffer = lsl::MemoryManager::allocate_pages(_overflowBufferSize);
     int kr = 0;
 #endif
     if (kr != 0) {
-#if !TARGET_OS_EXCLAVEKIT
+#if BUILDING_LIBDYLD && !TARGET_OS_EXCLAVEKIT
+        //FIXME We should figure out a way to do this in dyld
         char crashString[256];
-#if BUILDING_DYLD
-        // snprintf in dyld uses _simple_salloc, which calls vm_allocate
-        strlcpy(crashString, "OverflowSafeArray failed to allocate 0x", sizeof(crashString));
-        appendHexToString(crashString, (uint64_t)_overflowBufferSize, sizeof(crashString));
-        strlcat(crashString, " bytes, vm_allocate returned: 0x", sizeof(crashString));
-        appendHexToString(crashString, kr, sizeof(crashString));
-        strlcat(crashString, "\n", sizeof(crashString));
-#else
         snprintf(crashString, sizeof(crashString), "OverflowSafeArray failed to allocate %llu bytes, vm_allocate returned: %d\n",
                  (uint64_t)_overflowBufferSize, kr);
-#endif
         CRSetCrashLogMessage(crashString);
 #endif
         assert(0);
@@ -211,7 +199,7 @@
     this->_allocCount = _overflowBufferSize / sizeof(T);
 
     if ( oldBuffer != 0 )
-#if !DYLD_FEATURE_EMBEDDED_PAGE_ALLOCATOR
+#if !TARGET_OS_EXCLAVEKIT
         ::vm_deallocate(mach_task_self(), (vm_address_t)oldBuffer, (vm_size_t)oldBufferSize);
 #else
         lsl::MemoryManager::deallocate_pages(oldBuffer, oldBufferSize);
@@ -235,7 +223,7 @@
     clear();
 
     if ( _overflowBuffer != 0 )
-#if !DYLD_FEATURE_EMBEDDED_PAGE_ALLOCATOR
+#if !TARGET_OS_EXCLAVEKIT
         ::vm_deallocate(mach_task_self(), (vm_address_t)_overflowBuffer, (vm_size_t)_overflowBufferSize);
 #else
     lsl::MemoryManager::deallocate_pages(_overflowBuffer, _overflowBufferSize);
@@ -250,7 +238,7 @@
 
     // Free our buffer if we have one
     if ( _overflowBuffer != 0 )
-#if !DYLD_FEATURE_EMBEDDED_PAGE_ALLOCATOR
+#if !TARGET_OS_EXCLAVEKIT
         vm_deallocate(mach_task_self(), (vm_address_t)_overflowBuffer, (vm_size_t)_overflowBufferSize);
 #else
     lsl::MemoryManager::deallocate_pages(_overflowBuffer, _overflowBufferSize);