fix(native): retain lazy dylibs, normalize version-min builds, limit thread entrypoints (#532)

This commit is contained in:
morluto
2026-10-05 15:23:08 +08:00
committed by GitHub
parent 9e30d93af3
commit 0f77ada55e
3 changed files with 112 additions and 8 deletions
+9
View File
@@ -114,6 +114,15 @@ const normalizeMacho = (
]
: []),
...additionalLimitations,
...(load.entrypoints.length === 0 &&
load.commands.some(
(command) =>
command.kind === "LC_UNIXTHREAD" || command.kind === "LC_THREAD",
)
? [
"Thread-state entrypoints (LC_UNIXTHREAD/LC_THREAD) are retained as raw load commands; file offsets are not derived.",
]
: []),
...(imageBase === null &&
/^\s*offset\s+symbol\s*$/mu.test(byTool("dyld_info", 1).stdout)
? [
+18 -8
View File
@@ -125,13 +125,22 @@ const collectBuild = (
fields: Readonly<Record<string, string | number | null>>,
state: ParsedLoadCommands,
): void => {
if (kind !== "LC_BUILD_VERSION") return;
state.builds.push({
platform: stringField(fields, "platform"),
minimum_os: stringField(fields, "minos"),
sdk: stringField(fields, "sdk"),
tools: parseBuildTools(block),
});
if (kind === "LC_BUILD_VERSION") {
state.builds.push({
platform: stringField(fields, "platform"),
minimum_os: stringField(fields, "minos"),
sdk: stringField(fields, "sdk"),
tools: parseBuildTools(block),
});
return;
}
if (kind.startsWith("LC_VERSION_MIN_"))
state.builds.push({
platform: kind.slice("LC_VERSION_MIN_".length) || null,
minimum_os: stringField(fields, "version"),
sdk: stringField(fields, "sdk"),
tools: [],
});
};
const collectDependency = (
@@ -142,7 +151,8 @@ const collectDependency = (
if (
!kind.startsWith("LC_LOAD_") &&
kind !== "LC_ID_DYLIB" &&
kind !== "LC_REEXPORT_DYLIB"
kind !== "LC_REEXPORT_DYLIB" &&
kind !== "LC_LAZY_LOAD_DYLIB"
)
return;
state.dependencies.push({