From b6f2aa702e2a9cf908018a2fe1596fa56b493333 Mon Sep 17 00:00:00 2001 From: Andrew Druk Date: Sat, 14 Dec 2024 12:29:58 +0200 Subject: [PATCH] Dev: add syntax patch Cleanup other branches patches --- build/Linux/020-clone-swift.sh | 13 +- ...-dynamic-for-linux.-At-parsing-stage.patch | 92 ----- ...arch-form-build-script-to-build-scri.patch | 78 ---- .../5.10/swift/0005-Disable-all-tests.patch | 35 -- .../5.10/swift/0006-Enable-libdispatch.patch | 13 - .../0001-nfc-Fix-missing-include.patch | 24 -- ...nnecessary-fatal-error-in-networking.patch | 26 -- ...DEFAULT_THREAD_POOL_SIZE-env-variabl.patch | 56 --- ...wfe-based-spin-lock-on-android-armv7.patch | 25 -- ...-dynamic-for-linux.-At-parsing-stage.patch | 108 ------ ...2-Add-presets-for-android-x86-x86_64.patch | 54 --- ...d-config.target_swift_api_extract-fo.patch | 32 -- .../0005-Fix-spelling-arm_dir-icu_dir.patch | 25 -- ...ording-to-https-github.aaakk.us.kg-apple-swi.patch | 26 -- ...roid-x86_64-and-x86-compile-and-test.patch | 364 ------------------ ...e-swift-core-against-libatomic-linux.patch | 24 -- ...9- Disable-pre-specialization-of-x86.patch | 13 - ...rash-report-client-for-all-platforms.patch | 86 ----- ...DEFAULT_THREAD_POOL_SIZE-env-variabl.patch | 56 --- ...-dynamic-for-linux.-At-parsing-stage.patch | 108 ------ ...2-Add-presets-for-android-x86-x86_64.patch | 35 -- ...arch-form-build-script-to-build-scri.patch | 78 ---- .../0004-Fix-spelling-arm_dir-icu_dir.patch | 25 -- .../5.7/swift/0005-Disable-all-tests.patch | 35 -- ...ording-to-https-github.aaakk.us.kg-apple-swi.patch | 26 -- .../swift/0007-Update-to-LTS-NDK-25b.patch | 43 --- ...008-Enable-crashlytics-and-build-ids.patch | 271 ------------- ...DEFAULT_THREAD_POOL_SIZE-env-variabl.patch | 56 --- ...2-Add-presets-for-android-x86-x86_64.patch | 35 -- ...arch-form-build-script-to-build-scri.patch | 78 ---- .../0004-Fix-spelling-arm_dir-icu_dir.patch | 25 -- ...DEFAULT_THREAD_POOL_SIZE-env-variabl.patch | 0 .../0001-Add-Android-import.patch | 13 + ...-dynamic-for-linux.-At-parsing-stage.patch | 0 ...2-Add-presets-for-android-x86-x86_64.patch | 0 ...arch-form-build-script-to-build-scri.patch | 0 .../0004-Fix-spelling-arm_dir-icu_dir.patch | 0 .../swift/0005-Disable-all-tests.patch | 0 38 files changed, 18 insertions(+), 1960 deletions(-) delete mode 100644 patches/release/5.10/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch delete mode 100644 patches/release/5.10/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch delete mode 100644 patches/release/5.10/swift/0005-Disable-all-tests.patch delete mode 100644 patches/release/5.10/swift/0006-Enable-libdispatch.patch delete mode 100644 patches/release/5.4/llvm-project/0001-nfc-Fix-missing-include.patch delete mode 100644 patches/release/5.4/swift-corelibs-foundation/0001-unnecessary-fatal-error-in-networking.patch delete mode 100644 patches/release/5.4/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch delete mode 100644 patches/release/5.4/swift-corelibs-libdispatch/0002-Dint-use-wfe-based-spin-lock-on-android-armv7.patch delete mode 100644 patches/release/5.4/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch delete mode 100644 patches/release/5.4/swift/0002-Add-presets-for-android-x86-x86_64.patch delete mode 100644 patches/release/5.4/swift/0004-android-tests-Add-config.target_swift_api_extract-fo.patch delete mode 100644 patches/release/5.4/swift/0005-Fix-spelling-arm_dir-icu_dir.patch delete mode 100644 patches/release/5.4/swift/0006-Disable-tests-acording-to-https-github.aaakk.us.kg-apple-swi.patch delete mode 100644 patches/release/5.4/swift/0007-Fix-android-x86_64-and-x86-compile-and-test.patch delete mode 100644 patches/release/5.4/swift/0008-Link-the-swift-core-against-libatomic-linux.patch delete mode 100644 patches/release/5.4/swift/0009- Disable-pre-specialization-of-x86.patch delete mode 100644 patches/release/5.4/swift/0010-Enable-crash-report-client-for-all-platforms.patch delete mode 100644 patches/release/5.7/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch delete mode 100644 patches/release/5.7/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch delete mode 100644 patches/release/5.7/swift/0002-Add-presets-for-android-x86-x86_64.patch delete mode 100644 patches/release/5.7/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch delete mode 100644 patches/release/5.7/swift/0004-Fix-spelling-arm_dir-icu_dir.patch delete mode 100644 patches/release/5.7/swift/0005-Disable-all-tests.patch delete mode 100644 patches/release/5.7/swift/0006-Disable-tests-acording-to-https-github.aaakk.us.kg-apple-swi.patch delete mode 100644 patches/release/5.7/swift/0007-Update-to-LTS-NDK-25b.patch delete mode 100644 patches/release/5.7/swift/0008-Enable-crashlytics-and-build-ids.patch delete mode 100644 patches/release/6.0/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch delete mode 100644 patches/release/6.0/swift/0002-Add-presets-for-android-x86-x86_64.patch delete mode 100644 patches/release/6.0/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch delete mode 100644 patches/release/6.0/swift/0004-Fix-spelling-arm_dir-icu_dir.patch rename patches/{release/5.10 => }/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch (100%) create mode 100644 patches/swift-syntax/0001-Add-Android-import.patch rename patches/{release/6.0 => }/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch (100%) rename patches/{release/5.10 => }/swift/0002-Add-presets-for-android-x86-x86_64.patch (100%) rename patches/{release/5.4 => }/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch (100%) rename patches/{release/5.10 => }/swift/0004-Fix-spelling-arm_dir-icu_dir.patch (100%) rename patches/{release/6.0 => }/swift/0005-Disable-all-tests.patch (100%) diff --git a/build/Linux/020-clone-swift.sh b/build/Linux/020-clone-swift.sh index dbd07a38..ea008735 100755 --- a/build/Linux/020-clone-swift.sh +++ b/build/Linux/020-clone-swift.sh @@ -10,10 +10,6 @@ pushd $SWIFT_SRC git clone https://github.com/apple/swift.git --branch $BRANCH --single-branch swift/utils/update-checkout --clone --scheme $BRANCH - # Replace Apple foundation with Readdle's fork - rm -rf swift-corelibs-foundation - git clone https://github.com/swiftlang/swift-corelibs-foundation.git --branch $BRANCH --single-branch - # Construct .swift.sum based on repositories that take part in release build echo "cmark-$(git -C ./cmark rev-parse HEAD)" >> $ROOT_DIR/.swift.sum echo "llvm-project-$(git -C ./llvm-project rev-parse HEAD)" >> $ROOT_DIR/.swift.sum @@ -21,14 +17,15 @@ pushd $SWIFT_SRC echo "swiftpm-$(git -C ./swiftpm rev-parse HEAD)" >> $ROOT_DIR/.swift.sum echo "ninja-$(git -C ./ninja rev-parse HEAD)" >> $ROOT_DIR/.swift.sum echo "llbuild-$(git -C ./llbuild rev-parse HEAD)" >> $ROOT_DIR/.swift.sum + echo "swift-syntax-$(git -C ./swift-syntax rev-parse HEAD)" >> $ROOT_DIR/.swift.sum echo "NDK=$ANDROID_NDK_HOME" >> $ROOT_DIR/.swift.sum - # Apply patches for $BRANCH if exist + # Apply patches if exist for REPO in */; do - if [ -d "$ROOT_DIR/patches/$BRANCH/$REPO" ]; then + if [ -d "$ROOT_DIR/patches/$REPO" ]; then pushd $REPO - git apply $ROOT_DIR/patches/$BRANCH/$REPO/*.patch - echo "$(ls $ROOT_DIR/patches/$BRANCH/$REPO)" >> $ROOT_DIR/.swift.sum + git apply $ROOT_DIR/patches/$REPO/*.patch + echo "$(ls $ROOT_DIR/patches/$REPO)" >> $ROOT_DIR/.swift.sum popd fi done diff --git a/patches/release/5.10/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch b/patches/release/5.10/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch deleted file mode 100644 index b10a2a9e..00000000 --- a/patches/release/5.10/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h -index e48e8891b39..719dfeb9c79 100644 ---- a/include/swift/Basic/LangOptions.h -+++ b/include/swift/Basic/LangOptions.h -@@ -342,6 +342,11 @@ namespace swift { - /// was not compiled with -enable-testing. - bool EnableTestableAttrRequiresTestableModule = true; - -+ /// Experimental -+ /// Disables @objc and dynamic attrs -+ /// Ignored when EnableObjCInterop == true -+ bool DisableObjCAttr = false; -+ - /// - /// Flags for developers - /// -diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td -index 60213f1f2a5..07bb4f9bbd8 100644 ---- a/include/swift/Option/FrontendOptions.td -+++ b/include/swift/Option/FrontendOptions.td -@@ -157,6 +157,11 @@ def verify_generic_signatures : Separate<["-"], "verify-generic-signatures">, - def show_diagnostics_after_fatal : Flag<["-"], "show-diagnostics-after-fatal">, - HelpText<"Keep emitting subsequent diagnostics after a fatal error">; - -+def experimental_disable_objc_attr : Flag<["-"], "experimental-disable-objc-attr">, -+ Flags<[FrontendOption]>, -+ HelpText<"Disables parsing @objc and dynamic attrs. " -+ "Ignored if Objective-C interop enabled">; -+ - def enable_cross_import_overlays : Flag<["-"], "enable-cross-import-overlays">, - HelpText<"Automatically import declared cross-import overlays.">; - def disable_cross_import_overlays : Flag<["-"], "disable-cross-import-overlays">, -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 8c3b3d0e1d0..a39fac0334d 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -250,6 +250,7 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI, - inputArgs.AddAllArgs(arguments, options::OPT_enable_experimental_feature); - inputArgs.AddAllArgs(arguments, options::OPT_enable_upcoming_feature); - inputArgs.AddLastArg(arguments, options::OPT_warn_implicit_overrides); -+ inputArgs.AddLastArg(arguments, options::OPT_experimental_disable_objc_attr); - inputArgs.AddLastArg(arguments, options::OPT_typo_correction_limit); - inputArgs.AddLastArg(arguments, options::OPT_enable_app_extension); - inputArgs.AddLastArg(arguments, options::OPT_enable_app_extension_library); -diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp -index f9350ef5c62..374d47f6982 100644 ---- a/lib/Frontend/CompilerInvocation.cpp -+++ b/lib/Frontend/CompilerInvocation.cpp -@@ -720,6 +720,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args, - - Opts.EnableThrowWithoutTry |= Args.hasArg(OPT_enable_throw_without_try); - -+ Opts.DisableObjCAttr |= Args.hasArg(OPT_experimental_disable_objc_attr); -+ - if (auto A = Args.getLastArg(OPT_enable_objc_attr_requires_foundation_module, - OPT_disable_objc_attr_requires_foundation_module)) { - Opts.EnableObjCAttrRequiresFoundation -diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp -index 4acf53c30ef..409a869c595 100644 ---- a/lib/Parse/ParseDecl.cpp -+++ b/lib/Parse/ParseDecl.cpp -@@ -5924,6 +5924,30 @@ Parser::parseDecl(ParseDeclOptions Flags, - return DeclResult; - } - -+ if (auto SF = CurDeclContext->getParentSourceFile()) { -+ if (!InInactiveClauseEnvironment) { -+ -+ bool ObjCAttrDisabled = Context.LangOpts.DisableObjCAttr -+ && !Context.LangOpts.EnableObjCInterop; // do nothing if ObjCInterop enabled -+ -+ bool AttributesChanged = false; -+ -+ for (auto Attr : Attributes) { -+ if (isa(Attr)) { -+ if (ObjCAttrDisabled) { -+ Attr->setInvalid(); -+ Attributes.removeAttribute(Attr); -+ AttributesChanged = true; -+ } -+ } -+ } -+ -+ if (AttributesChanged) { -+ DeclResult.get()->getAttrs() = Attributes; -+ } -+ } -+ } -+ - if (DeclResult.isNonNull()) { - Decl *D = DeclResult.get(); - if (!HandlerAlreadyCalled) diff --git a/patches/release/5.10/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch b/patches/release/5.10/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch deleted file mode 100644 index dbb70471..00000000 --- a/patches/release/5.10/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch +++ /dev/null @@ -1,78 +0,0 @@ -From b898705c08e7d948ff8be393bffe580ca6b6c41e Mon Sep 17 00:00:00 2001 -From: Andrew Druk -Date: Thu, 6 Jun 2024 00:13:57 +0300 -Subject: [PATCH 3/7] Forward android-arch form build-script to - build-script-impl in case of i686 - ---- - utils/build-presets.ini | 7 +++++++ - utils/build-script | 3 +++ - utils/build_swift/build_swift/driver_arguments.py | 4 ++-- - utils/swift_build_support/swift_build_support/targets.py | 2 +- - 4 files changed, 13 insertions(+), 3 deletions(-) - -diff --git a/utils/build-presets.ini b/utils/build-presets.ini -index d90036a548f..50d65263be0 100644 ---- a/utils/build-presets.ini -+++ b/utils/build-presets.ini -@@ -1021,6 +1021,13 @@ llbuild - swift-driver - install-all - -+[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,armv7] -+mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build -+ -+dash-dash -+ -+android-arch=armv7 -+ - [preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,aarch64] - mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build - -diff --git a/utils/build-script b/utils/build-script -index dcbc3915489..8951400b5a9 100755 ---- a/utils/build-script -+++ b/utils/build-script -@@ -357,6 +357,9 @@ def apply_default_arguments(toolchain, args): - elif args.android_arch == "aarch64": - args.stdlib_deployment_targets.append( - StdlibDeploymentTarget.Android.aarch64.name) -+ elif args.android_arch == "i686": -+ args.stdlib_deployment_targets.append( -+ StdlibDeploymentTarget.Android.i686.name) - elif args.android_arch == "x86_64": - args.stdlib_deployment_targets.append( - StdlibDeploymentTarget.Android.x86_64.name) -diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py -index 15f2ff04f43..79f1434683d 100644 ---- a/utils/build_swift/build_swift/driver_arguments.py -+++ b/utils/build_swift/build_swift/driver_arguments.py -@@ -1306,10 +1306,10 @@ def create_argument_parser(): - android.adb.commands.DEVICE_TEMP_DIR)) - - option('--android-arch', store, -- choices=['armv7', 'aarch64', 'x86_64'], -+ choices=['armv7', 'aarch64', 'i686', 'x86_64'], - default='armv7', - help='The target architecture when building for Android. ' -- 'Currently, only armv7, aarch64, and x86_64 are supported. ' -+ 'Currently, only armv7, aarch64, i686, and x86_64 are supported. ' - '%(default)s is the default.') - - # ------------------------------------------------------------------------- -diff --git a/utils/swift_build_support/swift_build_support/targets.py b/utils/swift_build_support/swift_build_support/targets.py -index 588ba88161d..fe82df5a8ec 100644 ---- a/utils/swift_build_support/swift_build_support/targets.py -+++ b/utils/swift_build_support/swift_build_support/targets.py -@@ -284,7 +284,7 @@ class StdlibDeploymentTarget(object): - - Cygwin = Platform("cygwin", archs=["x86_64"]) - -- Android = AndroidPlatform("android", archs=["armv7", "aarch64", "x86_64"]) -+ Android = AndroidPlatform("android", archs=["armv7", "aarch64", "i686", "x86_64"]) - - Windows = Platform("windows", archs=["x86_64"]) - --- -2.41.0 - diff --git a/patches/release/5.10/swift/0005-Disable-all-tests.patch b/patches/release/5.10/swift/0005-Disable-all-tests.patch deleted file mode 100644 index 86d8b77e..00000000 --- a/patches/release/5.10/swift/0005-Disable-all-tests.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/utils/build-presets.ini b/utils/build-presets.ini -index 84b0baaa41d..ebbac0abd71 100644 ---- a/utils/build-presets.ini -+++ b/utils/build-presets.ini -@@ -841,8 +841,6 @@ build-swift-stdlib-unittest-extra - # Executes the lit tests for the installable package that is created - # Assumes the swift-integration-tests repo is checked out - --test-installable-package -- - # Build the benchmarks against the toolchain. - toolchain-benchmarks - -@@ -914,12 +912,6 @@ mixin-preset= - build-subdir=buildbot_linux - - release --test --validation-test --long-test --stress-test --test-optimized --lit-args=-v --time-tests - - build-ninja - -@@ -936,8 +928,6 @@ install-destdir=%(install_destdir)s - # Path to the .tar.gz package we would create. - installable-package=%(installable_package)s - --host-test -- - install-prefix=/usr - install-llvm - install-swift diff --git a/patches/release/5.10/swift/0006-Enable-libdispatch.patch b/patches/release/5.10/swift/0006-Enable-libdispatch.patch deleted file mode 100644 index 3b5376fd..00000000 --- a/patches/release/5.10/swift/0006-Enable-libdispatch.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/utils/build-presets.ini b/utils/build-presets.ini -index cf34bc15248..c009d18db71 100644 ---- a/utils/build-presets.ini -+++ b/utils/build-presets.ini -@@ -991,6 +991,8 @@ install-swiftsyntax - skip-test-linux - skip-build-benchmarks - -+libdispatch -+ - reconfigure - - [preset: buildbot_linux,no_test,stage0] diff --git a/patches/release/5.4/llvm-project/0001-nfc-Fix-missing-include.patch b/patches/release/5.4/llvm-project/0001-nfc-Fix-missing-include.patch deleted file mode 100644 index 223ee2c7..00000000 --- a/patches/release/5.4/llvm-project/0001-nfc-Fix-missing-include.patch +++ /dev/null @@ -1,24 +0,0 @@ -From b498303066a63a203d24f739b2d2e0e56dca70d1 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Tue, 10 Nov 2020 14:55:25 +0100 -Subject: [PATCH] [nfc] Fix missing include - ---- - llvm/utils/benchmark/src/benchmark_register.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/llvm/utils/benchmark/src/benchmark_register.h b/llvm/utils/benchmark/src/benchmark_register.h -index 0705e219f2fa..4caa5ad4da07 100644 ---- a/llvm/utils/benchmark/src/benchmark_register.h -+++ b/llvm/utils/benchmark/src/benchmark_register.h -@@ -1,6 +1,7 @@ - #ifndef BENCHMARK_REGISTER_H - #define BENCHMARK_REGISTER_H - -+#include - #include - - #include "check.h" --- -2.29.2 - diff --git a/patches/release/5.4/swift-corelibs-foundation/0001-unnecessary-fatal-error-in-networking.patch b/patches/release/5.4/swift-corelibs-foundation/0001-unnecessary-fatal-error-in-networking.patch deleted file mode 100644 index 4cb074f0..00000000 --- a/patches/release/5.4/swift-corelibs-foundation/0001-unnecessary-fatal-error-in-networking.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift -index 5cf0637e..fdee75ab 100644 ---- a/Sources/FoundationNetworking/URLSession/NativeProtocol.swift -+++ b/Sources/FoundationNetworking/URLSession/NativeProtocol.swift -@@ -67,7 +67,10 @@ internal class _NativeProtocol: URLProtocol, _EasyHandleDelegate { - suspend() - } else { - self.internalState = .transferFailed -- guard let error = self.task?.error else { fatalError() } -+ guard let error = self.task?.error else { -+ NSLog("No error") -+ return -+ } - completeTask(withError: error) - } - } -@@ -222,7 +225,8 @@ internal class _NativeProtocol: URLProtocol, _EasyHandleDelegate { - } - - guard let response = ts.response else { -- fatalError("Transfer completed, but there's no response.") -+ NSLog("Transfer completed, but there's no response.") -+ return - } - internalState = .transferCompleted(response: response, bodyDataDrain: ts.bodyDataDrain) - let action = completionAction(forCompletedRequest: request, response: response) diff --git a/patches/release/5.4/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch b/patches/release/5.4/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch deleted file mode 100644 index 185f68f2..00000000 --- a/patches/release/5.4/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch +++ /dev/null @@ -1,56 +0,0 @@ -From c49c13cd47983030cf6b880ba18317203c629c5e Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Wed, 21 Nov 2018 19:31:39 +0200 -Subject: [PATCH] Add LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE env variable - ---- - src/internal.h | 8 +++++++- - src/queue.c | 11 ++++++++++- - 2 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/src/internal.h b/src/internal.h -index 3cc16fc..da0e36a 100644 ---- a/src/internal.h -+++ b/src/internal.h -@@ -1112,6 +1112,12 @@ extern bool _dispatch_kevent_workqueue_enabled; - #include "inline_internal.h" - #include "firehose/firehose_internal.h" - --__END_DECLS -+#if !HAVE_PTHREAD_WORKQUEUE_KEVENT -+// copied from https://opensource.apple.com/source/libpthread/libpthread-301.50.1/kern/workqueue_internal.h.auto.html -+#define WORKQUEUE_MAXTHREADS 512 -+#define WORKQUEUE_CONSTRAINED_MAXTHREADS (WORKQUEUE_MAXTHREADS >> 3) -+#define WORKQUEUE_CONSTRAINED_FACTOR 5 -+#endif - -+__END_DECLS - #endif /* __DISPATCH_INTERNAL__ */ -diff --git a/src/queue.c b/src/queue.c -index 90f3cfa..9537d6f 100644 ---- a/src/queue.c -+++ b/src/queue.c -@@ -6168,10 +6168,19 @@ _dispatch_root_queue_init_pthread_pool(dispatch_queue_global_t dq, - int pool_size, dispatch_priority_t pri) - { - dispatch_pthread_root_queue_context_t pqc = dq->do_ctxt; -+ int32_t default_pool_size = 0; -+ char* default_pool_size_env = getenv("LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE"); -+ if (default_pool_size_env) { -+ default_pool_size = (int32_t) atoi(default_pool_size_env); -+ } -+ if (!default_pool_size) { -+ default_pool_size = (int32_t) MAX(dispatch_hw_config(active_cpus) * 5, WORKQUEUE_CONSTRAINED_MAXTHREADS); -+ } - int thread_pool_size = DISPATCH_WORKQ_MAX_PTHREAD_COUNT; - if (!(pri & DISPATCH_PRIORITY_FLAG_OVERCOMMIT)) { -- thread_pool_size = (int32_t)dispatch_hw_config(active_cpus); -+ thread_pool_size = default_pool_size; - } -+ - if (pool_size && pool_size < thread_pool_size) thread_pool_size = pool_size; - dq->dgq_thread_pool_size = thread_pool_size; - qos_class_t cls = _dispatch_qos_to_qos_class(_dispatch_priority_qos(pri) ?: --- -2.29.2 - diff --git a/patches/release/5.4/swift-corelibs-libdispatch/0002-Dint-use-wfe-based-spin-lock-on-android-armv7.patch b/patches/release/5.4/swift-corelibs-libdispatch/0002-Dint-use-wfe-based-spin-lock-on-android-armv7.patch deleted file mode 100644 index cb38c6f5..00000000 --- a/patches/release/5.4/swift-corelibs-libdispatch/0002-Dint-use-wfe-based-spin-lock-on-android-armv7.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a18089e42a7048dbdff1a9b4c7e087a320bfcadd Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Mon, 7 Oct 2019 20:46:42 +0300 -Subject: [PATCH 10/10] Dint use wfe based spin lock on android armv7 - ---- - src/shims/yield.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/shims/yield.c b/src/shims/yield.c -index 43f0017..a0500fd 100644 ---- a/src/shims/yield.c -+++ b/src/shims/yield.c -@@ -36,7 +36,7 @@ void * - _dispatch_wait_for_enqueuer(void **ptr) - { - #if !DISPATCH_HW_CONFIG_UP --#if defined(__arm__) || defined(__arm64__) -+#if (defined(__arm__) && !defined(__ANDROID__)) || defined(__arm64__) - int spins = DISPATCH_WAIT_SPINS_WFE; - void *value; - while (unlikely(spins-- > 0)) { --- -2.29.2 - diff --git a/patches/release/5.4/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch b/patches/release/5.4/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch deleted file mode 100644 index 094395f4..00000000 --- a/patches/release/5.4/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 7ec2726dfebcc6ce643a1bd87abb8179e673ac5b Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Tue, 30 Mar 2021 14:45:09 +0300 -Subject: [PATCH] Disable @objc and dynamic for linux. At parsing stage - ---- - include/swift/Basic/LangOptions.h | 5 +++++ - include/swift/Option/FrontendOptions.td | 5 +++++ - lib/Driver/ToolChains.cpp | 1 + - lib/Frontend/CompilerInvocation.cpp | 2 ++ - lib/Parse/ParseDecl.cpp | 24 ++++++++++++++++++++++++ - 5 files changed, 37 insertions(+) - -diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h -index aea1bf77a44..2ab7ba64184 100644 ---- a/include/swift/Basic/LangOptions.h -+++ b/include/swift/Basic/LangOptions.h -@@ -211,6 +211,11 @@ namespace swift { - /// was not compiled with -enable-testing. - bool EnableTestableAttrRequiresTestableModule = true; - -+ /// Experimental -+ /// Disables @objc and dynamic attrs -+ /// Ignored when EnableObjCInterop == true -+ bool DisableObjCAttr = false; -+ - /// - /// Flags for developers - /// -diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td -index 5a8cfcfaecb..a54261be0d5 100644 ---- a/include/swift/Option/FrontendOptions.td -+++ b/include/swift/Option/FrontendOptions.td -@@ -126,6 +126,11 @@ def verify_syntax_tree : Flag<["-"], "verify-syntax-tree">, - def show_diagnostics_after_fatal : Flag<["-"], "show-diagnostics-after-fatal">, - HelpText<"Keep emitting subsequent diagnostics after a fatal error">; - -+def experimental_disable_objc_attr : Flag<["-"], "experimental-disable-objc-attr">, -+ Flags<[FrontendOption]>, -+ HelpText<"Disables parsing @objc and dynamic attrs. " -+ "Ignored if Objective-C interop enabled">; -+ - def enable_cross_import_overlays : Flag<["-"], "enable-cross-import-overlays">, - HelpText<"Automatically import declared cross-import overlays.">; - def disable_cross_import_overlays : Flag<["-"], "disable-cross-import-overlays">, -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 22e87dbcec1..8a7a2d65949 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -218,6 +218,7 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI, - options::OPT_warn_swift3_objc_inference_minimal, - options::OPT_warn_swift3_objc_inference_complete); - inputArgs.AddLastArg(arguments, options::OPT_warn_implicit_overrides); -+ inputArgs.AddLastArg(arguments, options::OPT_experimental_disable_objc_attr); - inputArgs.AddLastArg(arguments, options::OPT_typo_correction_limit); - inputArgs.AddLastArg(arguments, options::OPT_enable_app_extension); - inputArgs.AddLastArg(arguments, options::OPT_enable_library_evolution); -diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp -index b4e6ceb3dc8..05fcc8672a9 100644 ---- a/lib/Frontend/CompilerInvocation.cpp -+++ b/lib/Frontend/CompilerInvocation.cpp -@@ -485,6 +485,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args, - - Opts.EnableThrowWithoutTry |= Args.hasArg(OPT_enable_throw_without_try); - -+ Opts.DisableObjCAttr |= Args.hasArg(OPT_experimental_disable_objc_attr); -+ - if (auto A = Args.getLastArg(OPT_enable_objc_attr_requires_foundation_module, - OPT_disable_objc_attr_requires_foundation_module)) { - Opts.EnableObjCAttrRequiresFoundation -diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp -index 3341fcf45fe..4f9bdd7896b 100644 ---- a/lib/Parse/ParseDecl.cpp -+++ b/lib/Parse/ParseDecl.cpp -@@ -4233,6 +4233,30 @@ Parser::parseDecl(ParseDeclOptions Flags, - return DeclResult; - } - -+ if (auto SF = CurDeclContext->getParentSourceFile()) { -+ if (!InInactiveClauseEnvironment) { -+ -+ bool ObjCAttrDisabled = Context.LangOpts.DisableObjCAttr -+ && !Context.LangOpts.EnableObjCInterop; // do nothing if ObjCInterop enabled -+ -+ bool AttributesChanged = false; -+ -+ for (auto Attr : Attributes) { -+ if (isa(Attr)) { -+ if (ObjCAttrDisabled) { -+ Attr->setInvalid(); -+ Attributes.removeAttribute(Attr); -+ AttributesChanged = true; -+ } -+ } -+ } -+ -+ if (AttributesChanged) { -+ DeclResult.get()->getAttrs() = Attributes; -+ } -+ } -+ } -+ - if (DeclResult.isNonNull()) { - Decl *D = DeclResult.get(); - if (!HandlerAlreadyCalled) --- -2.29.2 - diff --git a/patches/release/5.4/swift/0002-Add-presets-for-android-x86-x86_64.patch b/patches/release/5.4/swift/0002-Add-presets-for-android-x86-x86_64.patch deleted file mode 100644 index 7efa5abf..00000000 --- a/patches/release/5.4/swift/0002-Add-presets-for-android-x86-x86_64.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 86b27676cc71ecbe7bb4919605dc34636a711493 Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Mon, 24 Jun 2019 20:54:23 +0000 -Subject: [PATCH 2/7] Add presets for android x86 x86_64 - ---- - utils/build-presets.ini | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) - -diff --git a/utils/build-presets.ini b/utils/build-presets.ini -index 5d5b45c6413..46ad038f6dc 100644 ---- a/utils/build-presets.ini -+++ b/utils/build-presets.ini -@@ -881,11 +881,11 @@ libcxx - android - android-ndk=%(ndk_path)s - android-api-level=24 --android-icu-uc=%(arm_dir)s/libicuucswift.so --android-icu-uc-include=%(arm_dir)s/icu/source/common --android-icu-i18n=%(arm_dir)s/libicui18nswift.so --android-icu-i18n-include=%(arm_dir)s/icu/source/i18n --android-icu-data=%(arm_dir)s/libicudataswift.so -+android-icu-uc=%(icu_dir)s/libicuuc.so -+android-icu-uc-include=%(icu_dir)s/icu/source/common -+android-icu-i18n=%(icu_dir)s/libicui18n.so -+android-icu-i18n-include=%(icu_dir)s/icu/source/i18n -+android-icu-data=%(icu_dir)s/libicudata.so - - build-swift-static-stdlib - build-swift-static-sdk-overlay -@@ -917,6 +917,20 @@ mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build - - android-arch=aarch64 - -+[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,x86] -+mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build -+ -+dash-dash -+ -+android-arch=i686 -+ -+[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,x86_64] -+mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build -+ -+dash-dash -+ -+android-arch=x86_64 -+ - # Ubuntu 18.04 preset for backwards compat and future customizations. - [preset: buildbot_linux_1804] - mixin-preset=buildbot_linux --- -2.29.2 - diff --git a/patches/release/5.4/swift/0004-android-tests-Add-config.target_swift_api_extract-fo.patch b/patches/release/5.4/swift/0004-android-tests-Add-config.target_swift_api_extract-fo.patch deleted file mode 100644 index f6b5e54e..00000000 --- a/patches/release/5.4/swift/0004-android-tests-Add-config.target_swift_api_extract-fo.patch +++ /dev/null @@ -1,32 +0,0 @@ -From a0401ed86c9b1d8a4c7e0c4d990799e994b2a639 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez=20Troiti=C3=B1o?= - -Date: Tue, 16 Feb 2021 17:42:47 -0800 -Subject: [PATCH 4/7] [android][tests] Add config.target_swift_api_extract for - Android. - -The configuration for Android of target_swift_api_extract was missing -and the CI machines could not start testing anything. These changes add -the missing line to the testing configuration. ---- - test/lit.cfg | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/test/lit.cfg b/test/lit.cfg -index f75db0126c6..d1f37aa64c3 100644 ---- a/test/lit.cfg -+++ b/test/lit.cfg -@@ -1424,6 +1424,10 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android': - config.swift_symbolgraph_extract, - '-target', config.variant_triple, - mcp_opt]) -+ config.target_swift_api_extract = ' '.join([ -+ config.swift_api_extract, -+ '-target', config.variant_triple, -+ '-sdk', shell_quote(config.variant_sdk)]) - config.target_swift_ide_test = ' '.join([ - config.swift_ide_test, - '-target', config.variant_triple, --- -2.29.2 - diff --git a/patches/release/5.4/swift/0005-Fix-spelling-arm_dir-icu_dir.patch b/patches/release/5.4/swift/0005-Fix-spelling-arm_dir-icu_dir.patch deleted file mode 100644 index 5ba7d329..00000000 --- a/patches/release/5.4/swift/0005-Fix-spelling-arm_dir-icu_dir.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 89da66227b3bd3882392b29b51da4aff52ae078f Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Thu, 1 Apr 2021 15:57:54 +0300 -Subject: [PATCH 5/7] Fix spelling arm_dir -> icu_dir - ---- - utils/build_swift/tests/build_swift/test_presets.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/utils/build_swift/tests/build_swift/test_presets.py b/utils/build_swift/tests/build_swift/test_presets.py -index 2668d7a8d79..92ad63251b0 100644 ---- a/utils/build_swift/tests/build_swift/test_presets.py -+++ b/utils/build_swift/tests/build_swift/test_presets.py -@@ -46,7 +46,7 @@ PRESET_DEFAULTS = { - 'swift_install_destdir': '/tmp/install/swift', - 'symbols_package': '/path/to/symbols/package', - 'ndk_path': '/path/to/ndk', -- 'arm_dir': '/path/to/arm', -+ 'icu_dir': '/path/to/arm', - 'toolchain_path': '/tmp/toolchain', - } - --- -2.29.2 - diff --git a/patches/release/5.4/swift/0006-Disable-tests-acording-to-https-github.aaakk.us.kg-apple-swi.patch b/patches/release/5.4/swift/0006-Disable-tests-acording-to-https-github.aaakk.us.kg-apple-swi.patch deleted file mode 100644 index 2c4626fc..00000000 --- a/patches/release/5.4/swift/0006-Disable-tests-acording-to-https-github.aaakk.us.kg-apple-swi.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 06d2b3cfcf6242f936abb66095f789c021701e50 Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Thu, 1 Apr 2021 15:58:18 +0300 -Subject: [PATCH 6/7] Disable tests acording to - https://github.com/apple/swift/pull/34491 - ---- - test/Interop/Cxx/class/memory-layout-silgen.swift | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/test/Interop/Cxx/class/memory-layout-silgen.swift b/test/Interop/Cxx/class/memory-layout-silgen.swift -index 3567242c2ea..c0b531ca317 100644 ---- a/test/Interop/Cxx/class/memory-layout-silgen.swift -+++ b/test/Interop/Cxx/class/memory-layout-silgen.swift -@@ -1,5 +1,8 @@ - // RUN: %target-swiftxx-frontend -I %S/Inputs -emit-ir -o - %s | %FileCheck %s - -+// UNSUPPORTED: OS=linux-android -+// UNSUPPORTED: OS=linux-androideabi -+ - import MemoryLayout - - var v = PrivateMemberLayout() --- -2.29.2 - diff --git a/patches/release/5.4/swift/0007-Fix-android-x86_64-and-x86-compile-and-test.patch b/patches/release/5.4/swift/0007-Fix-android-x86_64-and-x86-compile-and-test.patch deleted file mode 100644 index 169c9b5e..00000000 --- a/patches/release/5.4/swift/0007-Fix-android-x86_64-and-x86-compile-and-test.patch +++ /dev/null @@ -1,364 +0,0 @@ -From e1e3863f2bba9896367f39764f3979b741c1e89a Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Mon, 5 Apr 2021 20:45:32 +0300 -Subject: [PATCH 7/7] Fix android x86_64 and x86 compile and test - ---- - test/ClangImporter/cfuncs_parse.swift | 2 +- - test/DebugInfo/modulecache.swift | 2 +- - test/Frontend/embed-bitcode.swift | 2 ++ - test/IRGen/c_layout.sil | 16 ++++++++++++++++ - test/IRGen/condfail.sil | 1 + - test/IRGen/errors.sil | 3 +++ - test/IRGen/objc_simd.sil | 4 ++++ - test/IRGen/pic.swift | 8 +++++++- - test/IRGen/static_initializer.sil | 1 + - test/IRGen/yield_once_biggish.sil | 1 + - .../Cxx/operators/member-inline-irgen.swift | 1 + - .../Cxx/operators/member-out-of-line-irgen.swift | 1 + - .../operators/non-member-out-of-line-irgen.swift | 1 + - test/Parse/enum.swift | 2 ++ - test/Reflection/typeref_decoding_asan.swift | 3 +++ - ...gnostic_constant_propagation_floats_x86.swift | 2 ++ - test/lit.cfg | 8 ++++++-- - test/stdlib/FloatingPointIR.swift | 3 +++ - test/stdlib/FloatingPointIR_FP80.swift | 2 ++ - utils/build-script-impl | 5 +++++ - 20 files changed, 63 insertions(+), 5 deletions(-) - -diff --git a/test/ClangImporter/cfuncs_parse.swift b/test/ClangImporter/cfuncs_parse.swift -index 746dce15787..9a167906e46 100644 ---- a/test/ClangImporter/cfuncs_parse.swift -+++ b/test/ClangImporter/cfuncs_parse.swift -@@ -64,7 +64,7 @@ func test_pow() { - pow(1.5, 2.5) - } - --#if !((os(Android) || os(Linux)) && arch(arm64)) -+#if !((os(Linux) && arch(arm64)) || (os(Android) && (arch(arm64) || arch(x86_64) || arch(i386)))) - // long doubles in AAPCS64 are 128 bits, which is not supported by - // Swift, so don't test this. SR-9072. - func test_powl() { -diff --git a/test/DebugInfo/modulecache.swift b/test/DebugInfo/modulecache.swift -index 1dceafbf15d..959e9c81e39 100644 ---- a/test/DebugInfo/modulecache.swift -+++ b/test/DebugInfo/modulecache.swift -@@ -16,7 +16,7 @@ import ClangModule - // RUN: %empty-directory(%t) - // RUN: %target-swift-frontend %s -c -g -o %t.o -module-cache-path %t -I %S/Inputs - // RUN: llvm-readobj -h %t/*/ClangModule-*.pcm | %FileCheck %s --// CHECK: Format: {{(Mach-O|ELF|elf64|COFF|elf32-littlearm)}} -+// CHECK: Format: {{(Mach-O|ELF|elf64|COFF|elf32-littlearm|elf32-i386)}} - - // 3. Test that swift-ide-check will not share swiftc's module cache. - -diff --git a/test/Frontend/embed-bitcode.swift b/test/Frontend/embed-bitcode.swift -index 9f59002b561..0fad2d35b95 100644 ---- a/test/Frontend/embed-bitcode.swift -+++ b/test/Frontend/embed-bitcode.swift -@@ -10,6 +10,8 @@ - // UNSUPPORTED: OS=freebsd - // UNSUPPORTED: OS=openbsd - // UNSUPPORTED: OS=windows-msvc -+// UNSUPPORTED: OS=linux-android -+// UNSUPPORTED: OS=linux-androideabi - - // MARKER: Contents of (__LLVM,__bitcode) section - // MARKER-NEXT: 00 -diff --git a/test/IRGen/c_layout.sil b/test/IRGen/c_layout.sil -index 8cdbc741134..226906c542e 100644 ---- a/test/IRGen/c_layout.sil -+++ b/test/IRGen/c_layout.sil -@@ -173,6 +173,22 @@ bb0: - // CHECK-i386-LABEL: declare{{( dllimport)?}} i32 @ints(i32) - // CHECK-i386-LABEL: declare{{( dllimport)?}} i32 @unsigneds(i32) - -+// CHECK-i686-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @testIntegerExtension -+// CHECK-i686: call signext i8 @chareth(i8 signext -+// CHECK-i686: call signext i8 @signedChareth(i8 signext -+// CHECK-i686: call zeroext i8 @unsignedChareth(i8 zeroext -+// CHECK-i686: call signext i16 @eatMyShorts(i16 signext -+// CHECK-i686: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext -+// CHECK-i686: call i32 @ints(i32 %5) -+// CHECK-i686: call i32 @unsigneds(i32 %6) -+// CHECK-i686-LABEL: declare{{( dllimport)?}} signext i8 @chareth(i8 signext) -+// CHECK-i686-LABEL: declare{{( dllimport)?}} signext i8 @signedChareth(i8 signext) -+// CHECK-i686-LABEL: declare{{( dllimport)?}} zeroext i8 @unsignedChareth(i8 zeroext) -+// CHECK-i686-LABEL: declare{{( dllimport)?}} signext i16 @eatMyShorts(i16 signext) -+// CHECK-i686-LABEL: declare{{( dllimport)?}} zeroext i16 @eatMyUnsignedShorts(i16 zeroext) -+// CHECK-i686-LABEL: declare{{( dllimport)?}} i32 @ints(i32) -+// CHECK-i686-LABEL: declare{{( dllimport)?}} i32 @unsigneds(i32) -+ - // CHECK-armv7-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @testIntegerExtension - // CHECK-ios-armv7: call signext i8 @chareth(i8 signext - // CHECK-ios-armv7: call signext i8 @signedChareth(i8 signext -diff --git a/test/IRGen/condfail.sil b/test/IRGen/condfail.sil -index ebdc6b92318..e4b2bf400dd 100644 ---- a/test/IRGen/condfail.sil -+++ b/test/IRGen/condfail.sil -@@ -1,5 +1,6 @@ - // RUN: %target-swift-frontend -primary-file %s -O -g -S | %FileCheck %s --check-prefix CHECK --check-prefix CHECK-%target-cpu --check-prefix CHECK-OPT-%target-os - // RUN: %target-swift-frontend -primary-file %s -g -S | %FileCheck %s --check-prefix CHECK --check-prefix CHECK-%target-cpu --check-prefix CHECK-NOOPT-%target-os -+// UNSUPPORTED: OS=linux-android && (CPU=i686 || CPU=x86_64) - - import Builtin - import Swift -diff --git a/test/IRGen/errors.sil b/test/IRGen/errors.sil -index f8fba2b88c3..54d8363a759 100644 ---- a/test/IRGen/errors.sil -+++ b/test/IRGen/errors.sil -@@ -16,6 +16,7 @@ entry: - } - - // CHECK-LABEL-i386: define{{( dllexport)?}}{{( protected)?}} swiftcc void @does_throw(%swift.refcounted* swiftself %0, %swift.error** %1) {{.*}} { -+// CHECK-LABEL-i686: define{{( dllexport)?}}{{( protected)?}} swiftcc void @does_throw(%swift.refcounted* swiftself %0, %swift.error** %1) {{.*}} { - // CHECK-LABEL-x86_64: define{{( dllexport)?}}{{( protected)?}} swiftcc void @does_throw(%swift.refcounted* swiftself %0, %swift.error** swifterror %1) {{.*}} { - // CHECK-LABEL-armv7: define{{( dllexport)?}}{{( protected)?}} swiftcc void @does_throw(%swift.refcounted* swiftself %0, %swift.error** swifterror %1) {{.*}} { - // CHECK-LABEL-armv7s: define{{( dllexport)?}}{{( protected)?}} swiftcc void @does_throw(%swift.refcounted* swiftself %0, %swift.error** swifterror %1) {{.*}} { -@@ -38,6 +39,7 @@ sil @does_throw : $@convention(thin) () -> @error Error { - } - - // CHECK-LABEL-i386: define{{( dllexport)?}}{{( protected)?}} swiftcc void @doesnt_throw(%swift.refcounted* swiftself %0, %swift.error** %1) {{.*}} { -+// CHECK-LABEL-i686: define{{( dllexport)?}}{{( protected)?}} swiftcc void @doesnt_throw(%swift.refcounted* swiftself %0, %swift.error** %1) {{.*}} { - // CHECK-LABEL-x86_64: define{{( dllexport)?}}{{( protected)?}} swiftcc void @doesnt_throw(%swift.refcounted* swiftself %0, %swift.error** swifterror %1) {{.*}} { - // CHECK-LABEL-armv7: define{{( dllexport)?}}{{( protected)?}} swiftcc void @doesnt_throw(%swift.refcounted* swiftself %0, %swift.error** swifterror %1) {{.*}} { - // CHECK-LABEL-armv7s: define{{( dllexport)?}}{{( protected)?}} swiftcc void @doesnt_throw(%swift.refcounted* swiftself %0, %swift.error** swifterror %1) {{.*}} { -@@ -61,6 +63,7 @@ sil @try_apply_helper : $@convention(thin) (@owned AnyObject) -> (@owned AnyObje - sil @try_apply : $@convention(thin) (@owned AnyObject) -> () { - entry(%0 : $AnyObject): - // CHECK-i386: [[ERRORSLOT:%.*]] = alloca [[SWIFTERROR:.*]]%swift.error*, align -+ // CHECK-i686: [[ERRORSLOT:%.*]] = alloca [[SWIFTERROR:.*]]%swift.error*, align - // CHECK-x86_64: [[ERRORSLOT:%.*]] = alloca [[SWIFTERROR:.*]] %swift.error*, align - // CHECK-armv7: [[ERRORSLOT:%.*]] = alloca [[SWIFTERROR:.*]] %swift.error*, align - // CHECK-armv7s: [[ERRORSLOT:%.*]] = alloca [[SWIFTERROR:.*]] %swift.error*, align -diff --git a/test/IRGen/objc_simd.sil b/test/IRGen/objc_simd.sil -index 210094ed1f9..975527b44a2 100644 ---- a/test/IRGen/objc_simd.sil -+++ b/test/IRGen/objc_simd.sil -@@ -15,6 +15,7 @@ func forceStuff(x: float4, y: float3) -> (Float, Float, Float, Float) { - - // x86_64-LABEL: define{{( dllexport)?}}{{( protected)?}} <4 x float> @simd_c_args(<4 x float> %0) - // i386-LABEL: define{{( dllexport)?}}{{( protected)?}} <2 x i64> @simd_c_args(<4 x float> %0) -+// i686-LABEL: define{{( dllexport)?}}{{( protected)?}} <4 x float> @simd_c_args(<4 x float> %0) - // aarch64-LABEL: define{{( dllexport)?}}{{( protected)?}} <4 x float> @simd_c_args(<4 x float> %0) - // arm64-LABEL: define{{( dllexport)?}}{{( protected)?}} <4 x float> @simd_c_args(<4 x float> %0) - // arm64e-LABEL: define{{( dllexport)?}}{{( protected)?}} <4 x float> @simd_c_args(<4 x float> %0) -@@ -32,6 +33,7 @@ entry(%x : $float4): - - // x86_64-LABEL: define{{( dllexport)?}}{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float> %0) - // i386-LABEL: define{{( dllexport)?}}{{( protected)?}} <2 x i64> @simd_c_args_float3(<3 x float> %0) -+// i686-LABEL: define{{( dllexport)?}}{{( protected)?}} <3 x float> @simd_c_args_float3(<3 x float> %0) - // aarch64-LABEL: define{{( dllexport)?}}{{( protected)?}} <3 x float> @simd_c_args_float3(<4 x i32> %0) - // arm64-LABEL: define{{( dllexport)?}}{{( protected)?}} <3 x float> @simd_c_args_float3(<4 x i32> %0) - // arm64e-LABEL: define{{( dllexport)?}}{{( protected)?}} <3 x float> @simd_c_args_float3(<4 x i32> %0) -@@ -55,6 +57,7 @@ entry(%x : $float3): - - // x86_64-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float, float } @simd_native_args(float %0, float %1, float %2, float %3) - // i386-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @simd_native_args(%T4simd6float4V* noalias nocapture sret %0, %T4simd6float4V* noalias nocapture dereferenceable({{.*}}) %1) -+// i686-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @simd_native_args(%T4simd6float4V* noalias nocapture sret %0, %T4simd6float4V* noalias nocapture dereferenceable({{.*}}) %1) - // aarch64-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float, float } @simd_native_args(float %0, float %1, float %2, float %3) - // arm64-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float, float } @simd_native_args(float %0, float %1, float %2, float %3) - // armv6-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @simd_native_args(%T4simd6float4V* noalias nocapture sret %0, %T4simd6float4V* noalias nocapture dereferenceable({{.*}}) %1) -@@ -73,6 +76,7 @@ entry(%x : $float4): - - // x86_64-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2) - // i386-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2) -+// i686-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2) - // aarch64-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2) - // arm64-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2) - // armv6-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { float, float, float } @simd_native_args_float3(float %0, float %1, float %2) -diff --git a/test/IRGen/pic.swift b/test/IRGen/pic.swift -index def763b6bb0..619a09d6c13 100644 ---- a/test/IRGen/pic.swift -+++ b/test/IRGen/pic.swift -@@ -2,7 +2,7 @@ - // platforms. - - // SR-12194 --// XFAIL: OS=linux-android, CPU=aarch64 -+// XFAIL: OS=linux-android && CPU=aarch64 - // UNSUPPORTED: OS=linux-gnu - - // RUN: %target-swift-frontend %s -module-name main -S -o - | %FileCheck -check-prefix=%target-cpu -check-prefix=%target-cpu-%target-sdk-name %s -@@ -21,6 +21,12 @@ public func use_global() -> Int { - // i386: popl [[PIC_REG:%[a-z]+]] - // i386: movl {{_?}}$s4main6globalSivp-[[PIC_BLOCK]]([[PIC_REG]]), {{%[a-z]+}} - -+// i686-LABEL: {{_?}}$s4main10use_globalSiyF: -+// i686: [[PIC_BLOCK:^\.L.*\$pb]]:{{$}} -+// i686: popl [[PIC_REG:%[a-z]+]] -+// i686: addl $_GLOBAL_OFFSET_TABLE_+(.Ltmp1-[[PIC_BLOCK]]), [[PIC_REG]] -+// i686: movl {{_?}}($s4main6globalSivp)@GOTOFF([[PIC_REG]]), {{%[a-z]+}} -+ - // armv7-LABEL: {{_?}}$s4main10use_globalSiyF: - // Check for the runtime memory enforcement call. The global address may be - // materialized in a different register prior to that call. -diff --git a/test/IRGen/static_initializer.sil b/test/IRGen/static_initializer.sil -index a7a1863049a..ffea79b2523 100644 ---- a/test/IRGen/static_initializer.sil -+++ b/test/IRGen/static_initializer.sil -@@ -1,6 +1,7 @@ - // RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s -check-prefix CHECK -check-prefix CHECK-%target-abi - - // REQUIRES: CPU=x86_64 -+// UNSUPPORTED: OS=linux-android - - // Generated from - // var x : Int32 = 2 -diff --git a/test/IRGen/yield_once_biggish.sil b/test/IRGen/yield_once_biggish.sil -index 5aeb62d922f..3332a7ef731 100644 ---- a/test/IRGen/yield_once_biggish.sil -+++ b/test/IRGen/yield_once_biggish.sil -@@ -5,6 +5,7 @@ - // to just rule out i386 for now. If we end up with many similar exceptions, - // we should turn this into a REQUIRES instead. - // UNSUPPORTED: CPU=i386 -+// UNSUPPORTED: CPU=i686 - - import Builtin - import Swift -diff --git a/test/Interop/Cxx/operators/member-inline-irgen.swift b/test/Interop/Cxx/operators/member-inline-irgen.swift -index 7395e06f395..6e318f5d61a 100644 ---- a/test/Interop/Cxx/operators/member-inline-irgen.swift -+++ b/test/Interop/Cxx/operators/member-inline-irgen.swift -@@ -2,6 +2,7 @@ - // - // We can't yet call member functions correctly on Windows (SR-13129). - // XFAIL: OS=windows-msvc -+// UNSUPPORTED: CPU=i686 - - import MemberInline - -diff --git a/test/Interop/Cxx/operators/member-out-of-line-irgen.swift b/test/Interop/Cxx/operators/member-out-of-line-irgen.swift -index 7dd42207629..496b6e12968 100644 ---- a/test/Interop/Cxx/operators/member-out-of-line-irgen.swift -+++ b/test/Interop/Cxx/operators/member-out-of-line-irgen.swift -@@ -2,6 +2,7 @@ - // - // We can't yet call member functions correctly on Windows (SR-13129). - // XFAIL: OS=windows-msvc -+// UNSUPPORTED: CPU=i686 - - import MemberOutOfLine - -diff --git a/test/Interop/Cxx/operators/non-member-out-of-line-irgen.swift b/test/Interop/Cxx/operators/non-member-out-of-line-irgen.swift -index 456520b248e..92ef03ff5cf 100644 ---- a/test/Interop/Cxx/operators/non-member-out-of-line-irgen.swift -+++ b/test/Interop/Cxx/operators/non-member-out-of-line-irgen.swift -@@ -1,4 +1,5 @@ - // RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s -+// UNSUPPORTED: CPU=i686 - - import NonMemberOutOfLine - -diff --git a/test/Parse/enum.swift b/test/Parse/enum.swift -index 83bee6d5464..4397fb759f7 100644 ---- a/test/Parse/enum.swift -+++ b/test/Parse/enum.swift -@@ -7,6 +7,8 @@ - - // Windows does not support FP80 - // XFAIL: OS=windows-msvc -+// UNSUPPORTED: OS=linux-android -+// UNSUPPORTED: OS=linux-androideabi - - enum Empty {} - -diff --git a/test/Reflection/typeref_decoding_asan.swift b/test/Reflection/typeref_decoding_asan.swift -index 57a186df27d..acecde8f1ec 100644 ---- a/test/Reflection/typeref_decoding_asan.swift -+++ b/test/Reflection/typeref_decoding_asan.swift -@@ -1,4 +1,7 @@ - // REQUIRES: asan_runtime -+// UNSUPPORTED: OS=linux-android -+// UNSUPPORTED: OS=linux-androideabi -+ - // RUN: %empty-directory(%t) - // RUN: %target-build-swift %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift -parse-as-library -emit-module -emit-library -module-name TypesToReflect -sanitize=address -o %t/%target-library-name(TypesToReflect) - // RUN: %target-swift-reflection-dump -binary-filename %t/%target-library-name(TypesToReflect) | %FileCheck %s -diff --git a/test/SILOptimizer/diagnostic_constant_propagation_floats_x86.swift b/test/SILOptimizer/diagnostic_constant_propagation_floats_x86.swift -index c32c83d7d98..1823b86c450 100644 ---- a/test/SILOptimizer/diagnostic_constant_propagation_floats_x86.swift -+++ b/test/SILOptimizer/diagnostic_constant_propagation_floats_x86.swift -@@ -3,6 +3,8 @@ - // - // REQUIRES: CPU=i386 || CPU=x86_64 - // UNSUPPORTED: OS=windows-msvc -+// UNSUPPORTED: OS=linux-android -+// UNSUPPORTED: OS=linux-androideabi - // - // These are tests for diagnostics produced by constant propagation pass - // on floating-point operations that are specific to x86 architectures, -diff --git a/test/lit.cfg b/test/lit.cfg -index d1f37aa64c3..83f2ab40764 100644 ---- a/test/lit.cfg -+++ b/test/lit.cfg -@@ -1354,9 +1354,13 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android': - return result - - ndk_platform_tuple = get_architecture_value(armv7="armeabi-v7a", -- aarch64="arm64-v8a") -+ aarch64="arm64-v8a", -+ i686="x86", -+ x86_64="x86_64") - ndk_platform_triple = get_architecture_value(armv7="arm-linux-androideabi", -- aarch64="aarch64-linux-android") -+ aarch64="aarch64-linux-android", -+ i686="i686-linux-android", -+ x86_64="x86_64-linux-android") - if platform.system() == 'Linux': - prebuilt_directory = 'linux-x86_64' - elif platform.system() == 'Darwin': -diff --git a/test/stdlib/FloatingPointIR.swift b/test/stdlib/FloatingPointIR.swift -index ff370af0099..7cb44319acb 100644 ---- a/test/stdlib/FloatingPointIR.swift -+++ b/test/stdlib/FloatingPointIR.swift -@@ -23,6 +23,9 @@ func testConstantFoldFloatLiterals() { - // i386: call swiftcc void @"$s15FloatingPointIR13acceptFloat32yySfF{{.*}}"(float 1.000000e+00) - // i386: call swiftcc void @"$s15FloatingPointIR13acceptFloat64yySdF{{.*}}"(double 1.000000e+00) - -+// i686: call swiftcc void @"$s15FloatingPointIR13acceptFloat32yySfF{{.*}}"(float 1.000000e+00) -+// i686: call swiftcc void @"$s15FloatingPointIR13acceptFloat64yySdF{{.*}}"(double 1.000000e+00) -+ - // x86_64: call swiftcc void @"$s15FloatingPointIR13acceptFloat32yySfF{{.*}}"(float 1.000000e+00) - // x86_64: call swiftcc void @"$s15FloatingPointIR13acceptFloat64yySdF{{.*}}"(double 1.000000e+00) - -diff --git a/test/stdlib/FloatingPointIR_FP80.swift b/test/stdlib/FloatingPointIR_FP80.swift -index a5f0344ec05..c91a018f8fe 100644 ---- a/test/stdlib/FloatingPointIR_FP80.swift -+++ b/test/stdlib/FloatingPointIR_FP80.swift -@@ -4,6 +4,8 @@ - - // REQUIRES: CPU=i386 || CPU=x86_64 - // UNSUPPORTED: OS=windows-msvc -+// UNSUPPORTED: OS=linux-android -+// UNSUPPORTED: OS=linux-androideabi - - var globalFloat80 : Float80 = 0.0 - -diff --git a/utils/build-script-impl b/utils/build-script-impl -index a55ca91e632..041938dc8ff 100755 ---- a/utils/build-script-impl -+++ b/utils/build-script-impl -@@ -416,6 +416,7 @@ function verify_host_is_supported() { - | watchos-armv7k \ - | android-armv7 \ - | android-aarch64 \ -+ | android-i686 \ - | android-x86_64) - ;; - *) -@@ -460,6 +461,10 @@ function set_build_options_for_host() { - SWIFT_HOST_TRIPLE="armv7-unknown-linux-androideabi${ANDROID_API_LEVEL}" - llvm_target_arch="ARM" - ;; -+ android-i686) -+ SWIFT_HOST_TRIPLE="i686-none-linux-android${ANDROID_API_LEVEL}" -+ llvm_target_arch="X86" -+ ;; - android-x86_64) - SWIFT_HOST_TRIPLE="x86_64-unknown-linux-android${ANDROID_API_LEVEL}" - llvm_target_arch="X86" --- -2.29.2 - diff --git a/patches/release/5.4/swift/0008-Link-the-swift-core-against-libatomic-linux.patch b/patches/release/5.4/swift/0008-Link-the-swift-core-against-libatomic-linux.patch deleted file mode 100644 index 1fd0adc8..00000000 --- a/patches/release/5.4/swift/0008-Link-the-swift-core-against-libatomic-linux.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/stdlib/public/core/CMakeLists.txt b/stdlib/public/core/CMakeLists.txt -index 2b10c2e9cdc..d0adfb19c74 100644 ---- a/stdlib/public/core/CMakeLists.txt -+++ b/stdlib/public/core/CMakeLists.txt -@@ -294,6 +294,19 @@ if(SWIFT_CHECK_ESSENTIAL_STDLIB) - target_link_libraries(swift_stdlib_essential ${RUNTIME_DEPENDENCY}) - endif() - -+# Linux requires us to link an atomic library to use atomics. -+# Frustratingly, in many cases this isn't necessary because the -+# sequence is inlined, but we have some code that's just subtle -+# enough to turn into runtime calls. -+if(SWIFT_HOST_VARIANT STREQUAL "android") -+ list(APPEND swift_core_private_link_libraries -latomic) -+endif() -+ -+if(SWIFT_HOST_VARIANT STREQUAL "linux") -+ list(APPEND swift_core_private_link_libraries -latomic) -+endif() -+ -+ - add_swift_target_library(swiftCore - ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE - ${SWIFTLIB_SOURCES} diff --git a/patches/release/5.4/swift/0009- Disable-pre-specialization-of-x86.patch b/patches/release/5.4/swift/0009- Disable-pre-specialization-of-x86.patch deleted file mode 100644 index e72f1167..00000000 --- a/patches/release/5.4/swift/0009- Disable-pre-specialization-of-x86.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/lib/IRGen/IRGenModule.cpp b/lib/IRGen/IRGenModule.cpp -index 37c4c998557..c22b5f7e045 100644 ---- a/lib/IRGen/IRGenModule.cpp -+++ b/lib/IRGen/IRGenModule.cpp -@@ -1610,7 +1610,7 @@ bool IRGenModule::useDllStorage() { return ::useDllStorage(Triple); } - bool IRGenModule::shouldPrespecializeGenericMetadata() { - auto canPrespecializeTarget = - (Triple.isOSDarwin() || Triple.isTvOS() || -- (Triple.isOSLinux() && !(Triple.isARM() && Triple.isArch32Bit()))); -+ (Triple.isOSLinux() && !(Triple.isArch32Bit()))); - if (canPrespecializeTarget && isStandardLibrary()) { - return true; - } diff --git a/patches/release/5.4/swift/0010-Enable-crash-report-client-for-all-platforms.patch b/patches/release/5.4/swift/0010-Enable-crash-report-client-for-all-platforms.patch deleted file mode 100644 index 8dc5a06b..00000000 --- a/patches/release/5.4/swift/0010-Enable-crash-report-client-for-all-platforms.patch +++ /dev/null @@ -1,86 +0,0 @@ -diff --git a/utils/build-script-impl b/utils/build-script-impl -index 43f26c42a3c..9e09574895a 100755 ---- a/utils/build-script-impl -+++ b/utils/build-script-impl -@@ -1531,12 +1531,11 @@ for host in "${ALL_HOSTS[@]}"; do - ) - fi - -- if [[ "${DARWIN_CRASH_REPORTER_CLIENT}" ]] ; then -- swift_cmake_options=( -- "${swift_cmake_options[@]}" -- -DSWIFT_RUNTIME_CRASH_REPORTER_CLIENT:BOOL=TRUE -- ) -- fi -+ # Enable runtime crash reporter client for all platforms -+ swift_cmake_options=( -+ "${swift_cmake_options[@]}" -+ -DSWIFT_RUNTIME_CRASH_REPORTER_CLIENT:BOOL=TRUE -+ ) - - swift_cmake_options=( - "${swift_cmake_options[@]}" - -diff --git a/include/swift/Runtime/Debug.h b/include/swift/Runtime/Debug.h -index f82fee34bc8..932ed29315b 100644 ---- a/include/swift/Runtime/Debug.h -+++ b/include/swift/Runtime/Debug.h -@@ -26,6 +26,12 @@ - - #ifdef SWIFT_HAVE_CRASHREPORTERCLIENT - -+#ifdef __APPLE__ -+#define GCR_ANNOTATIONS_VISIBILITY __attribute__ ((visibility("hidden"))) -+#else -+#define GCR_ANNOTATIONS_VISIBILITY __attribute__ ((visibility("default"))) -+#endif -+ - #define CRASHREPORTER_ANNOTATIONS_VERSION 5 - #define CRASHREPORTER_ANNOTATIONS_SECTION "__crash_info" - -@@ -41,7 +47,7 @@ struct crashreporter_annotations_t { - }; - - extern "C" { --SWIFT_RUNTIME_LIBRARY_VISIBILITY -+GCR_ANNOTATIONS_VISIBILITY - extern struct crashreporter_annotations_t gCRAnnotations; - } - -diff --git a/stdlib/public/runtime/Errors.cpp b/stdlib/public/runtime/Errors.cpp -index b5a5e467388..39e4ab4b892 100644 ---- a/stdlib/public/runtime/Errors.cpp -+++ b/stdlib/public/runtime/Errors.cpp -@@ -261,7 +261,14 @@ void swift::printCurrentBacktrace(unsigned framesToSkip) { - } - - #ifdef SWIFT_HAVE_CRASHREPORTERCLIENT -+ -+#ifdef __APPLE__ - #include -+#define MALLOC_SIZE_FUNC malloc_size -+#else -+#include -+#define MALLOC_SIZE_FUNC malloc_usable_size -+#endif - - // Instead of linking to CrashReporterClient.a (because it complicates the - // build system), define the only symbol from that static archive ourselves. -@@ -269,7 +276,7 @@ void swift::printCurrentBacktrace(unsigned framesToSkip) { - // The layout of this struct is CrashReporter ABI, so there are no ABI concerns - // here. - extern "C" { --SWIFT_LIBRARY_VISIBILITY -+GCR_ANNOTATIONS_VISIBILITY - struct crashreporter_annotations_t gCRAnnotations - __attribute__((__section__("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) = { - CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0, 0}; -@@ -291,7 +298,7 @@ reportOnCrash(uint32_t flags, const char *message) - char *newMessage; - if (oldMessage) { - asprintf(&newMessage, "%s%s", oldMessage, message); -- if (malloc_size(oldMessage)) free(oldMessage); -+ if (MALLOC_SIZE_FUNC(oldMessage)) free(oldMessage); - } else { - newMessage = strdup(message); - } diff --git a/patches/release/5.7/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch b/patches/release/5.7/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch deleted file mode 100644 index 185f68f2..00000000 --- a/patches/release/5.7/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch +++ /dev/null @@ -1,56 +0,0 @@ -From c49c13cd47983030cf6b880ba18317203c629c5e Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Wed, 21 Nov 2018 19:31:39 +0200 -Subject: [PATCH] Add LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE env variable - ---- - src/internal.h | 8 +++++++- - src/queue.c | 11 ++++++++++- - 2 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/src/internal.h b/src/internal.h -index 3cc16fc..da0e36a 100644 ---- a/src/internal.h -+++ b/src/internal.h -@@ -1112,6 +1112,12 @@ extern bool _dispatch_kevent_workqueue_enabled; - #include "inline_internal.h" - #include "firehose/firehose_internal.h" - --__END_DECLS -+#if !HAVE_PTHREAD_WORKQUEUE_KEVENT -+// copied from https://opensource.apple.com/source/libpthread/libpthread-301.50.1/kern/workqueue_internal.h.auto.html -+#define WORKQUEUE_MAXTHREADS 512 -+#define WORKQUEUE_CONSTRAINED_MAXTHREADS (WORKQUEUE_MAXTHREADS >> 3) -+#define WORKQUEUE_CONSTRAINED_FACTOR 5 -+#endif - -+__END_DECLS - #endif /* __DISPATCH_INTERNAL__ */ -diff --git a/src/queue.c b/src/queue.c -index 90f3cfa..9537d6f 100644 ---- a/src/queue.c -+++ b/src/queue.c -@@ -6168,10 +6168,19 @@ _dispatch_root_queue_init_pthread_pool(dispatch_queue_global_t dq, - int pool_size, dispatch_priority_t pri) - { - dispatch_pthread_root_queue_context_t pqc = dq->do_ctxt; -+ int32_t default_pool_size = 0; -+ char* default_pool_size_env = getenv("LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE"); -+ if (default_pool_size_env) { -+ default_pool_size = (int32_t) atoi(default_pool_size_env); -+ } -+ if (!default_pool_size) { -+ default_pool_size = (int32_t) MAX(dispatch_hw_config(active_cpus) * 5, WORKQUEUE_CONSTRAINED_MAXTHREADS); -+ } - int thread_pool_size = DISPATCH_WORKQ_MAX_PTHREAD_COUNT; - if (!(pri & DISPATCH_PRIORITY_FLAG_OVERCOMMIT)) { -- thread_pool_size = (int32_t)dispatch_hw_config(active_cpus); -+ thread_pool_size = default_pool_size; - } -+ - if (pool_size && pool_size < thread_pool_size) thread_pool_size = pool_size; - dq->dgq_thread_pool_size = thread_pool_size; - qos_class_t cls = _dispatch_qos_to_qos_class(_dispatch_priority_qos(pri) ?: --- -2.29.2 - diff --git a/patches/release/5.7/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch b/patches/release/5.7/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch deleted file mode 100644 index a253a64f..00000000 --- a/patches/release/5.7/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 7ec2726dfebcc6ce643a1bd87abb8179e673ac5b Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Tue, 30 Mar 2021 14:45:09 +0300 -Subject: [PATCH] Disable @objc and dynamic for linux. At parsing stage - ---- - include/swift/Basic/LangOptions.h | 5 +++++ - include/swift/Option/FrontendOptions.td | 5 +++++ - lib/Driver/ToolChains.cpp | 1 + - lib/Frontend/CompilerInvocation.cpp | 2 ++ - lib/Parse/ParseDecl.cpp | 24 ++++++++++++++++++++++++ - 5 files changed, 37 insertions(+) - -diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h -index aea1bf77a44..2ab7ba64184 100644 ---- a/include/swift/Basic/LangOptions.h -+++ b/include/swift/Basic/LangOptions.h -@@ -211,6 +211,11 @@ namespace swift { - /// was not compiled with -enable-testing. - bool EnableTestableAttrRequiresTestableModule = true; - -+ /// Experimental -+ /// Disables @objc and dynamic attrs -+ /// Ignored when EnableObjCInterop == true -+ bool DisableObjCAttr = false; -+ - /// - /// Flags for developers - /// -diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td -index 5a8cfcfaecb..a54261be0d5 100644 ---- a/include/swift/Option/FrontendOptions.td -+++ b/include/swift/Option/FrontendOptions.td -@@ -126,6 +126,11 @@ def verify_syntax_tree : Flag<["-"], "verify-syntax-tree">, - def show_diagnostics_after_fatal : Flag<["-"], "show-diagnostics-after-fatal">, - HelpText<"Keep emitting subsequent diagnostics after a fatal error">; - -+def experimental_disable_objc_attr : Flag<["-"], "experimental-disable-objc-attr">, -+ Flags<[FrontendOption]>, -+ HelpText<"Disables parsing @objc and dynamic attrs. " -+ "Ignored if Objective-C interop enabled">; -+ - def enable_cross_import_overlays : Flag<["-"], "enable-cross-import-overlays">, - HelpText<"Automatically import declared cross-import overlays.">; - def disable_cross_import_overlays : Flag<["-"], "disable-cross-import-overlays">, -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index a0bcf27b322..3410ad4aa85 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -237,6 +237,7 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI, - inputArgs.AddLastArg(arguments, options::OPT_warn_concurrency); - inputArgs.AddLastArg(arguments, options::OPT_strict_concurrency); - inputArgs.AddLastArg(arguments, options::OPT_warn_implicit_overrides); -+ inputArgs.AddLastArg(arguments, options::OPT_experimental_disable_objc_attr); - inputArgs.AddLastArg(arguments, options::OPT_typo_correction_limit); - inputArgs.AddLastArg(arguments, options::OPT_enable_app_extension); - inputArgs.AddLastArg(arguments, options::OPT_enable_library_evolution); -diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp -index b4e6ceb3dc8..05fcc8672a9 100644 ---- a/lib/Frontend/CompilerInvocation.cpp -+++ b/lib/Frontend/CompilerInvocation.cpp -@@ -485,6 +485,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args, - - Opts.EnableThrowWithoutTry |= Args.hasArg(OPT_enable_throw_without_try); - -+ Opts.DisableObjCAttr |= Args.hasArg(OPT_experimental_disable_objc_attr); -+ - if (auto A = Args.getLastArg(OPT_enable_objc_attr_requires_foundation_module, - OPT_disable_objc_attr_requires_foundation_module)) { - Opts.EnableObjCAttrRequiresFoundation -diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp -index 3341fcf45fe..4f9bdd7896b 100644 ---- a/lib/Parse/ParseDecl.cpp -+++ b/lib/Parse/ParseDecl.cpp -@@ -4233,6 +4233,30 @@ Parser::parseDecl(ParseDeclOptions Flags, - return DeclResult; - } - -+ if (auto SF = CurDeclContext->getParentSourceFile()) { -+ if (!InInactiveClauseEnvironment) { -+ -+ bool ObjCAttrDisabled = Context.LangOpts.DisableObjCAttr -+ && !Context.LangOpts.EnableObjCInterop; // do nothing if ObjCInterop enabled -+ -+ bool AttributesChanged = false; -+ -+ for (auto Attr : Attributes) { -+ if (isa(Attr)) { -+ if (ObjCAttrDisabled) { -+ Attr->setInvalid(); -+ Attributes.removeAttribute(Attr); -+ AttributesChanged = true; -+ } -+ } -+ } -+ -+ if (AttributesChanged) { -+ DeclResult.get()->getAttrs() = Attributes; -+ } -+ } -+ } -+ - if (DeclResult.isNonNull()) { - Decl *D = DeclResult.get(); - if (!HandlerAlreadyCalled) --- -2.29.2 - diff --git a/patches/release/5.7/swift/0002-Add-presets-for-android-x86-x86_64.patch b/patches/release/5.7/swift/0002-Add-presets-for-android-x86-x86_64.patch deleted file mode 100644 index 6d3f5ee3..00000000 --- a/patches/release/5.7/swift/0002-Add-presets-for-android-x86-x86_64.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 86b27676cc71ecbe7bb4919605dc34636a711493 Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Mon, 24 Jun 2019 20:54:23 +0000 -Subject: [PATCH 2/7] Add presets for android x86 x86_64 - ---- - utils/build-presets.ini | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) - -diff --git a/utils/build-presets.ini b/utils/build-presets.ini -index 5d5b45c6413..46ad038f6dc 100644 -@@ -917,6 +917,20 @@ mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build - - android-arch=aarch64 - -+[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,x86] -+mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build -+ -+dash-dash -+ -+android-arch=i686 -+ -+[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,x86_64] -+mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build -+ -+dash-dash -+ -+android-arch=x86_64 -+ - # Ubuntu 18.04 preset for backwards compat and future customizations. - [preset: buildbot_linux_1804] - mixin-preset=buildbot_linux --- -2.29.2 - diff --git a/patches/release/5.7/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch b/patches/release/5.7/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch deleted file mode 100644 index 3f5f5fa6..00000000 --- a/patches/release/5.7/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch +++ /dev/null @@ -1,78 +0,0 @@ -From e092458ed013b43de2dbaea9442f947a4c238ed4 Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Wed, 31 Mar 2021 14:21:26 +0300 -Subject: [PATCH 3/7] Forward android-arch form build-script to - build-script-impl in case of i686 - ---- - utils/build-presets.ini | 7 +++++++ - utils/build-script | 3 +++ - utils/build_swift/build_swift/driver_arguments.py | 4 ++-- - utils/swift_build_support/swift_build_support/targets.py | 2 +- - 4 files changed, 13 insertions(+), 3 deletions(-) - -diff --git a/utils/build-presets.ini b/utils/build-presets.ini -index 46ad038f6dc..6c59d8d2ed4 100644 ---- a/utils/build-presets.ini -+++ b/utils/build-presets.ini -@@ -912,6 +912,13 @@ skip-build-benchmarks - - reconfigure - -+[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,armv7] -+mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build -+ -+dash-dash -+ -+android-arch=armv7 -+ - [preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,aarch64] - mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build - -diff --git a/utils/build-script b/utils/build-script -index b8e50140d1d..4e2506c9e29 100755 ---- a/utils/build-script -+++ b/utils/build-script -@@ -356,6 +356,9 @@ def apply_default_arguments(toolchain, args): - elif args.android_arch == "aarch64": - args.stdlib_deployment_targets.append( - StdlibDeploymentTarget.Android.aarch64.name) -+ elif args.android_arch == "i686": -+ args.stdlib_deployment_targets.append( -+ StdlibDeploymentTarget.Android.i686.name) - elif args.android_arch == "x86_64": - args.stdlib_deployment_targets.append( - StdlibDeploymentTarget.Android.x86_64.name) -diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py -index 1e2ca9b1d06..5b7ca533ce1 100644 ---- a/utils/build_swift/build_swift/driver_arguments.py -+++ b/utils/build_swift/build_swift/driver_arguments.py -@@ -1101,10 +1101,10 @@ def create_argument_parser(): - android.adb.commands.DEVICE_TEMP_DIR)) - - option('--android-arch', store, -- choices=['armv7', 'aarch64', 'x86_64'], -+ choices=['armv7', 'aarch64', 'i686', 'x86_64'], - default='armv7', - help='The target architecture when building for Android. ' -- 'Currently, only armv7, aarch64, and x86_64 are supported. ' -+ 'Currently, only armv7, aarch64, i686, and x86_64 are supported. ' - '%(default)s is the default.') - - # ------------------------------------------------------------------------- -diff --git a/utils/swift_build_support/swift_build_support/targets.py b/utils/swift_build_support/swift_build_support/targets.py -index cb42f52c633..ded5af52681 100644 ---- a/utils/swift_build_support/swift_build_support/targets.py -+++ b/utils/swift_build_support/swift_build_support/targets.py -@@ -201,7 +201,7 @@ class StdlibDeploymentTarget(object): - - Cygwin = Platform("cygwin", archs=["x86_64"]) - -- Android = AndroidPlatform("android", archs=["armv7", "aarch64", "x86_64"]) -+ Android = AndroidPlatform("android", archs=["armv7", "aarch64", "i686", "x86_64"]) - - Windows = Platform("windows", archs=["x86_64"]) - --- -2.29.2 - diff --git a/patches/release/5.7/swift/0004-Fix-spelling-arm_dir-icu_dir.patch b/patches/release/5.7/swift/0004-Fix-spelling-arm_dir-icu_dir.patch deleted file mode 100644 index 5ba7d329..00000000 --- a/patches/release/5.7/swift/0004-Fix-spelling-arm_dir-icu_dir.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 89da66227b3bd3882392b29b51da4aff52ae078f Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Thu, 1 Apr 2021 15:57:54 +0300 -Subject: [PATCH 5/7] Fix spelling arm_dir -> icu_dir - ---- - utils/build_swift/tests/build_swift/test_presets.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/utils/build_swift/tests/build_swift/test_presets.py b/utils/build_swift/tests/build_swift/test_presets.py -index 2668d7a8d79..92ad63251b0 100644 ---- a/utils/build_swift/tests/build_swift/test_presets.py -+++ b/utils/build_swift/tests/build_swift/test_presets.py -@@ -46,7 +46,7 @@ PRESET_DEFAULTS = { - 'swift_install_destdir': '/tmp/install/swift', - 'symbols_package': '/path/to/symbols/package', - 'ndk_path': '/path/to/ndk', -- 'arm_dir': '/path/to/arm', -+ 'icu_dir': '/path/to/arm', - 'toolchain_path': '/tmp/toolchain', - } - --- -2.29.2 - diff --git a/patches/release/5.7/swift/0005-Disable-all-tests.patch b/patches/release/5.7/swift/0005-Disable-all-tests.patch deleted file mode 100644 index 86d8b77e..00000000 --- a/patches/release/5.7/swift/0005-Disable-all-tests.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/utils/build-presets.ini b/utils/build-presets.ini -index 84b0baaa41d..ebbac0abd71 100644 ---- a/utils/build-presets.ini -+++ b/utils/build-presets.ini -@@ -841,8 +841,6 @@ build-swift-stdlib-unittest-extra - # Executes the lit tests for the installable package that is created - # Assumes the swift-integration-tests repo is checked out - --test-installable-package -- - # Build the benchmarks against the toolchain. - toolchain-benchmarks - -@@ -914,12 +912,6 @@ mixin-preset= - build-subdir=buildbot_linux - - release --test --validation-test --long-test --stress-test --test-optimized --lit-args=-v --time-tests - - build-ninja - -@@ -936,8 +928,6 @@ install-destdir=%(install_destdir)s - # Path to the .tar.gz package we would create. - installable-package=%(installable_package)s - --host-test -- - install-prefix=/usr - install-llvm - install-swift diff --git a/patches/release/5.7/swift/0006-Disable-tests-acording-to-https-github.aaakk.us.kg-apple-swi.patch b/patches/release/5.7/swift/0006-Disable-tests-acording-to-https-github.aaakk.us.kg-apple-swi.patch deleted file mode 100644 index 2c4626fc..00000000 --- a/patches/release/5.7/swift/0006-Disable-tests-acording-to-https-github.aaakk.us.kg-apple-swi.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 06d2b3cfcf6242f936abb66095f789c021701e50 Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Thu, 1 Apr 2021 15:58:18 +0300 -Subject: [PATCH 6/7] Disable tests acording to - https://github.com/apple/swift/pull/34491 - ---- - test/Interop/Cxx/class/memory-layout-silgen.swift | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/test/Interop/Cxx/class/memory-layout-silgen.swift b/test/Interop/Cxx/class/memory-layout-silgen.swift -index 3567242c2ea..c0b531ca317 100644 ---- a/test/Interop/Cxx/class/memory-layout-silgen.swift -+++ b/test/Interop/Cxx/class/memory-layout-silgen.swift -@@ -1,5 +1,8 @@ - // RUN: %target-swiftxx-frontend -I %S/Inputs -emit-ir -o - %s | %FileCheck %s - -+// UNSUPPORTED: OS=linux-android -+// UNSUPPORTED: OS=linux-androideabi -+ - import MemoryLayout - - var v = PrivateMemberLayout() --- -2.29.2 - diff --git a/patches/release/5.7/swift/0007-Update-to-LTS-NDK-25b.patch b/patches/release/5.7/swift/0007-Update-to-LTS-NDK-25b.patch deleted file mode 100644 index 8cb6fbbe..00000000 --- a/patches/release/5.7/swift/0007-Update-to-LTS-NDK-25b.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 7a0dd2385a4149ae2c2f1ba0b34afbe98ec33056 Mon Sep 17 00:00:00 2001 -From: buttaface -Date: Wed, 21 Sep 2022 23:16:29 +0530 -Subject: [PATCH] [android] Update to LTS NDK 25b (#60938) - -Also, remove `SWIFT_ANDROID_NDK_CLANG_VERSION` and just extract the -resource directory from the NDK using `file(GLOB)`. ---- - CMakeLists.txt | 2 -- - docs/Android.md | 10 +++++----- - stdlib/cmake/modules/AddSwiftStdlib.cmake | 3 ++- - 3 files changed, 7 insertions(+), 8 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c21c550c235..e5f3153797b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -315,8 +315,6 @@ set(SWIFT_ANDROID_API_LEVEL "" CACHE STRING - - set(SWIFT_ANDROID_NDK_PATH "" CACHE STRING - "Path to the directory that contains the Android NDK tools that are executable on the build machine") --set(SWIFT_ANDROID_NDK_CLANG_VERSION "12.0.8" CACHE STRING -- "The Clang version to use when building for Android.") - set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING - "Path on an Android device where build products will be pushed. These are used when running the test suite against the device") - -diff --git a/stdlib/cmake/modules/AddSwiftStdlib.cmake b/stdlib/cmake/modules/AddSwiftStdlib.cmake -index f44b978c896..f4d55ab285f 100644 ---- a/stdlib/cmake/modules/AddSwiftStdlib.cmake -+++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake -@@ -457,7 +457,8 @@ function(_add_target_variant_link_flags) - # We need to add the math library, which is linked implicitly by libc++ - list(APPEND result "-lm") - if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "") -- list(APPEND result "-resource-dir=${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib64/clang/${SWIFT_ANDROID_NDK_CLANG_VERSION}") -+ file(GLOB RESOURCE_DIR ${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib64/clang/*) -+ list(APPEND result "-resource-dir=${RESOURCE_DIR}") - endif() - - # link against the custom C++ library --- -2.37.0 - diff --git a/patches/release/5.7/swift/0008-Enable-crashlytics-and-build-ids.patch b/patches/release/5.7/swift/0008-Enable-crashlytics-and-build-ids.patch deleted file mode 100644 index eb1a996f..00000000 --- a/patches/release/5.7/swift/0008-Enable-crashlytics-and-build-ids.patch +++ /dev/null @@ -1,271 +0,0 @@ -diff --git a/stdlib/cmake/modules/AddSwiftStdlib.cmake b/stdlib/cmake/modules/AddSwiftStdlib.cmake -index ddfcd7e3e54..fac2247c5e9 100644 ---- a/stdlib/cmake/modules/AddSwiftStdlib.cmake -+++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake -@@ -2447,6 +2447,8 @@ function(add_swift_target_library name) - list(APPEND swiftlib_link_flags_all "-shared") - # TODO: Instead of `lib${name}.so` find variable or target property which already have this value. - list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so") -+ # Add the build-id flag to ensure a unique identifier is included in the output binary. -+ list(APPEND swiftlib_link_flags_all "-Wl,--build-id") - endif() - - if (SWIFTLIB_BACK_DEPLOYMENT_LIBRARY) -diff --git a/stdlib/public/runtime/Errors.cpp b/stdlib/public/runtime/Errors.cpp -index 26e3a01998c..a53a3251c48 100644 ---- a/stdlib/public/runtime/Errors.cpp -+++ b/stdlib/public/runtime/Errors.cpp -@@ -55,6 +55,10 @@ - #include - #elif defined(__ANDROID__) - #include -+#pragma clang diagnostic push -+#pragma clang diagnostic ignored "-Wexit-time-destructors" -+#include "crashlytics.h" -+#pragma clang diagnostic pop - #endif - - #if defined(__ELF__) -@@ -315,6 +319,8 @@ reportOnCrash(uint32_t flags, const char *message) - &oldMessage, newMessage, - std::memory_order_release, - SWIFT_MEMORY_ORDER_CONSUME)); -+#elif defined(__ANDROID__) -+ firebase::crashlytics::Log(message); - #else - // empty - #endif // SWIFT_HAVE_CRASHREPORTERCLIENT -diff --git a/stdlib/public/runtime/crashlytics.h b/stdlib/public/runtime/crashlytics.h -new file mode 100644 -index 00000000000..2571080a28a ---- /dev/null -+++ b/stdlib/public/runtime/crashlytics.h -@@ -0,0 +1,227 @@ -+// Copyright 2020 Google LLC -+// -+// Licensed under the Apache License, Version 2.0 (the "License"); -+// you may not use this file except in compliance with the License. -+// You may obtain a copy of the License at -+// -+// http://www.apache.org/licenses/LICENSE-2.0 -+// -+// Unless required by applicable law or agreed to in writing, software -+// distributed under the License is distributed on an "AS IS" BASIS, -+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+// See the License for the specific language governing permissions and -+// limitations under the License. -+#ifndef __CRASHLYTICS_H__ -+#define __CRASHLYTICS_H__ -+ -+#include -+#include -+#include -+#include -+#include -+ -+/// @brief Firebase Crashlytics NDK API, for Android apps which use native code. -+/// -+/// This API is optional: It enables adding custom metadata to your native Crashlytics crash -+/// reports. See the developer guides -+/// for information on using Firebase Crashlytics in your NDK-enabled Android apps. -+namespace firebase { namespace crashlytics { -+ -+/** PUBLIC API **/ -+ -+/// @brief Initialize the Crashlytics NDK API, for Android apps using native code. -+/// -+/// This allows finer grained control of when the native API is initialized. Calling this -+/// function is not not strictly necessary as the API will be initialized on the first call -+/// to any of the functions within the firebase::crashlytics namespace. -+/// -+/// This call is only required for adding custom metadata to crash reports. Use of -+/// this header file is NOT required for Android NDK crash reporting. -+inline bool Initialize(); -+ -+/// Deprecated; now a no-op and does not need to be called. -+inline void Terminate(); -+ -+/// @brief Logs a message to be included in the next fatal or non-fatal report. -+inline void Log(const char* msg); -+ -+/// @brief Records a custom key and value to be associated with subsequent fatal and non-fatal -+/// reports. -+inline void SetCustomKey(const char* key, bool value); -+ -+/// @brief Records a custom key and value to be associated with subsequent fatal and non-fatal -+/// reports. -+inline void SetCustomKey(const char* key, const char *value); -+ -+/// @brief Records a custom key and value to be associated with subsequent fatal and non-fatal -+/// reports. -+inline void SetCustomKey(const char* key, double value); -+ -+/// @brief Records a custom key and value to be associated with subsequent fatal and non-fatal -+/// reports. -+inline void SetCustomKey(const char* key, float value); -+ -+/// @brief Records a custom key and value to be associated with subsequent fatal and non-fatal -+/// reports. -+inline void SetCustomKey(const char* key, int value); -+ -+/// @brief Records a custom key and value to be associated with subsequent fatal and non-fatal -+/// reports. -+inline void SetCustomKey(const char* key, long value); -+ -+/// @brief Records a user ID (identifier) that's associated with subsequent fatal and non-fatal -+/// reports. -+inline void SetUserId(const char* id); -+ -+/** END PUBLIC API **/ -+ -+namespace detail { -+ -+struct __crashlytics_context; -+struct __crashlytics_unspecified; -+typedef struct __crashlytics_context __crashlytics_context_t; -+typedef struct __crashlytics_unspecified __crashlytics_unspecified_t; -+ -+typedef __crashlytics_unspecified_t* (*__crashlytics_initialize_t) (); -+typedef void (*__crashlytics_set_internal_t) (__crashlytics_unspecified_t *, const char *, const char *); -+typedef void (*__crashlytics_log_internal_t) (__crashlytics_unspecified_t *, const char *); -+typedef void (*__crashlytics_set_user_id_internal_t) (__crashlytics_unspecified_t *, const char *); -+typedef void (*__crashlytics_dispose_t) (__crashlytics_unspecified_t *); -+ -+struct __crashlytics_context { -+ __crashlytics_set_internal_t __set; -+ __crashlytics_log_internal_t __log; -+ __crashlytics_set_user_id_internal_t __set_user_id; -+ -+ __crashlytics_unspecified_t* __ctx; -+ __crashlytics_dispose_t __dispose; -+}; -+ -+#define __CRASHLYTICS_NULL_CONTEXT (struct __crashlytics_context *) 0 -+#define __CRASHLYTICS_INITIALIZE_FAILURE (struct __crashlytics_unspecified *) 0 -+#define __CRASHLYTICS_DECORATED __attribute__ ((always_inline)) -+ -+inline const __crashlytics_context_t* __crashlytics_context() __CRASHLYTICS_DECORATED; -+inline __crashlytics_context_t* __crashlytics_init() __CRASHLYTICS_DECORATED; -+ -+inline void invoke(const std::function& func) __CRASHLYTICS_DECORATED; -+ -+} // end namespace detail -+ -+inline bool Initialize() { -+ return detail::__crashlytics_context() != nullptr; -+} -+ -+inline void Terminate() { -+ // no-op -+} -+ -+inline void Log(const char* msg) { -+ detail::invoke([&](const detail::__crashlytics_context_t* context) { -+ context->__log(context->__ctx, msg); -+ }); -+} -+ -+inline void SetCustomKey(const char* key, const char* value) { -+ detail::invoke([&](const detail::__crashlytics_context_t* context) { -+ context->__set(context->__ctx, key, value); -+ }); -+} -+ -+inline void SetCustomKey(const char* key, bool value) { -+ SetCustomKey(key, value ? "true" : "false"); -+} -+ -+inline void SetCustomKey(const char* key, double value) { -+ SetCustomKey(key, std::to_string(value).c_str()); -+} -+ -+inline void SetCustomKey(const char* key, float value) { -+ SetCustomKey(key, std::to_string(value).c_str()); -+} -+ -+inline void SetCustomKey(const char* key, int value) { -+ SetCustomKey(key, std::to_string(value).c_str()); -+} -+ -+inline void SetCustomKey(const char* key, long value) { -+ SetCustomKey(key, std::to_string(value).c_str()); -+} -+ -+inline void SetUserId(const char* id) { -+ detail::invoke([&](const detail::__crashlytics_context_t* context) { -+ context->__set_user_id(context->__ctx, id); -+ }); -+} -+ -+namespace detail { -+ -+#define __CRASHLYTICS_NULL_ON_NULL(expression) \ -+ do { \ -+ if (((expression)) == NULL) { \ -+ return NULL; \ -+ } \ -+ } while (0) -+ -+inline __crashlytics_context_t* __crashlytics_construct( -+ __crashlytics_unspecified_t* ctx, void* sym_set, void* sym_log, void* sym_dispose, void* sym_set_user_id) __CRASHLYTICS_DECORATED; -+inline __crashlytics_context_t* __crashlytics_construct( -+ __crashlytics_unspecified_t* ctx, void* sym_set, void* sym_log, void* sym_dispose, void* sym_set_user_id) { -+ __crashlytics_context_t* context; -+ -+ __CRASHLYTICS_NULL_ON_NULL(context = new __crashlytics_context_t); -+ -+ context->__set = (__crashlytics_set_internal_t) sym_set; -+ context->__log = (__crashlytics_log_internal_t) sym_log; -+ context->__set_user_id = (__crashlytics_set_user_id_internal_t) sym_set_user_id; -+ context->__ctx = ctx; -+ context->__dispose = (__crashlytics_dispose_t) sym_dispose; -+ -+ return context; -+} -+ -+inline const __crashlytics_context_t* __crashlytics_context() { -+ static std::unique_ptr<__crashlytics_context_t> context { __crashlytics_init() }; -+ return context.get(); -+} -+ -+inline __crashlytics_context_t* __crashlytics_init() { -+ void* lib; -+ void* sym_ini; -+ void* sym_log; -+ void* sym_set; -+ void* sym_dispose; -+ void* sym_set_user_id; -+ -+ __CRASHLYTICS_NULL_ON_NULL(lib = dlopen("libcrashlytics.so", RTLD_LAZY | RTLD_LOCAL)); -+ __CRASHLYTICS_NULL_ON_NULL(sym_ini = dlsym(lib, "external_api_initialize")); -+ __CRASHLYTICS_NULL_ON_NULL(sym_set = dlsym(lib, "external_api_set")); -+ __CRASHLYTICS_NULL_ON_NULL(sym_log = dlsym(lib, "external_api_log")); -+ __CRASHLYTICS_NULL_ON_NULL(sym_dispose = dlsym(lib, "external_api_dispose")); -+ __CRASHLYTICS_NULL_ON_NULL(sym_set_user_id = dlsym(lib, "external_api_set_user_id")); -+ -+ __crashlytics_unspecified_t* ctx = ((__crashlytics_initialize_t) sym_ini)(); -+ -+ return ctx == __CRASHLYTICS_INITIALIZE_FAILURE -+ ? __CRASHLYTICS_NULL_CONTEXT -+ : __crashlytics_construct( -+ ctx, -+ sym_set, -+ sym_log, -+ sym_dispose, -+ sym_set_user_id -+ ); -+} -+ -+inline void invoke(const std::function& func) { -+ const __crashlytics_context_t* context = __crashlytics_context(); -+ if (context != nullptr) { -+ func(context); -+ } -+} -+ -+} // end namespace detail -+ -+}} // end namespace firebase::crashlytics -+ -+#endif /* __CRASHLYTICS_H__ */ -\ No newline at end of file diff --git a/patches/release/6.0/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch b/patches/release/6.0/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch deleted file mode 100644 index 185f68f2..00000000 --- a/patches/release/6.0/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch +++ /dev/null @@ -1,56 +0,0 @@ -From c49c13cd47983030cf6b880ba18317203c629c5e Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Wed, 21 Nov 2018 19:31:39 +0200 -Subject: [PATCH] Add LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE env variable - ---- - src/internal.h | 8 +++++++- - src/queue.c | 11 ++++++++++- - 2 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/src/internal.h b/src/internal.h -index 3cc16fc..da0e36a 100644 ---- a/src/internal.h -+++ b/src/internal.h -@@ -1112,6 +1112,12 @@ extern bool _dispatch_kevent_workqueue_enabled; - #include "inline_internal.h" - #include "firehose/firehose_internal.h" - --__END_DECLS -+#if !HAVE_PTHREAD_WORKQUEUE_KEVENT -+// copied from https://opensource.apple.com/source/libpthread/libpthread-301.50.1/kern/workqueue_internal.h.auto.html -+#define WORKQUEUE_MAXTHREADS 512 -+#define WORKQUEUE_CONSTRAINED_MAXTHREADS (WORKQUEUE_MAXTHREADS >> 3) -+#define WORKQUEUE_CONSTRAINED_FACTOR 5 -+#endif - -+__END_DECLS - #endif /* __DISPATCH_INTERNAL__ */ -diff --git a/src/queue.c b/src/queue.c -index 90f3cfa..9537d6f 100644 ---- a/src/queue.c -+++ b/src/queue.c -@@ -6168,10 +6168,19 @@ _dispatch_root_queue_init_pthread_pool(dispatch_queue_global_t dq, - int pool_size, dispatch_priority_t pri) - { - dispatch_pthread_root_queue_context_t pqc = dq->do_ctxt; -+ int32_t default_pool_size = 0; -+ char* default_pool_size_env = getenv("LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE"); -+ if (default_pool_size_env) { -+ default_pool_size = (int32_t) atoi(default_pool_size_env); -+ } -+ if (!default_pool_size) { -+ default_pool_size = (int32_t) MAX(dispatch_hw_config(active_cpus) * 5, WORKQUEUE_CONSTRAINED_MAXTHREADS); -+ } - int thread_pool_size = DISPATCH_WORKQ_MAX_PTHREAD_COUNT; - if (!(pri & DISPATCH_PRIORITY_FLAG_OVERCOMMIT)) { -- thread_pool_size = (int32_t)dispatch_hw_config(active_cpus); -+ thread_pool_size = default_pool_size; - } -+ - if (pool_size && pool_size < thread_pool_size) thread_pool_size = pool_size; - dq->dgq_thread_pool_size = thread_pool_size; - qos_class_t cls = _dispatch_qos_to_qos_class(_dispatch_priority_qos(pri) ?: --- -2.29.2 - diff --git a/patches/release/6.0/swift/0002-Add-presets-for-android-x86-x86_64.patch b/patches/release/6.0/swift/0002-Add-presets-for-android-x86-x86_64.patch deleted file mode 100644 index 6d3f5ee3..00000000 --- a/patches/release/6.0/swift/0002-Add-presets-for-android-x86-x86_64.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 86b27676cc71ecbe7bb4919605dc34636a711493 Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Mon, 24 Jun 2019 20:54:23 +0000 -Subject: [PATCH 2/7] Add presets for android x86 x86_64 - ---- - utils/build-presets.ini | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) - -diff --git a/utils/build-presets.ini b/utils/build-presets.ini -index 5d5b45c6413..46ad038f6dc 100644 -@@ -917,6 +917,20 @@ mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build - - android-arch=aarch64 - -+[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,x86] -+mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build -+ -+dash-dash -+ -+android-arch=i686 -+ -+[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,x86_64] -+mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build -+ -+dash-dash -+ -+android-arch=x86_64 -+ - # Ubuntu 18.04 preset for backwards compat and future customizations. - [preset: buildbot_linux_1804] - mixin-preset=buildbot_linux --- -2.29.2 - diff --git a/patches/release/6.0/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch b/patches/release/6.0/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch deleted file mode 100644 index 3f5f5fa6..00000000 --- a/patches/release/6.0/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch +++ /dev/null @@ -1,78 +0,0 @@ -From e092458ed013b43de2dbaea9442f947a4c238ed4 Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Wed, 31 Mar 2021 14:21:26 +0300 -Subject: [PATCH 3/7] Forward android-arch form build-script to - build-script-impl in case of i686 - ---- - utils/build-presets.ini | 7 +++++++ - utils/build-script | 3 +++ - utils/build_swift/build_swift/driver_arguments.py | 4 ++-- - utils/swift_build_support/swift_build_support/targets.py | 2 +- - 4 files changed, 13 insertions(+), 3 deletions(-) - -diff --git a/utils/build-presets.ini b/utils/build-presets.ini -index 46ad038f6dc..6c59d8d2ed4 100644 ---- a/utils/build-presets.ini -+++ b/utils/build-presets.ini -@@ -912,6 +912,13 @@ skip-build-benchmarks - - reconfigure - -+[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,armv7] -+mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build -+ -+dash-dash -+ -+android-arch=armv7 -+ - [preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build,aarch64] - mixin-preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build - -diff --git a/utils/build-script b/utils/build-script -index b8e50140d1d..4e2506c9e29 100755 ---- a/utils/build-script -+++ b/utils/build-script -@@ -356,6 +356,9 @@ def apply_default_arguments(toolchain, args): - elif args.android_arch == "aarch64": - args.stdlib_deployment_targets.append( - StdlibDeploymentTarget.Android.aarch64.name) -+ elif args.android_arch == "i686": -+ args.stdlib_deployment_targets.append( -+ StdlibDeploymentTarget.Android.i686.name) - elif args.android_arch == "x86_64": - args.stdlib_deployment_targets.append( - StdlibDeploymentTarget.Android.x86_64.name) -diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py -index 1e2ca9b1d06..5b7ca533ce1 100644 ---- a/utils/build_swift/build_swift/driver_arguments.py -+++ b/utils/build_swift/build_swift/driver_arguments.py -@@ -1101,10 +1101,10 @@ def create_argument_parser(): - android.adb.commands.DEVICE_TEMP_DIR)) - - option('--android-arch', store, -- choices=['armv7', 'aarch64', 'x86_64'], -+ choices=['armv7', 'aarch64', 'i686', 'x86_64'], - default='armv7', - help='The target architecture when building for Android. ' -- 'Currently, only armv7, aarch64, and x86_64 are supported. ' -+ 'Currently, only armv7, aarch64, i686, and x86_64 are supported. ' - '%(default)s is the default.') - - # ------------------------------------------------------------------------- -diff --git a/utils/swift_build_support/swift_build_support/targets.py b/utils/swift_build_support/swift_build_support/targets.py -index cb42f52c633..ded5af52681 100644 ---- a/utils/swift_build_support/swift_build_support/targets.py -+++ b/utils/swift_build_support/swift_build_support/targets.py -@@ -201,7 +201,7 @@ class StdlibDeploymentTarget(object): - - Cygwin = Platform("cygwin", archs=["x86_64"]) - -- Android = AndroidPlatform("android", archs=["armv7", "aarch64", "x86_64"]) -+ Android = AndroidPlatform("android", archs=["armv7", "aarch64", "i686", "x86_64"]) - - Windows = Platform("windows", archs=["x86_64"]) - --- -2.29.2 - diff --git a/patches/release/6.0/swift/0004-Fix-spelling-arm_dir-icu_dir.patch b/patches/release/6.0/swift/0004-Fix-spelling-arm_dir-icu_dir.patch deleted file mode 100644 index 5ba7d329..00000000 --- a/patches/release/6.0/swift/0004-Fix-spelling-arm_dir-icu_dir.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 89da66227b3bd3882392b29b51da4aff52ae078f Mon Sep 17 00:00:00 2001 -From: Anton Pogonets -Date: Thu, 1 Apr 2021 15:57:54 +0300 -Subject: [PATCH 5/7] Fix spelling arm_dir -> icu_dir - ---- - utils/build_swift/tests/build_swift/test_presets.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/utils/build_swift/tests/build_swift/test_presets.py b/utils/build_swift/tests/build_swift/test_presets.py -index 2668d7a8d79..92ad63251b0 100644 ---- a/utils/build_swift/tests/build_swift/test_presets.py -+++ b/utils/build_swift/tests/build_swift/test_presets.py -@@ -46,7 +46,7 @@ PRESET_DEFAULTS = { - 'swift_install_destdir': '/tmp/install/swift', - 'symbols_package': '/path/to/symbols/package', - 'ndk_path': '/path/to/ndk', -- 'arm_dir': '/path/to/arm', -+ 'icu_dir': '/path/to/arm', - 'toolchain_path': '/tmp/toolchain', - } - --- -2.29.2 - diff --git a/patches/release/5.10/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch b/patches/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch similarity index 100% rename from patches/release/5.10/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch rename to patches/swift-corelibs-libdispatch/0001-Add-LIBDISPATCH_DEFAULT_THREAD_POOL_SIZE-env-variabl.patch diff --git a/patches/swift-syntax/0001-Add-Android-import.patch b/patches/swift-syntax/0001-Add-Android-import.patch new file mode 100644 index 00000000..319175a0 --- /dev/null +++ b/patches/swift-syntax/0001-Add-Android-import.patch @@ -0,0 +1,13 @@ +diff --git a/Sources/SwiftLibraryPluginProvider/LibraryPluginProvider.swift b/Sources/SwiftLibraryPluginProvider/LibraryPluginProvider.swift +index eb06cca2..798fc369 100644 +--- a/Sources/SwiftLibraryPluginProvider/LibraryPluginProvider.swift ++++ b/Sources/SwiftLibraryPluginProvider/LibraryPluginProvider.swift +@@ -20,6 +20,8 @@ private import _SwiftLibraryPluginProviderCShims + private import Darwin + #elseif canImport(Glibc) + private import Glibc ++#elseif canImport(Android) ++private import Android + #elseif canImport(Musl) + private import Musl + #endif diff --git a/patches/release/6.0/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch b/patches/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch similarity index 100% rename from patches/release/6.0/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch rename to patches/swift/0001-Disable-objc-and-dynamic-for-linux.-At-parsing-stage.patch diff --git a/patches/release/5.10/swift/0002-Add-presets-for-android-x86-x86_64.patch b/patches/swift/0002-Add-presets-for-android-x86-x86_64.patch similarity index 100% rename from patches/release/5.10/swift/0002-Add-presets-for-android-x86-x86_64.patch rename to patches/swift/0002-Add-presets-for-android-x86-x86_64.patch diff --git a/patches/release/5.4/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch b/patches/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch similarity index 100% rename from patches/release/5.4/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch rename to patches/swift/0003-Forward-android-arch-form-build-script-to-build-scri.patch diff --git a/patches/release/5.10/swift/0004-Fix-spelling-arm_dir-icu_dir.patch b/patches/swift/0004-Fix-spelling-arm_dir-icu_dir.patch similarity index 100% rename from patches/release/5.10/swift/0004-Fix-spelling-arm_dir-icu_dir.patch rename to patches/swift/0004-Fix-spelling-arm_dir-icu_dir.patch diff --git a/patches/release/6.0/swift/0005-Disable-all-tests.patch b/patches/swift/0005-Disable-all-tests.patch similarity index 100% rename from patches/release/6.0/swift/0005-Disable-all-tests.patch rename to patches/swift/0005-Disable-all-tests.patch