Loading...
--- dyld/dyld-45.1/src/ImageLoaderMachO.cpp
+++ dyld/dyld-44.17/src/ImageLoaderMachO.cpp
@@ -76,7 +76,6 @@
struct macho_routines_command : public routines_command {};
#endif
- #define POINTER_RELOC GENERIC_RELOC_VANILLA
uint32_t ImageLoaderMachO::fgHintedBinaryTreeSearchs = 0;
uint32_t ImageLoaderMachO::fgUnhintedBinaryTreeSearchs = 0;
@@ -411,8 +410,6 @@
}
sNextAltLoadAddress += 0x00100000; // skip ahead 1MB and try again
if ( (sNextAltLoadAddress & 0xF0000000) == 0x90000000 )
- sNextAltLoadAddress = 0xB0000000;
- if ( (sNextAltLoadAddress & 0xF0000000) == 0xF0000000 )
throw "can't map split seg anywhere";
foundRoom = false;
break;
@@ -1195,25 +1192,19 @@
return info;
}
-uintptr_t ImageLoaderMachO::getFirstWritableSegmentAddress()
-{
- // in split segment libraries r_address is offset from first writable segment
- for (std::vector<class Segment*>::iterator it=fSegments.begin(); it != fSegments.end(); ++it) {
- if ( (*it)->writeable() ) {
- return (*it)->getActualLoadAddress();
- }
- }
- throw "no writable segment";
-}
uintptr_t ImageLoaderMachO::getRelocBase()
{
-#if __ppc__ || __i386__
if ( fIsSplitSeg ) {
// in split segment libraries r_address is offset from first writable segment
- return getFirstWritableSegmentAddress();
- }
-#endif
+ const unsigned int segmentCount = fSegments.size();
+ for(unsigned int i=0; i < segmentCount; ++i){
+ Segment* seg = fSegments[i];
+ if ( seg->writeable() ) {
+ return seg->getActualLoadAddress();
+ }
+ }
+ }
// in non-split segment libraries r_address is offset from first segment
return fSegments[0]->getActualLoadAddress();
@@ -1290,7 +1281,6 @@
const relocation_info* const relocsStart = (struct relocation_info*)(&fLinkEditBase[fDynamicInfo->locreloff]);
const relocation_info* const relocsEnd = &relocsStart[fDynamicInfo->nlocrel];
for (const relocation_info* reloc=relocsStart; reloc < relocsEnd; ++reloc) {
- #if __ppc__ || __ppc64__ || __i386__
if ( (reloc->r_address & R_SCATTERED) == 0 ) {
if ( reloc->r_symbolnum == R_ABS ) {
// ignore absolute relocations
@@ -1354,7 +1344,6 @@
throw "bad local scattered relocation length";
}
}
- #endif
}
// if there were __TEXT fixups, restore write protection
@@ -1524,7 +1513,6 @@
}
}
-
return NULL;
}
@@ -1846,7 +1834,7 @@
for (const relocation_info* reloc=relocsStart; reloc < relocsEnd; ++reloc) {
if (reloc->r_length == RELOC_SIZE) {
switch(reloc->r_type) {
- case POINTER_RELOC:
+ case GENERIC_RELOC_VANILLA:
{
const struct macho_nlist* undefinedSymbol = &fSymbolTable[reloc->r_symbolnum];
// if only processing coalesced symbols and this one does not require coalesceing, skip to next