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

Provide a minimum OS version for MachO objects #8323

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

alexreinking
Copy link
Member

This gives LLVM enough information to generate a "platform load-command" in the MachO object file.

Frustratingly, there is not a simple API that sets this directly; it must be passed in the os name.

Fixes #7941

@alexreinking alexreinking marked this pull request as ready for review June 25, 2024 17:17
Copy link
Contributor

@steven-johnson steven-johnson left a comment

Choose a reason for hiding this comment

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

LGTM but please add a comment echoing the info in the PR description.

@alexreinking
Copy link
Member Author

Done! As I'm thinking about this, we should probably do something similar for iOS

This gives LLVM enough information to generate a
"platform load-command" in the object file.

Fixes #7941
@alexreinking
Copy link
Member Author

@steven-johnson -- I changed the approach to use the LLVM-computed minimum compatible version (e.g. 11 on macOS/ARM). This should generalize to iOS, watchOS, tvOS, etc.

@alexreinking alexreinking changed the title Provide a minimum OS version (11) for ARM/macOS Provide a minimum OS version for MachO objects Jun 25, 2024
@alexreinking alexreinking merged commit 9b703f3 into main Jun 25, 2024
19 checks passed
@alexreinking alexreinking deleted the issues/7941-macho-warnings branch June 26, 2024 13:08
@steven-johnson
Copy link
Contributor

I think this may have injected a link error in google when building for the iOS Simulator (which is not considered macOS by the linker), but I don't have time to diagnose before leaving for vacation -- hoping @vksnk can look at it next week

@vksnk
Copy link
Member

vksnk commented Jul 9, 2024

Yes, can confirm this is causing a link error like:

ld64.lld: error: _some_binary_name_ has platform macOS, which is different from target platform iOS Simulator

@alexreinking
Copy link
Member Author

Yes, can confirm this is causing a link error like:

ld64.lld: error: _some_binary_name_ has platform macOS, which is different from target platform iOS Simulator

Well, that is vexing... can you try printing the LLVM target's OSName before and after the snippet here that injects the version information? I wonder if iOS is somehow being clobbered into macOS?

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.

[macos] XCode 15 issues warnings for object files when linking
3 participants