This is an archive of the discontinued LLVM Phabricator instance.

[darwin] Declare _availability_version_check as weak_import instead of looking it up at runtime using dlsym
ClosedPublic

Authored by ahatanak on May 11 2023, 2:01 PM.

Details

Summary

Calling dlsym with RTLD_DEFAULT can be very slow as all images in the process are searched for the symbol.

Diff Detail

Event Timeline

ahatanak created this revision.May 11 2023, 2:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2023, 2:01 PM
Herald added a subscriber: Enna1. · View Herald Transcript
ahatanak requested review of this revision.May 11 2023, 2:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2023, 2:01 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
pete accepted this revision.May 11 2023, 2:02 PM

LGTM! Thanks for doing this.

This revision is now accepted and ready to land.May 11 2023, 2:02 PM
This revision was landed with ongoing or failed builds.May 11 2023, 5:23 PM
This revision was automatically updated to reflect the committed changes.
phosek added a subscriber: phosek.Aug 7 2023, 9:52 AM

After this change, Apple App Store is rejecting Flutter apps with the following error message:

ITMS-90338: Non-public API usage - The app references non-public symbols in Frameworks/Flutter.framework/Flutter: __availability_version_check

I can confirm that this change results in undefined __availability_version_check symbol:

$ nm Flutter.xcframework/ios-arm64/Flutter.framework/Flutter | grep __availability_version_check
                 U __availability_version_check

Is that intentional? Does App Store need to be updated? Would it be possible to revert this change in the meantime?

phosek added a comment.Aug 9 2023, 1:01 PM

@ahatanak Ping, would it be possible to take a look?

We are currently investigating this issue.

Are you (Flutter) using your custom toolchain based on ToT instead of the current shipping Xcode toolchain to build the app?

phosek added a comment.Aug 9 2023, 1:58 PM

We are currently investigating this issue.

Thanks for taking a look!

Are you (Flutter) using your custom toolchain based on ToT instead of the current shipping Xcode toolchain to build the app?

Yes, we use our Clang toolchain that tracks tip-of-tree.

zixuw added a subscriber: zixuw.Aug 14 2023, 12:52 PM

We are currently investigating this issue.

Thanks for taking a look!

Are you (Flutter) using your custom toolchain based on ToT instead of the current shipping Xcode toolchain to build the app?

Yes, we use our Clang toolchain that tracks tip-of-tree.

Hi @phosek!
App Store only supports currently shipping Xcode toolchains. For clients building Apps with the current non-beta Xcode and submitting to the App Store, the Flutter framework needs to be built and distributed with the current Xcode.

Flutter builds Flutter.framework with a ToT clang toolchain. We've been doing that for a few years now.

End users building applications to submit to the store package a pre-built Flutter.framework using Xcode.

I'm realizing I wasn't quite right on that.

Flutter _used_ to routinely build the dylib using some non-Xcode version of Clang for a while. We then switched to Xcode to make sure we could have compatible bitcode when building with an Xcode toolchain, but I think only for binaries that could end up being shipped to the store. Sometime since the store dropped bitcode support, we went back to using upstream Clang. This enables us avoid the need to support multiple Clang toolchains in our build, and in particular we can use a distributed compiler backend when using this version of Clang that we can't use when using Xcode.

Hixie added a subscriber: Hixie.Aug 16 2023, 11:21 AM