diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2012-09-06 19:14:58 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2012-09-06 19:14:58 -0700 |
commit | 4f4aa9c37a0c26908cafbc5ef58c94814d153415 (patch) | |
tree | 3579787fa49c816cd9484d5d9bab173ab4190090 | |
parent | bf29b0fecdb4e450107e1b304221b08339906aa5 (diff) | |
download | ldid-4f4aa9c37a0c26908cafbc5ef58c94814d153415.tar.gz ldid-4f4aa9c37a0c26908cafbc5ef58c94814d153415.tar.zst ldid-4f4aa9c37a0c26908cafbc5ef58c94814d153415.zip |
Use the new -A cpu filter when using -r and -S.
-rw-r--r-- | ldid.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -819,6 +819,13 @@ int main(int argc, const char *argv[]) { uint32_t clip(0); { FatHeader fat_header(Map(path)); _foreach (mach_header, fat_header.GetMachHeaders()) { + if (flag_A) { + if (mach_header.GetCPUType() != flag_CPUType) + continue; + if (mach_header.GetCPUSubtype() != flag_CPUSubtype) + continue; + } + mach_header->flags = mach_header.Swap(mach_header.Swap(mach_header->flags) | MH_DYLDLINK); uint32_t size(_not(uint32_t)); { @@ -865,8 +872,8 @@ int main(int argc, const char *argv[]) { } } - _assert(clip != 0); - _syscall(truncate(path, clip)); + if (clip != 0) + _syscall(truncate(path, clip)); } if (flag_S) { @@ -878,6 +885,13 @@ int main(int argc, const char *argv[]) { std::vector<CodesignAllocation> allocations; { FatHeader fat_header(Map(path)); _foreach (mach_header, fat_header.GetMachHeaders()) { + if (flag_A) { + if (mach_header.GetCPUType() != flag_CPUType) + continue; + if (mach_header.GetCPUSubtype() != flag_CPUSubtype) + continue; + } + mach_header->flags = mach_header.Swap(mach_header.Swap(mach_header->flags) | MH_DYLDLINK); size_t size(_not(size_t)); { @@ -899,6 +913,8 @@ int main(int argc, const char *argv[]) { } } + if (!allocations.empty()) { + pid_t pid = fork(); _syscall(pid); if (pid == 0) { @@ -971,6 +987,8 @@ int main(int argc, const char *argv[]) { _syscall(waitpid(pid, &status, 0)); _assert(WIFEXITED(status)); _assert(WEXITSTATUS(status) == 0); + + } } if (flag_p) |