Skip to content

Provide a minimum OS version for MachO objects - #8323

Merged
alexreinking merged 2 commits into
mainfrom
issues/7941-macho-warnings
Jun 25, 2024
Merged

Provide a minimum OS version for MachO objects#8323
alexreinking merged 2 commits into
mainfrom
issues/7941-macho-warnings

Conversation

@alexreinking

Copy link
Copy Markdown
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

@steven-johnson steven-johnson left a comment

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.

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

@alexreinking
alexreinking force-pushed the issues/7941-macho-warnings branch from 09de11e to e4d7c75 Compare June 25, 2024 17:22
@alexreinking

Copy link
Copy Markdown
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
alexreinking force-pushed the issues/7941-macho-warnings branch from e4d7c75 to 6cb4d84 Compare June 25, 2024 17:45
@alexreinking

Copy link
Copy Markdown
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
@alexreinking
alexreinking deleted the issues/7941-macho-warnings branch June 26, 2024 13:08
@steven-johnson

Copy link
Copy Markdown
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

vksnk commented Jul 9, 2024

Copy link
Copy Markdown
Member

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
Copy Markdown
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