Skip to content
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

zig ld: ability to link tbds on macOS #8935

Closed
kubkon opened this issue May 29, 2021 · 4 comments · Fixed by #9171
Closed

zig ld: ability to link tbds on macOS #8935

kubkon opened this issue May 29, 2021 · 4 comments · Fixed by #9171
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. linking os-macos
Milestone

Comments

@kubkon
Copy link
Member

kubkon commented May 29, 2021

Currently, zig ld can successfully link object files .o, static libraries .a, and (limited to no re-exports) dynamic libraries .dylib. However, starting with macOS 11 aka BigSur, no actual system dynamic libraries are available for browsing on the filesystem (well, they are available somewhere in the dyld's global cache). Instead, the linker is supposed to use the so-called text-based definition files .tbds which are compact representation of the symbol tables found within the actual dynamic library and its re-exports. zig ld cannot link tbds yet and they are required if anyone wants to build stage2 with Homebrew's Zig and/or LLVM since LLVM is built with system libxml2 (which is only available as a tbd on recent macOS).

@kubkon kubkon added enhancement Solving this issue will likely involve adding new logic or components to the codebase. os-macos linking labels May 29, 2021
@kubkon kubkon modified the milestones: 0.9.0, 0.8.0 May 29, 2021
@kubkon
Copy link
Member Author

kubkon commented May 29, 2021

Hmm, I might try adding some prelim support for this for 0.8.0. If I made it before we cut the release, we'd have a fully functional Zig binary available via Homebrew.

@mikdusan
Copy link
Member

some background that may help...

  • docs from latest tapi-1100.0.11 library: here
  • when tbd appeared:
version SDK note
4 11.0 Big Sur
3 10.13 High Sierra, ~4 years ago
2 10.12 Sierra, ~ 5 years ago
1 10.10 Yosemite, ~7 years ago
  • and this indication that tapi-12.0.23 is coming:

image

@mikdusan
Copy link
Member

Looking distantly into the future, perhaps .tbd files could be used by zig linkers for other formats to cross-link; it feels like a better solution than hacking stub .so files.

@kubkon
Copy link
Member Author

kubkon commented May 31, 2021

Since there's quite a bit of work involved in adding this in including a yaml parser, I'm moving this into 0.9.0 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. linking os-macos
Projects
None yet
2 participants