- Timestamp:
- Nov 6, 2013 9:04:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/kLdrModMachO.c
r63 r64 1315 1315 */ 1316 1316 { 1317 KBOOL fLoadLinkEdit = K_FALSE; 1317 1318 PKLDRMODMACHOSECT pSectExtraItr; 1318 1319 KLDRADDR uNextRVA = 0; 1319 1320 KLDRADDR cb; 1321 KU32 cSegmentsToAdjust = cSegments - pModMachO->fMakeGot; 1320 1322 KU32 c; 1321 1323 1324 for (;;) 1325 { 1326 /* Check if there is __DWARF segment at the end and make sure it's left 1327 out of the RVA negotiations and image loading. */ 1328 if ( cSegmentsToAdjust > 0 1329 && !kHlpStrComp(pModMachO->pMod->aSegments[cSegmentsToAdjust - 1].pchName, "__DWARF")) 1330 { 1331 cSegmentsToAdjust--; 1332 pModMachO->pMod->aSegments[cSegmentsToAdjust].RVA = NIL_KLDRADDR; 1333 pModMachO->pMod->aSegments[cSegmentsToAdjust].cbMapped = 0; 1334 continue; 1335 } 1336 1337 /* If we're skipping the __LINKEDIT segment, check for it and adjust 1338 the number of segments we'll be messing with here. ASSUMES it's 1339 last (by now anyway). */ 1340 if ( !fLoadLinkEdit 1341 && cSegmentsToAdjust > 0 1342 && !kHlpStrComp(pModMachO->pMod->aSegments[cSegmentsToAdjust - 1].pchName, "__LINKEDIT")) 1343 { 1344 cSegmentsToAdjust--; 1345 pModMachO->pMod->aSegments[cSegmentsToAdjust].RVA = NIL_KLDRADDR; 1346 pModMachO->pMod->aSegments[cSegmentsToAdjust].cbMapped = 0; 1347 continue; 1348 } 1349 break; 1350 } 1351 1322 1352 /* Adjust RVAs. */ 1323 c = cSegments - pModMachO->fMakeGot;1353 c = cSegmentsToAdjust; 1324 1354 for (pDstSeg = &pModMachO->pMod->aSegments[0]; c-- > 0; pDstSeg++) 1325 1355 { … … 1334 1364 1335 1365 /* Calculate the cbMapping members. */ 1336 c = cSegments - pModMachO->fMakeGot;1366 c = cSegmentsToAdjust; 1337 1367 for (pDstSeg = &pModMachO->pMod->aSegments[0]; c-- > 1; pDstSeg++) 1338 1368 { 1369 1339 1370 cb = pDstSeg[1].RVA - pDstSeg->RVA; 1340 1371 pDstSeg->cbMapped = (KSIZE)cb == cb ? cb : KSIZE_MAX; … … 1347 1378 pModMachO->cbImage = pDstSeg->RVA + cb; 1348 1379 1349 /* Fixup the section RVA (internal). */1350 c = cSegments - pModMachO->fMakeGot;1380 /* Fixup the section RVAs (internal). */ 1381 c = cSegmentsToAdjust; 1351 1382 uNextRVA = pModMachO->cbImage; 1352 1383 pDstSeg = &pModMachO->pMod->aSegments[0];
Note:
See TracChangeset
for help on using the changeset viewer.