Loading...
--- dyld/dyld-1122.1.2/common/DyldSharedCache.cpp
+++ dyld/dyld-1066.8/common/DyldSharedCache.cpp
@@ -22,9 +22,6 @@
* @APPLE_LICENSE_HEADER_END@
*/
-#include <TargetConditionals.h>
-
-#if !TARGET_OS_EXCLAVEKIT
#include <dirent.h>
#include <sys/errno.h>
@@ -355,7 +352,7 @@
return;
for (uint32_t i = 0; i != header.subCacheArrayCount; ++i) {
- const DyldSharedCache* cache = (const DyldSharedCache*)((uintptr_t)this + this->getSubCacheVmOffset(i));
+ const DyldSharedCache* cache = (const DyldSharedCache*)((uint8_t*)this + this->getSubCacheVmOffset(i));
handler(cache, stop);
if ( stop )
return;
@@ -389,20 +386,20 @@
void DyldSharedCache::getSubCacheUuid(uint8_t index, uint8_t uuid[]) const {
if (header.mappingOffset <= __offsetof(dyld_cache_header, cacheSubType) ) {
- const dyld_subcache_entry_v1* subCacheEntries = (dyld_subcache_entry_v1*)((uintptr_t)this + header.subCacheArrayOffset);
+ const dyld_subcache_entry_v1* subCacheEntries = (dyld_subcache_entry_v1*)((uint8_t*)this + header.subCacheArrayOffset);
memcpy(uuid, subCacheEntries[index].uuid, 16);
} else {
- const dyld_subcache_entry* subCacheEntries = (dyld_subcache_entry*)((uintptr_t)this + header.subCacheArrayOffset);
+ const dyld_subcache_entry* subCacheEntries = (dyld_subcache_entry*)((uint8_t*)this + header.subCacheArrayOffset);
memcpy(uuid, subCacheEntries[index].uuid, 16);
}
}
uint64_t DyldSharedCache::getSubCacheVmOffset(uint8_t index) const {
if (header.mappingOffset <= __offsetof(dyld_cache_header, cacheSubType) ) {
- const dyld_subcache_entry_v1* subCacheEntries = (dyld_subcache_entry_v1*)((uintptr_t)this + header.subCacheArrayOffset);
+ const dyld_subcache_entry_v1* subCacheEntries = (dyld_subcache_entry_v1*)((uint8_t*)this + header.subCacheArrayOffset);
return subCacheEntries[index].cacheVMOffset;
} else {
- const dyld_subcache_entry* subCacheEntries = (dyld_subcache_entry*)((uintptr_t)this + header.subCacheArrayOffset);
+ const dyld_subcache_entry* subCacheEntries = (dyld_subcache_entry*)((uint8_t*)this + header.subCacheArrayOffset);
return subCacheEntries[index].cacheVMOffset;
}
}
@@ -545,7 +542,7 @@
// check for cache without local symbols info
if (!this->hasLocalSymbolsInfo())
return nullptr;
- const auto localInfo = (dyld_cache_local_symbols_info*)((uintptr_t)this + header.localSymbolsOffset);
+ const auto localInfo = (dyld_cache_local_symbols_info*)((uint8_t*)this + header.localSymbolsOffset);
return getLocalNlistEntries(localInfo);
}
@@ -554,7 +551,7 @@
// check for cache without local symbols info
if (!this->hasLocalSymbolsInfo())
return 0;
- const auto localInfo = (dyld_cache_local_symbols_info*)((uintptr_t)this + header.localSymbolsOffset);
+ const auto localInfo = (dyld_cache_local_symbols_info*)((uint8_t*)this + header.localSymbolsOffset);
return localInfo->nlistCount;
}
@@ -568,7 +565,7 @@
// check for cache without local symbols info
if (!this->hasLocalSymbolsInfo())
return nullptr;
- const auto localInfo = (dyld_cache_local_symbols_info*)((uintptr_t)this + header.localSymbolsOffset);
+ const auto localInfo = (dyld_cache_local_symbols_info*)((uint8_t*)this + header.localSymbolsOffset);
return getLocalStrings(localInfo);
}
@@ -577,7 +574,7 @@
// check for cache without local symbols info
if (!this->hasLocalSymbolsInfo())
return 0;
- const auto localInfo = (dyld_cache_local_symbols_info*)((uintptr_t)this + header.localSymbolsOffset);
+ const auto localInfo = (dyld_cache_local_symbols_info*)((uint8_t*)this + header.localSymbolsOffset);
return localInfo->stringsSize;
}
@@ -587,7 +584,7 @@
const dyld_cache_mapping_info* mappings = (dyld_cache_mapping_info*)((char*)this + header.mappingOffset);
uint32_t dyldCacheImageIndex;
if ( hasImagePath(dylibPath, dyldCacheImageIndex) )
- return (dyld3::MachOFile*)((uintptr_t)this + dylibs[dyldCacheImageIndex].address - mappings[0].address);
+ return (dyld3::MachOFile*)((uint8_t*)this + dylibs[dyldCacheImageIndex].address - mappings[0].address);
return nullptr;
}
@@ -596,7 +593,7 @@
// check for cache without local symbols info
if (!this->hasLocalSymbolsInfo())
return;
- const auto localInfo = (dyld_cache_local_symbols_info*)((uintptr_t)this + header.localSymbolsOffset);
+ const auto localInfo = (dyld_cache_local_symbols_info*)((uint8_t*)this + header.localSymbolsOffset);
if ( header.mappingOffset >= __offsetof(dyld_cache_header, symbolFileUUID) ) {
// On new caches, the dylibOffset is 64-bits, and is a VM offset
@@ -621,10 +618,10 @@
const mach_header* DyldSharedCache::getIndexedImageEntry(uint32_t index, uint64_t& mTime, uint64_t& inode) const
{
const dyld_cache_image_info* dylibs = images();
- const dyld_cache_mapping_info* mappings = (dyld_cache_mapping_info*)((uintptr_t)this + header.mappingOffset);
+ const dyld_cache_mapping_info* mappings = (dyld_cache_mapping_info*)((char*)this + header.mappingOffset);
mTime = dylibs[index].modTime;
inode = dylibs[index].inode;
- return (mach_header*)((uintptr_t)this + dylibs[index].address - mappings[0].address);
+ return (mach_header*)((uint8_t*)this + dylibs[index].address - mappings[0].address);
}
const mach_header* DyldSharedCache::getIndexedImageEntry(uint32_t index) const
@@ -2207,5 +2204,3 @@
});
}
#endif
-
-#endif // !TARGET_OS_EXCLAVEKIT