summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2012-09-06 19:14:58 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2012-09-06 19:14:58 -0700
commit4f4aa9c37a0c26908cafbc5ef58c94814d153415 (patch)
tree3579787fa49c816cd9484d5d9bab173ab4190090
parentbf29b0fecdb4e450107e1b304221b08339906aa5 (diff)
downloadldid-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.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/ldid.cpp b/ldid.cpp
index 6250a7d..3845e2c 100644
--- a/ldid.cpp
+++ b/ldid.cpp
@@ -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)