Files
reverse-engineering-anything/src/il2cpp/Il2cppBinaryFormat.ts
T
8052f8daf0 fix(elf): preserve virtual relocation identity (#9990)
* fix(elf): keep compressed storage out of decoded metadata facts

* fix(elf): preserve virtual relocation identity

Keep linked initializer backing and relocation values in their owning virtual
or ET_REL section coordinates. Replace the IL2CPP physical-copy materializer
with compact virtual value facts while preserving file-backed capacity.

Reuse initializer repairs and original regressions from ShuaixinHuang PRs
repair retains independent alias values instead of blanket alias refusal.

Co-authored-by: 帅鑫 Huang <1836656514@qq.com>

* fix(elf): admit compressed string tables the profile does not read

SHF_COMPRESSED string tables are rejected only when they name sections
or symbols. An unreferenced string table is not decoded, so it no longer
makes an otherwise analyzable ELF unsupported.

* fix(il2cpp): admit virtual pointer workspace before retention

* fix(elf): reject null relocation target sections

* fix(il2cpp): avoid decoding unrelated Mach-O words

* fix(il2cpp): preserve uncertainty in candidate scans

* fix(il2cpp): bound uncertain array candidates

* fix(il2cpp): preserve unknown registration candidates

* fix(il2cpp): classify type kinds before bound data

* fix(il2cpp): bind candidate counts to matching names

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: 帅鑫 Huang <1836656514@qq.com>
2026-11-11 18:13:18 +08:00

56 lines
1.7 KiB
TypeScript

/** Existing selected-binary allowance also bounds its retained pointer workspace. */
export const IL2CPP_BINARY_BYTES = 1024 * 1024 * 1024;
export const IL2CPP_BINARY_FAILURE_REASONS = {
unsupported: [
"unsupported-container",
"slice-selection-required",
"slice-not-found",
"ambiguous-slice-selection",
"unsupported-pointer-encoding",
"unsupported-type-kind",
"generic-methods-unsupported",
],
capacity: [
"native-index-capacity",
"type-nesting-capacity",
"native-type-text-capacity",
],
malformed: [
"malformed-container",
"code-gen-modules-not-found",
"ambiguous-code-gen-module",
"code-registration-not-found",
"invalid-method-pointer",
"invalid-method-token",
"metadata-registration-not-found",
"invalid-type",
"generic-method-registration-not-found",
"ambiguous-generic-method-registration",
],
} as const;
export type Il2cppBinaryFailureReason =
(typeof IL2CPP_BINARY_FAILURE_REASONS)[keyof typeof IL2CPP_BINARY_FAILURE_REASONS][number];
/** A native image REA cannot link, either outside coverage or inconsistent with the metadata. */
export class Il2cppBinaryFormatFailure extends Error {
readonly kind: "unsupported" | "malformed" | "capacity";
constructor(
readonly reason: Il2cppBinaryFailureReason,
message: string,
) {
super(`${reason}: ${message}`);
this.name = "Il2cppBinaryFormatFailure";
this.kind = (
IL2CPP_BINARY_FAILURE_REASONS.unsupported as readonly string[]
).includes(reason)
? "unsupported"
: (IL2CPP_BINARY_FAILURE_REASONS.capacity as readonly string[]).includes(
reason,
)
? "capacity"
: "malformed";
}
}