forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Roll clang with fix for ABI change (flutter#44711)
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
- Loading branch information
Showing
5 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
shell/platform/darwin/common/availability_version_check.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include <dispatch/dispatch.h> | ||
#include <dlfcn.h> | ||
#include <cstdint> | ||
|
||
#include "flutter/fml/logging.h" | ||
|
||
// See context in https://github.com/flutter/flutter/issues/132130 and | ||
// https://github.com/flutter/engine/pull/44711. | ||
|
||
// TODO(zanderso): Remove this after Clang 18 rolls into Xcode. | ||
// https://github.com/flutter/flutter/issues/133203 | ||
|
||
namespace { | ||
|
||
typedef uint32_t dyld_platform_t; | ||
|
||
typedef struct { | ||
dyld_platform_t platform; | ||
uint32_t version; | ||
} dyld_build_version_t; | ||
|
||
typedef bool (*AvailabilityVersionCheckFn)(uint32_t count, | ||
dyld_build_version_t versions[]); | ||
|
||
AvailabilityVersionCheckFn AvailabilityVersionCheck; | ||
|
||
dispatch_once_t DispatchOnceCounter; | ||
|
||
void InitializeAvailabilityCheck(void* unused) { | ||
if (AvailabilityVersionCheck) { | ||
return; | ||
} | ||
AvailabilityVersionCheck = reinterpret_cast<AvailabilityVersionCheckFn>( | ||
dlsym(RTLD_DEFAULT, "_availability_version_check")); | ||
FML_CHECK(AvailabilityVersionCheck); | ||
} | ||
|
||
extern "C" bool _availability_version_check(uint32_t count, | ||
dyld_build_version_t versions[]) { | ||
dispatch_once_f(&DispatchOnceCounter, NULL, InitializeAvailabilityCheck); | ||
return AvailabilityVersionCheck(count, versions); | ||
} | ||
|
||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters