From 2e6bb9a775a9f9bf4a2f0b69f455be63868f1291 Mon Sep 17 00:00:00 2001 From: Finagolfin Date: Thu, 6 Nov 2025 04:30:57 +0530 Subject: [PATCH 1/2] Use the new `#available(Android , *)` instead from Swift 6.3 to look for `backtrace()` Mads added this compiler feature for Android in swiftlang/swift#84574 before the 6.3 branch, so update the Android triples and NDK version to test it, as it requires NDK 28 or later. --- .github/workflows/pull_request.yml | 2 ++ Sources/Testing/SourceAttribution/Backtrace.swift | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 246a1adb5..62b0f2b17 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -25,6 +25,8 @@ jobs: ios_host_exclude_xcode_versions: '[{"xcode_version": "16.2"}, {"xcode_version": "16.3"}, {"xcode_version": "16.4"}]' enable_wasm_sdk_build: true enable_android_sdk_build: true + android_ndk_versions: '["r28c"]' + android_sdk_triples: '["aarch64-unknown-linux-android33", "x86_64-unknown-linux-android28"]' soundness: name: Soundness uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.6 diff --git a/Sources/Testing/SourceAttribution/Backtrace.swift b/Sources/Testing/SourceAttribution/Backtrace.swift index 552e16d68..e9f53816e 100644 --- a/Sources/Testing/SourceAttribution/Backtrace.swift +++ b/Sources/Testing/SourceAttribution/Backtrace.swift @@ -40,7 +40,7 @@ public struct Backtrace: Sendable { self.addresses = addresses.map { Address(UInt(bitPattern: $0)) } } -#if os(Android) && !SWT_NO_DYNAMIC_LINKING +#if compiler(<6.3) && os(Android) /// The `backtrace()` function. /// /// This function was added to Android with API level 33, which is higher than @@ -76,7 +76,13 @@ public struct Backtrace: Sendable { initializedCount = .init(clamping: backtrace(addresses.baseAddress!, .init(clamping: addresses.count))) } #elseif os(Android) -#if !SWT_NO_DYNAMIC_LINKING +#if compiler(>=6.3) + if #available(Android 33, *) { + initializedCount = addresses.withMemoryRebound(to: UnsafeMutableRawPointer.self) { addresses in + .init(clamping: backtrace(addresses.baseAddress!, .init(clamping: addresses.count))) + } + } +#else if let _backtrace { initializedCount = .init(clamping: _backtrace(addresses.baseAddress!, .init(clamping: addresses.count))) } From 534c0d45ae56276978fec2c656dc68f1ef9ee144 Mon Sep 17 00:00:00 2001 From: Finagolfin Date: Sat, 24 Jan 2026 23:30:42 +0530 Subject: [PATCH 2/2] Try new emulator testing, probably won't work because of macros --- .github/workflows/pull_request.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 62b0f2b17..561f9e57d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -25,6 +25,7 @@ jobs: ios_host_exclude_xcode_versions: '[{"xcode_version": "16.2"}, {"xcode_version": "16.3"}, {"xcode_version": "16.4"}]' enable_wasm_sdk_build: true enable_android_sdk_build: true + enable_android_sdk_checks: true android_ndk_versions: '["r28c"]' android_sdk_triples: '["aarch64-unknown-linux-android33", "x86_64-unknown-linux-android28"]' soundness: