Skip to content

[Mach-O] Handling for special library ordinals used in binding information#7078

Merged
0cyn merged 1 commit into
devfrom
chainedfixup_issues_6878
Jul 14, 2025
Merged

[Mach-O] Handling for special library ordinals used in binding information#7078
0cyn merged 1 commit into
devfrom
chainedfixup_issues_6878

Conversation

@0cyn
Copy link
Copy Markdown
Contributor

@0cyn 0cyn commented Jul 11, 2025

Adds handling for "BIND_SPECIAL_DYLIB_SELF" and related special library ordinals that influence symbol lookup when processing binding information.

External Info:
dyld - Symbol Lookup

Resolves #6878

@0cyn 0cyn requested a review from bdash July 11, 2025 18:50
Comment thread view/macho/machoview.h Outdated
{
BNRelocationInfo info;
std::string name;
int8_t ordinal;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be a larger type:

mrowe@quicksilver:~$ rg -B 2 lib_ordinal $(xcrun --show-sdk-path)/usr
/Applications/Xcode-16.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach-o/fixup-chains.h
301-struct dyld_chained_import
302-{
303:    uint32_t    lib_ordinal :  8,   // -15 .. 240 (0xF1 .. 0xF0)
--
309-struct dyld_chained_import_addend
310-{
311:    uint32_t    lib_ordinal :  8,   // -15 .. 240 (0xF1 .. 0xF0)
--
318-struct dyld_chained_import_addend64
319-{
320:    uint64_t    lib_ordinal : 16,   // -15 .. 65520 (0xFFF1 .. 0xFFF0)

@0cyn 0cyn force-pushed the chainedfixup_issues_6878 branch from 76003da to be9b667 Compare July 14, 2025 14:46
@0cyn 0cyn force-pushed the chainedfixup_issues_6878 branch from be9b667 to 2b3ce70 Compare July 14, 2025 15:49
@0cyn 0cyn merged commit 2b3ce70 into dev Jul 14, 2025
1 check passed
@0cyn 0cyn deleted the chainedfixup_issues_6878 branch July 16, 2025 18:25
@emesare emesare added this to the Helion milestone Jul 23, 2025
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.

BIND_SPECIAL_DYLIB_SELF (and related special library ordinals) not handled correctly.

3 participants