528 |
print_load_command (struct load_command *lc) |
print_load_command (struct load_command *lc) |
529 |
{ |
{ |
530 |
print_load_command_name (lc->cmd); |
print_load_command_name (lc->cmd); |
531 |
printf ("%#10lx", lc->cmdsize); |
printf ("%#10lx", (unsigned long)lc->cmdsize); |
532 |
|
|
533 |
if (lc->cmd == LC_SEGMENT) |
if (lc->cmd == LC_SEGMENT) |
534 |
{ |
{ |
538 |
|
|
539 |
scp = (struct segment_command *) lc; |
scp = (struct segment_command *) lc; |
540 |
printf (" %-16.16s %#10lx %#10lx\n", |
printf (" %-16.16s %#10lx %#10lx\n", |
541 |
scp->segname, scp->vmaddr, scp->vmsize); |
scp->segname, (unsigned long)scp->vmaddr, (unsigned long)scp->vmsize); |
542 |
|
|
543 |
sectp = (struct section *) (scp + 1); |
sectp = (struct section *) (scp + 1); |
544 |
for (j = 0; j < scp->nsects; j++) |
for (j = 0; j < scp->nsects; j++) |
545 |
{ |
{ |
546 |
printf (" %-16.16s %#10lx %#10lx\n", |
printf (" %-16.16s %#10lx %#10lx\n", |
547 |
sectp->sectname, sectp->addr, sectp->size); |
sectp->sectname, (unsigned long)sectp->addr, (unsigned long)sectp->size); |
548 |
sectp++; |
sectp++; |
549 |
} |
} |
550 |
} |
} |
571 |
|
|
572 |
#if VERBOSE |
#if VERBOSE |
573 |
printf ("--- Header Information ---\n"); |
printf ("--- Header Information ---\n"); |
574 |
printf ("Magic = 0x%08lx\n", mh.magic); |
printf ("Magic = 0x%08lx\n", (unsigned long)mh.magic); |
575 |
printf ("CPUType = %d\n", mh.cputype); |
printf ("CPUType = %d\n", mh.cputype); |
576 |
printf ("CPUSubType = %d\n", mh.cpusubtype); |
printf ("CPUSubType = %d\n", mh.cpusubtype); |
577 |
printf ("FileType = 0x%lx\n", mh.filetype); |
printf ("FileType = 0x%lx\n", (unsigned long)mh.filetype); |
578 |
printf ("NCmds = %ld\n", mh.ncmds); |
printf ("NCmds = %ld\n", (unsigned long)mh.ncmds); |
579 |
printf ("SizeOfCmds = %ld\n", mh.sizeofcmds); |
printf ("SizeOfCmds = %ld\n", (unsigned long)mh.sizeofcmds); |
580 |
printf ("Flags = 0x%08lx\n", mh.flags); |
printf ("Flags = 0x%08lx\n", (unsigned long)mh.flags); |
581 |
#endif |
#endif |
582 |
|
|
583 |
nlc = mh.ncmds; |
nlc = mh.ncmds; |
656 |
scp->vmaddr += linkedit_delta; |
scp->vmaddr += linkedit_delta; |
657 |
|
|
658 |
printf ("Writing segment %-16.16s at %#10lx - %#10lx (sz: %#10lx)\n", |
printf ("Writing segment %-16.16s at %#10lx - %#10lx (sz: %#10lx)\n", |
659 |
scp->segname, scp->fileoff, scp->fileoff + scp->filesize, |
scp->segname, (unsigned long)scp->fileoff, (unsigned long)scp->fileoff + scp->filesize, |
660 |
scp->filesize); |
(unsigned long)scp->filesize); |
661 |
|
|
662 |
if (!unexec_copy (scp->fileoff, old_fileoff, scp->filesize)) |
if (!unexec_copy (scp->fileoff, old_fileoff, scp->filesize)) |
663 |
unexec_error ("cannot copy segment from input to output file"); |
unexec_error ("cannot copy segment from input to output file"); |
694 |
} |
} |
695 |
|
|
696 |
printf ("Writing segment %-16.16s at %#10lx - %#10lx (sz: %#10lx)\n", |
printf ("Writing segment %-16.16s at %#10lx - %#10lx (sz: %#10lx)\n", |
697 |
scp->segname, scp->fileoff, scp->fileoff + scp->filesize, |
scp->segname, (unsigned long)scp->fileoff, (unsigned long)scp->fileoff + scp->filesize, |
698 |
scp->filesize); |
(unsigned long)scp->filesize); |
699 |
|
|
700 |
/* Offsets in the output file for writing the next section structure |
/* Offsets in the output file for writing the next section structure |
701 |
and segment data block, respectively. */ |
and segment data block, respectively. */ |
742 |
unexec_error ("unrecognized section name in __DATA segment"); |
unexec_error ("unrecognized section name in __DATA segment"); |
743 |
|
|
744 |
printf (" section %-16.16s at %#10lx - %#10lx (sz: %#10lx)\n", |
printf (" section %-16.16s at %#10lx - %#10lx (sz: %#10lx)\n", |
745 |
sectp->sectname, sectp->offset, sectp->offset + sectp->size, |
sectp->sectname, (unsigned long)sectp->offset, (unsigned long)sectp->offset + sectp->size, |
746 |
sectp->size); |
(unsigned long)sectp->size); |
747 |
|
|
748 |
header_offset += sizeof (struct section); |
header_offset += sizeof (struct section); |
749 |
sectp++; |
sectp++; |
831 |
section.reserved2 = 0; |
section.reserved2 = 0; |
832 |
|
|
833 |
printf ("Writing segment %-16.16s at %#10lx - %#10lx (sz: %#10lx)\n", |
printf ("Writing segment %-16.16s at %#10lx - %#10lx (sz: %#10lx)\n", |
834 |
sc.segname, sc.fileoff, sc.fileoff + sc.filesize, sc.filesize); |
sc.segname, (unsigned long)sc.fileoff, (unsigned long)sc.fileoff + sc.filesize, (unsigned long)sc.filesize); |
835 |
|
|
836 |
if (!unexec_write (sc.fileoff, (void *) sc.vmaddr, sc.filesize)) |
if (!unexec_write (sc.fileoff, (void *) sc.vmaddr, sc.filesize)) |
837 |
unexec_error ("cannot write new __DATA segment"); |
unexec_error ("cannot write new __DATA segment"); |