Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2025

Conversation

0cyn
Copy link
Member

@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
{
BNRelocationInfo info;
std::string name;
int8_t ordinal;
Copy link
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
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.
2 participants