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

feat: add missing i386 and x86_64h targets to tbd #439

Closed
wants to merge 2 commits into from

Conversation

t0rr3sp3dr0
Copy link
Contributor

@t0rr3sp3dr0 t0rr3sp3dr0 commented Apr 12, 2024

This patch adds the missing i386-macos, i386-maccatalyst, x86_64h-macos, and x86_64h-maccatalyst targets to TBD generation.

% head /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.B.tbd 
--- !tapi-tbd
tbd-version:     4
targets:         [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, 
                   arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]
install-name:    '/usr/lib/libSystem.B.dylib'
current-version: 1345.100.2
reexported-libraries:
  - targets:         [ i386-macos, i386-maccatalyst, x86_64-macos, x86_64-maccatalyst, 
                       arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]
    libraries:       [ '/usr/lib/system/libsystem_kernel.dylib', '/usr/lib/system/libsystem_platform.dylib', 
% head /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd 
--- !tapi-tbd
tbd-version:     4
targets:         [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, 
                   arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]
install-name:    '/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation'
current-version: 2420
compatibility-version: 150
reexported-libraries:
  - targets:         [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, 
                       arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]

@blacktop
Copy link
Owner

I believe that there's a small chance that if you generate from iOS it'll have symbols that don't exist on macOS /intel

@t0rr3sp3dr0 t0rr3sp3dr0 changed the title feat: add missing x86_64h targets to tbd feat: add missing i386 and x86_64h targets to tbd Apr 12, 2024
@t0rr3sp3dr0
Copy link
Contributor Author

That's true. Do we want to detect the platform based on the binary and generate the targets based on that? The downside of this is that using something like a DSC, it would only define the targets for that specific architecture.

@blacktop
Copy link
Owner

Also look at #409

@t0rr3sp3dr0
Copy link
Contributor Author

Another patch that I was planning to submit is to make the XCFramework support all platforms (ios-arm64, ios-arm64_x86_64-maccatalyst, ios-arm64_x86_64-simulator, macos-arm64_x86_64, tvos-arm64, tvos-arm64_x86_64-simulator, xros-arm64, xros-arm64_x86_64-simulator, etc.).

But that only makes sense if our goal is to produce a generic XCFramework, with no guarantee that all symbols will be available at runtime. This may be a problem, but at the same time is supper handy because you don't have to get binaries for all architectures and platforms, generate XCFWs for each of them, and finally merge them into a single XCFW.

@t0rr3sp3dr0
Copy link
Contributor Author

Will move the discussion there

@blacktop
Copy link
Owner

blacktop commented Apr 15, 2024

ipsw dsc info MACOS_DSC

Header
======
Magic          = "dyld_v1  arm64e"
Platform       = macOS
Alt Platform   = macCatalyst
OS Version     = 14.4
Alt OS Version = 17.4
Max Slide      = 0x20000000 (ASLR entropy: 15-bits, 512MB)
Num Images     = 2879
Num SubCaches  = 1

ipsw dsc info IOS_DSC

Header
======
Magic          = "dyld_v1  arm64e"
Platform       = iOS
OS Version     = 17.5
Max Slide      = 0x20000000 (ASLR entropy: 15-bits, 512MB)
Num Images     = 3429
Num SubCaches  = 58

I believe we can get the ARCH and "platform" from the DSC header so that might be good enough to determine what to include in the tbd

I think older DSCs might not have as much metadata about the platform so that'd be an edge case where maybe we'd just add them all etc?

blacktop added a commit that referenced this pull request Apr 27, 2024
@blacktop
Copy link
Owner

I believe we can close this PR based on the commit mentioned.

@blacktop blacktop closed this Apr 27, 2024
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.

2 participants