feat(native): decode chained fixups, binds, ObjC categories and properties

inspect_native_dispatch_metadata read pointer fields as stored bytes, so
chained-fixup images (the default since Xcode 13) decoded no classes, and
superclasses from other images were always unresolved.

- Decode LC_DYLD_CHAINED_FIXUPS pointer formats 64, 64_OFFSET, ARM64E,
  ARM64E_USERLAND and ARM64E_USERLAND24 with import formats 1-3, and
  interpret LC_DYLD_INFO bind, weak-bind and lazy-bind opcode streams.
- Name external superclasses from their _OBJC_CLASS_$_ binds.
- Decode class_ro_t baseProperties and __objc_catlist category_t records
  (instance/class methods, protocols, properties) into objc_categories;
  category methods carry their category name.
- Report the fixup encoding in a pointer_fixups coverage facet.
- verify:apple-dispatch builds the fixture with dyld-info and chained
  fixups, plus arm64e on Apple silicon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-07 12:18:24 +00:00
co-authored by Claude Opus 5.5
parent dda8e6a728
commit 3e24a72465
19 changed files with 1464 additions and 239 deletions
+8 -2
View File
@@ -6,7 +6,12 @@ export const createObjcProtocolReader = (input: {
readers: Pick<
SwiftMetadataReaders,
"u32" | "string" | "location" | "evidence" | "admit"
> & { pointer(address: bigint): bigint; i32(address: bigint): number };
> & {
pointer(address: bigint): bigint;
/** Plain 64-bit data, never a fixup. */
u64(address: bigint): bigint;
i32(address: bigint): number;
};
result: ObjcSwiftMetadata;
failures: string[];
}) => {
@@ -15,7 +20,8 @@ export const createObjcProtocolReader = (input: {
const name = (address: bigint) => read.string(read.pointer(address + 8n));
const list = (address: bigint): string[] => {
if (address === 0n) return [];
const count = read.pointer(address);
// `count` is plain uintptr_t data, not a pointer fixup.
const count = read.u64(address);
if (count > 20000n)
throw new RangeError("Protocol list exceeds 20000 entries");
const names: string[] = [];