-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[release/7.0] Disable objc_msgSend stubs in clang for compatibility with Xcode 13 #91117
[release/7.0] Disable objc_msgSend stubs in clang for compatibility with Xcode 13 #91117
Conversation
…ith Xcode 13 Backport of dotnet#89932 and dotnet#90217 to release/7.0
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos Issue DetailsBackport of #89932 and #90217 to release/7.0 Customer ImpactAs soon as we're updating the macOS build machine image used to build dotnet/runtime to one that uses Xcode 14 the native build of Objective-C code will start emitting objc_msgSend stubs. This causes the native libraries to fail during linking with the linker in Xcode 13, effectively preventing Mac/iOS/tvOS apps from working. Note that this can happen automatically if AzDO updates the macOS build images. The fix is to disable the objc_msgSend stubs via a compiler flag, following what xamarin-macios did a while ago: xamarin/xamarin-macios#16231 TestingCI and local testing RiskLow. The PR adds an additional compiler flag to every .m Objective-C file to prevent the new Xcode 14 behavior.
|
if(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_MACCATALYST OR CLR_CMAKE_HOST_IOS OR CLR_CMAKE_HOST_TVOS) | ||
# Clang will by default emit objc_msgSend stubs in Xcode 14, which ld from earlier Xcodes doesn't understand. | ||
# We disable this by passing -fno-objc-msgsend-selector-stubs to clang. | ||
# We can probably remove this flag once we require developers to use Xcode 14. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my knowledge - Do we have any documentation highlighting minimum supported Xcode versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found https://learn.microsoft.com/en-us/xamarin/cross-platform/get-started/requirements#macos-requirements but that seems to be a bit outdated and doesn't really mention the Xcode version directly.
The code seems to check for Xcode 6.0 but that is probably way older than is reasonable:
https://github.com/rolfbjarne/xamarin-macios/blob/577af1046738e919e15962b917e065f5589366ef/tools/mtouch/mtouch.cs#L123
Approved by tactics over email. Failures are known issues. |
483490d
into
dotnet:release/7.0-staging
Backport of #89932 and #90217 to release/7.0
Customer Impact
As soon as we're updating the macOS build machine image used to build dotnet/runtime to one that uses Xcode 14 the native build of Objective-C code will start emitting objc_msgSend stubs. This causes the native libraries to fail during linking with the linker in Xcode 13, effectively preventing Mac/iOS/tvOS apps from working. Note that this can happen automatically if AzDO updates the macOS build images.
The fix is to disable the objc_msgSend stubs via a compiler flag, following what xamarin-macios did a while ago: xamarin/xamarin-macios#16231
Testing
CI and local testing
Risk
Low. The PR adds an additional compiler flag to every .m Objective-C file to prevent the new Xcode 14 behavior.