Loading...
--- dyld/dyld-1066.10/common/MachOLoaded.cpp
+++ dyld/dyld-1235.2/common/MachOLoaded.cpp
@@ -22,23 +22,30 @@
*/
+#include <TargetConditionals.h>
+#include "Defines.h"
+#if !TARGET_OS_EXCLAVEKIT
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <sys/mman.h>
#include <mach/mach.h>
#include <fcntl.h>
+#include <unistd.h>
+#endif
+
#include <stdlib.h>
#include <stdio.h>
-#include <unistd.h>
#include <assert.h>
-#include <mach-o/reloc.h>
#include <mach-o/nlist.h>
+
+#if !TARGET_OS_EXCLAVEKIT
extern "C" {
#include <corecrypto/ccdigest.h>
#include <corecrypto/ccsha1.h>
#include <corecrypto/ccsha2.h>
}
+#endif
#include "MachOFile.h"
#include "MachOLoaded.h"
@@ -700,14 +707,7 @@
}
}
if ( bestSymbol != nullptr ) {
-#if __arm__
- if ( bestSymbol->n_desc & N_ARM_THUMB_DEF )
- *symbolAddr = (bestSymbol->n_value | 1) + leInfo.layout.slide;
- else
- *symbolAddr = bestSymbol->n_value + leInfo.layout.slide;
-#else
*symbolAddr = bestSymbol->n_value + leInfo.layout.slide;
-#endif
if ( bestSymbol->n_un.n_strx < maxStringOffset )
*symbolName = &stringPool[bestSymbol->n_un.n_strx];
return true;
@@ -717,22 +717,15 @@
return false;
}
-const void* MachOLoaded::findSectionContent(const char* segName, const char* sectName, uint64_t& size,
- bool matchSegNameAsPrefix) const
+const void* MachOLoaded::findSectionContent(const char* segName, const char* sectName, uint64_t& size) const
{
__block const void* result = nullptr;
forEachSection(^(const SectionInfo& sectInfo, bool malformedSectionRange, bool& stop) {
if ( strcmp(sectInfo.sectName, sectName) != 0 )
return;
- // Segment name is either matched exactly or by prefix
- if ( matchSegNameAsPrefix ) {
- if ( strstr(sectInfo.segInfo.segName, segName) != sectInfo.segInfo.segName )
- return;
- } else {
- if ( strcmp(sectInfo.segInfo.segName, segName) != 0 )
- return;
- }
+ if ( strcmp(sectInfo.segInfo.segName, segName) != 0 )
+ return;
size = sectInfo.sectSize;
if ( this->isPreload() )
@@ -773,7 +766,7 @@
if ( fixupLoc->arm64e.authBind.bind ) {
uint32_t bindOrdinal = (segInfo->pointer_format == DYLD_CHAINED_PTR_ARM64E_USERLAND24) ? fixupLoc->arm64e.authBind24.ordinal : fixupLoc->arm64e.authBind.ordinal;
if ( bindOrdinal >= bindTargets.count() ) {
- diag.error("out of range bind ordinal %d (max %lu)", bindOrdinal, bindTargets.count());
+ diag.error("out of range bind ordinal %d (max %llu)", bindOrdinal, bindTargets.count());
stop = true;
break;
}
@@ -793,7 +786,7 @@
if ( fixupLoc->arm64e.bind.bind ) {
uint32_t bindOrdinal = (segInfo->pointer_format == DYLD_CHAINED_PTR_ARM64E_USERLAND24) ? fixupLoc->arm64e.bind24.ordinal : fixupLoc->arm64e.bind.ordinal;
if ( bindOrdinal >= bindTargets.count() ) {
- diag.error("out of range bind ordinal %d (max %lu)", bindOrdinal, bindTargets.count());
+ diag.error("out of range bind ordinal %d (max %llu)", bindOrdinal, bindTargets.count());
stop = true;
break;
}
@@ -819,7 +812,7 @@
case DYLD_CHAINED_PTR_64_OFFSET:
if ( fixupLoc->generic64.bind.bind ) {
if ( fixupLoc->generic64.bind.ordinal >= bindTargets.count() ) {
- diag.error("out of range bind ordinal %d (max %lu)", fixupLoc->generic64.bind.ordinal, bindTargets.count());
+ diag.error("out of range bind ordinal %d (max %llu)", fixupLoc->generic64.bind.ordinal, bindTargets.count());
stop = true;
break;
}
@@ -842,7 +835,7 @@
case DYLD_CHAINED_PTR_32:
if ( fixupLoc->generic32.bind.bind ) {
if ( fixupLoc->generic32.bind.ordinal >= bindTargets.count() ) {
- diag.error("out of range bind ordinal %d (max %lu)", fixupLoc->generic32.bind.ordinal, bindTargets.count());
+ diag.error("out of range bind ordinal %d (max %llu)", fixupLoc->generic32.bind.ordinal, bindTargets.count());
stop = true;
break;
}