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

Roll clang with fix for ABI change #44711

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

zanderso
Copy link
Member

@zanderso zanderso commented Aug 15, 2023

In the change here llvm/llvm-project@b653a28, an intentional ABI breaking change was introduced to the clang runtime library for macOS and iOS. That change caused a symbol requiring dynamic linkage to be exposed that triggers iOS App Store checks for usage of private API.

This PR resolves that issue by rolling clang forward and introducing a definition of _availability_version_check. The declaration with weak linkage in the clang runtime library here will then be resolved against the definition introduced in this PR. Since the declaration in the clang runtime library will now be resolved by static linking, the Flutter dylib will no longer require it to be dynamically linked, and will therefore not trigger the App Store check for using private API.

The definition of _availability_version_check is implemented using the dlsym strategy used by the old version of clang here.

Fixes flutter/flutter#132130

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@zanderso
Copy link
Member Author

@dnfield A trial app with this fix made it through to testflight, so I think we're good to go.

@@ -0,0 +1,42 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment somewhere about why we need this and what it's doing.

Copy link
Member Author

Choose a reason for hiding this comment

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

D'oh! I added the comments below locally, and then forgot to upload them...

Copy link
Contributor

@dnfield dnfield 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 the comment so we can remember this

@zanderso zanderso force-pushed the roll-clang-with-fix branch from 57ea3f3 to 88e3837 Compare August 23, 2023 21:57
@zanderso zanderso added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 23, 2023
@auto-submit auto-submit bot merged commit f2cb42a into flutter:main Aug 23, 2023
@zanderso zanderso deleted the roll-clang-with-fix branch August 23, 2023 22:38
bdero added a commit that referenced this pull request Aug 23, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 24, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 24, 2023
…133220)

flutter/engine@67e8b82...aa98a9d

2023-08-24 dnfield@google.com [Impeller] Fix stencil buffer format selection on Vulkan backend, add support for D24UnormS8Uint (flutter/engine#45025)
2023-08-24 jason-simmons@users.noreply.github.com Fix a clang-tidy error seen in the latest toolchain roll (flutter/engine#45039)
2023-08-23 skia-flutter-autoroll@skia.org Roll Skia from a631fefdba37 to 9d4db3443527 (1 revision) (flutter/engine#45031)
2023-08-23 zanderso@users.noreply.github.com Roll clang with fix for ABI change (flutter/engine#44711)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jimgraham@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
In the change here llvm/llvm-project@b653a28, an intentional ABI breaking change was introduced to the clang runtime library for macOS and iOS. That change caused a symbol requiring dynamic linkage to be exposed that triggers iOS App Store checks for usage of private API.

This PR resolves that issue by rolling clang forward and introducing a definition of `_availability_version_check`. The declaration with weak linkage in the clang runtime library [here](https://github.com/llvm/llvm-project/blob/b653a2823fe4b4c9c6d85cfe119f31d8e70c2fa0/compiler-rt/lib/builtins/os_version_check.c#L89) will then be resolved against the definition introduced in this PR. Since the declaration in the clang runtime library will now be resolved by static linking, the Flutter dylib will no longer require it to be dynamically linked, and will therefore not trigger the App Store check for using private API.

The definition of `_availability_version_check` is implemented using the `dlsym` strategy used by the old version of clang [here](https://github.com/llvm/llvm-project/blob/f9ac5575675e4117c2e097a71ad0f02cab92aa97/compiler-rt/lib/builtins/os_version_check.c#L97).

Fixes flutter/flutter#132130
zanderso added a commit that referenced this pull request Dec 11, 2023
This PR ports more of the implementation of availability checking from
clang-rt into the Engine. In particular, when the call to look up the
symbol `_availability_version_check` fails, this PR falls back on
reading the platform version information out of a plist file at a
well-known location, as is done
[here](https://github.com/llvm/llvm-project/blob/2fd66e6eb659701b9d4c88708d55d5854a246815/compiler-rt/lib/builtins/os_version_check.c#L163).

This change fixes a mistake in
#44711, which didn't account for
`_availability_version_check` not being available on iOS 11 and 12.

Fixes flutter/flutter#138711
zanderso added a commit to zanderso/engine that referenced this pull request Dec 12, 2023
This PR ports more of the implementation of availability checking from
clang-rt into the Engine. In particular, when the call to look up the
symbol `_availability_version_check` fails, this PR falls back on
reading the platform version information out of a plist file at a
well-known location, as is done
[here](https://github.com/llvm/llvm-project/blob/2fd66e6eb659701b9d4c88708d55d5854a246815/compiler-rt/lib/builtins/os_version_check.c#L163).

This change fixes a mistake in
flutter#44711, which didn't account for
`_availability_version_check` not being available on iOS 11 and 12.

Fixes flutter/flutter#138711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: desktop autosubmit Merge PR when tree becomes green via auto submit App platform-ios platform-macos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clang -> Engine roll blocked
2 participants