refactor: consolidate ELF and CLR record interpretation

Share ELF note headers across note inspection, Flutter build IDs, Node SEA,
and recorded-crash source binding. Decode REL/RELA records once for MIPS
shared-load analysis and IL2CPP linking, removing superseded scalar helpers.

Share the CLR header prefix between desktop detection and managed PE parsing
while preserving their distinct read bounds and admission policies. Cover
those differences and ignored R_NONE fields with production-boundary tests.

Validation: 493 focused tests passed, two existing skips; static checks and
test discovery passed. Public managed/desktop CLI and ELF notes CLI/MCP
workflows exercised; no real external analysis providers were run.
This commit is contained in:
morluto committed 2026-10-26 16:50:08 +08:00
1 parent eb51eb6915
commit a7f50e3386
16 files changed
+382 -37

No files matched your search

@@ -1840,3 +1840,20 @@ it.each([0n, FIXTURE_BINARY_BASE + 0x980n, FIXTURE_BINARY_BASE + 0x9b0n])(
expect(bytes.readBigUInt64LE(0x900)).toBe(raw);
},
);
it.each([183, 62])(
"ignores R_NONE target and addend before relocation application (machine %s)",
(machine) => {
const image = createIl2cppBinaryFixture();
const bytes = createElfFixture(image, {
machine,
unresolvedRelocations: [{ offset: 0x7fffffff, kind: 0 }],
});
const dynamic = Number(bytes.readBigUInt64LE(128));
const relocationBytes = Number(bytes.readBigUInt64LE(dynamic + 24));
const last = 0x1000 + relocationBytes - 24;
bytes.writeBigUInt64LE(0xffffffffffffffffn, last);
bytes.writeBigInt64LE(-0x8000000000000000n, last + 16);
expect(link(bytes)).toEqual(link(createElfFixture(image, { machine })));
},
);