Merge branch 'feat/dylib-resolution' into feat/dyld-shared-cache
This commit is contained in:
@@ -755,7 +755,13 @@ describe("conditional loads", () => {
|
|||||||
[VENDOR]: parsed(
|
[VENDOR]: parsed(
|
||||||
slice({
|
slice({
|
||||||
install_name: "@rpath/libvendor.dylib",
|
install_name: "@rpath/libvendor.dylib",
|
||||||
dependencies: [dependency("@loader_path/libgone.dylib")],
|
dependencies: [
|
||||||
|
dependency("@loader_path/libgone.dylib"),
|
||||||
|
dependency("@loader_path/libweak.dylib", { weak: true }),
|
||||||
|
dependency("@loader_path/liblazy.dylib", {
|
||||||
|
command: "LC_LAZY_LOAD_DYLIB",
|
||||||
|
}),
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
[OTHER]: parsed(
|
[OTHER]: parsed(
|
||||||
@@ -777,9 +783,14 @@ describe("conditional loads", () => {
|
|||||||
resolution: { status: "conditional", image: VENDOR },
|
resolution: { status: "conditional", image: VENDOR },
|
||||||
loader_conditional: false,
|
loader_conditional: false,
|
||||||
});
|
});
|
||||||
expect(
|
// Required, weak and lazy findings below the fallback are all qualified.
|
||||||
trace.findings.find(({ kind }) => kind === "required-load-unresolved")
|
for (const kind of [
|
||||||
?.explanation,
|
"required-load-unresolved",
|
||||||
).toContain(`${VENDOR} loads only conditionally`);
|
"weak-load-unresolved",
|
||||||
|
"lazy-load-unresolved",
|
||||||
|
])
|
||||||
|
expect(
|
||||||
|
trace.findings.find((finding) => finding.kind === kind)?.explanation,
|
||||||
|
).toContain(`${VENDOR} loads only conditionally; if it loads,`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -61,24 +61,27 @@ const unresolvedFinding = (edge: Edge, index: number): Finding => {
|
|||||||
image: edge.loader,
|
image: edge.loader,
|
||||||
basis: "derived",
|
basis: "derived",
|
||||||
} as const;
|
} as const;
|
||||||
|
const missing = `No candidate for ${edge.command === "LC_LAZY_LOAD_DYLIB" ? "lazily loaded " : edge.weak ? "weak dependency " : ""}${edge.install_name} exists in the analyzed root`;
|
||||||
|
// Below a conditional fallback, every consequence applies only if it loads.
|
||||||
|
const when = edge.loader_conditional
|
||||||
|
? `. ${edge.loader} loads only conditionally; if it loads, `
|
||||||
|
: "; ";
|
||||||
if (edge.command === "LC_LAZY_LOAD_DYLIB")
|
if (edge.command === "LC_LAZY_LOAD_DYLIB")
|
||||||
return {
|
return {
|
||||||
...base,
|
...base,
|
||||||
kind: "lazy-load-unresolved",
|
kind: "lazy-load-unresolved",
|
||||||
explanation: `No candidate for lazily loaded ${edge.install_name} exists in the analyzed root; dyld loads it on first use, which would fail unless the image is supplied elsewhere.`,
|
explanation: `${missing}${when}dyld loads it on first use, which would fail unless the image is supplied elsewhere.`,
|
||||||
};
|
};
|
||||||
return edge.weak
|
return edge.weak
|
||||||
? {
|
? {
|
||||||
...base,
|
...base,
|
||||||
kind: "weak-load-unresolved",
|
kind: "weak-load-unresolved",
|
||||||
explanation: `No candidate for weak dependency ${edge.install_name} exists in the analyzed root; dyld continues without it.`,
|
explanation: `${missing}${when}dyld continues without it.`,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
...base,
|
...base,
|
||||||
kind: "required-load-unresolved",
|
kind: "required-load-unresolved",
|
||||||
explanation: edge.loader_conditional
|
explanation: `${missing}${when}dyld would fail to launch ${edge.root} (${edge.architecture}) unless the image is supplied elsewhere.`,
|
||||||
? `No candidate for ${edge.install_name} exists in the analyzed root. ${edge.loader} loads only conditionally; if it loads, dyld would fail to launch ${edge.root} (${edge.architecture}) unless the image is supplied elsewhere.`
|
|
||||||
: `No candidate for ${edge.install_name} exists in the analyzed root; dyld would fail to launch ${edge.root} (${edge.architecture}) unless the image is supplied elsewhere.`,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user