Skip to content

Conversation

@bdash
Copy link
Contributor

@bdash bdash commented Oct 21, 2025

The parsing of fix-up chains is moved out of MachoView and into its own class. It deals purely in terms of offsets into the Mach-O slice. MachoView translates those offsets to mapped addresses when needed.

This is primarily aimed at fixing incorrect handling of pointer formats that use offsets where in some cases the relocations would be applied at incorrect addresses due to confusion between file offsets, Mach-O slice offsets, and VM offsets.

It incidentally fixes addends from bind operations not being respected. These show up most frequently in C++ RTTI information.

The chained fix-up parser contains a #define to enable it to produce debug output in the same format as dyld_info -fixup_chain_details to make it easy to cross-check parsing against Apple's implementation.

Fixes #7421.

The parsing of fix-up chains is moved out of `MachoView` and into its
own class. It deals purely in terms of offsets into the Mach-O slice.
`MachoView` translates those offsets to mapped addresses when needed.

This is primarily aimed at fixing incorrect handling of pointer formats
that use offsets where in some cases the relocations would be applied at
incorrect addresses due to confusion between file offsets, Mach-O slice
offsets, and VM offsets.

It incidentally fixes addends from bind operations not being respected.
These show up most frequently in C++ RTTI information.
@bdash bdash force-pushed the macho-fixup-chains branch from 3b00d9e to 2f531f7 Compare October 22, 2025 16:42
@bdash bdash merged commit 2f531f7 into dev Oct 22, 2025
5 checks passed
@bdash bdash deleted the macho-fixup-chains branch October 22, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MachO] Obj-C metadata errors due to incorrect handling of some chained fixups

2 participants