feat(android): link native declarations to static JNI candidates (#7472)

Link original DEX native declarations to per-ABI function exports and relocated static JNI table candidates through shared CLI/MCP workflows. Preserve global attribution ambiguity, exact provenance, partial coverage and retained Evidence; default MCP delivery to bounded summaries with filtered/batch pages.

Use one immutable ELF relocation decoder with streaming IL2CPP materialization, cooperative bounded export/version parsing and bounded JNI state. Reuse validated session inventories without loading target libraries or executing JNI code.

Validation: relevant type/lint/build and parser/domain/public CLI/MCP regressions; genuine four-ABI NDK fixtures and independent library/slot oracles; actual JDK/JADX Conscrypt workflows with retained-source removal. Full measurements and limitations are recorded in docs/verification/android-jni-bindings-2026-10-27.md.

Closes #6403.
This commit is contained in:
gensokyo-dev
2026-10-27 18:53:22 +08:00
committed by GitHub
parent 740c0f5615
commit 570abe95f2
60 changed files with 8414 additions and 330 deletions
@@ -18,6 +18,7 @@ import {
} from "../../../src/il2cpp/Il2cppBinaryGenerics.js";
import {
createElfFixture,
createLargeElfRelativeFixture,
createIl2cppBinaryFixture,
createIl2cppDyldBindFixture,
createIl2cppRegistrationTailFixture,
@@ -906,6 +907,19 @@ it("links an ELF shared object after applying its RELATIVE relocations", () => {
expect(link(elf)).toEqual({ ...fromMacho, format: "elf" });
});
it.each([183, 62])(
"streams more than 65536 file-backed relative writes without shrinking IL2CPP capacity (machine %s)",
(machine) => {
const source = createIl2cppBinaryFixture();
const bytes = createLargeElfRelativeFixture(source, 65_537, machine);
const snapshot = Buffer.from(bytes);
expect(link(bytes).method_addresses).toEqual(
link(createElfFixture(source, { machine })).method_addresses,
);
expect(bytes.equals(snapshot)).toBe(true);
},
);
it.each([183, 62])(
"links ELF relocations using the resolved PN_XNUM program count (machine %s)",
(machine) => {