Rewrite linfo in output file.
modified: p_mach.cpp
This commit is contained in:
+12
-3
@@ -845,9 +845,15 @@ void PackMachAMD64::pack4(OutputFile *fo, Filter &ft) // append PackHeader
|
|||||||
segXHDR.filesize = offLINK - segTEXT.filesize; // XXX FIXME: assumes no __DATA in stub;
|
segXHDR.filesize = offLINK - segTEXT.filesize; // XXX FIXME: assumes no __DATA in stub;
|
||||||
segXHDR.maxprot = Mach_segment_command::VM_PROT_READ;
|
segXHDR.maxprot = Mach_segment_command::VM_PROT_READ;
|
||||||
segXHDR.nsects = 0;
|
segXHDR.nsects = 0;
|
||||||
memcpy(tail, &segXHDR, sizeof(segXHDR));
|
if (1) { // replace __DATA with segXHDR
|
||||||
tail += sizeof(segXHDR);
|
memcpy(tail, &segXHDR, sizeof(segXHDR));
|
||||||
goto next;
|
tail += sizeof(segXHDR);
|
||||||
|
goto next;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// FIXME: no need for LC_SEGMENT; just append to segTEXT and secTEXT
|
||||||
|
skip = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!strcmp("__LINKEDIT", segptr->segname)) {
|
if (!strcmp("__LINKEDIT", segptr->segname)) {
|
||||||
segLINK.initprot = Mach_segment_command::VM_PROT_READ
|
segLINK.initprot = Mach_segment_command::VM_PROT_READ
|
||||||
@@ -965,6 +971,9 @@ next:
|
|||||||
memset(tail, 0, sz_cmd);
|
memset(tail, 0, sz_cmd);
|
||||||
fo->rewrite(tail, sz_cmd);
|
fo->rewrite(tail, sz_cmd);
|
||||||
}
|
}
|
||||||
|
// Rewrite linfo in file.
|
||||||
|
fo->seek(sz_mach_headers, SEEK_SET);
|
||||||
|
fo->rewrite(&linfo, sizeof(linfo));
|
||||||
fo->seek(0, SEEK_END);
|
fo->seek(0, SEEK_END);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user