Skip to content

Commit b4cca45

Browse files
authored
Merge pull request #3802 from swiftwasm/release/5.5
[pull] swiftwasm-release/5.5 from release/5.5
2 parents 2545ee5 + 21421b4 commit b4cca45

File tree

5 files changed

+51
-1
lines changed

5 files changed

+51
-1
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,6 +1830,15 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
18301830
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
18311831
A->getAsString(Args), A->getValue());
18321832
}
1833+
} else if (Triple.isWatchOS() && !Triple.isSimulatorEnvironment()) {
1834+
// watchOS does not support auto async frame pointers due to bitcode, so
1835+
// silently override "auto" to "never" when back-deploying. This approach
1836+
// sacrifies async backtraces when back-deploying but prevents crashes in
1837+
// older tools that cannot handle the async frame bit in the frame pointer.
1838+
unsigned major, minor, micro;
1839+
Triple.getWatchOSVersion(major, minor, micro);
1840+
if (major < 8)
1841+
Opts.SwiftAsyncFramePointer = SwiftAsyncFramePointerKind::Never;
18331842
}
18341843

18351844
return false;

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,9 @@ function(_add_swift_target_library_single target name)
12051205
set(PLIST_INFO_PLIST "Info.plist" CACHE STRING "Plist name")
12061206
if("${SWIFTLIB_SINGLE_SDK}" IN_LIST SWIFT_APPLE_PLATFORMS AND SWIFTLIB_SINGLE_IS_STDLIB)
12071207
set(PLIST_INFO_NAME ${name})
1208-
set(PLIST_INFO_UTI "com.apple.dt.runtime.${name}")
1208+
1209+
# Underscores aren't permitted in the bundle identifier.
1210+
string(REPLACE "_" "" PLIST_INFO_UTI "com.apple.dt.runtime.${name}")
12091211
set(PLIST_INFO_VERSION "${SWIFT_VERSION}")
12101212
if (SWIFT_COMPILER_VERSION)
12111213
set(PLIST_INFO_BUILD_VERSION

stdlib/public/Concurrency/Task.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,19 @@
3737
#endif
3838

3939
#if defined(SWIFT_CONCURRENCY_BACK_DEPLOYMENT)
40+
#include <Availability.h>
41+
#include <TargetConditionals.h>
42+
#if TARGET_OS_WATCH
43+
// Bitcode compilation for the watch device precludes defining the following asm
44+
// symbols, so we don't use them... but simulators are okay.
45+
#if TARGET_OS_SIMULATOR
4046
asm("\n .globl _swift_async_extendedFramePointerFlags" \
4147
"\n _swift_async_extendedFramePointerFlags = 0x0");
48+
#endif
49+
#else
50+
asm("\n .globl _swift_async_extendedFramePointerFlags" \
51+
"\n _swift_async_extendedFramePointerFlags = 0x0");
52+
#endif
4253
#else
4354
#ifdef __APPLE__
4455
#if __POINTER_WIDTH__ == 64
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %target-swift-frontend -disable-availability-checking -target arm64_32-apple-watchos7 %s -S | %FileCheck -check-prefix=NEVER %s
2+
// RUN: %target-swift-frontend -disable-availability-checking -target arm64_32-apple-watchos8 %s -S | %FileCheck -check-prefix=ALWAYS %s
3+
// RUN: %target-swift-frontend -disable-availability-checking -target arm64_32-apple-watchos7 -swift-async-frame-pointer=always %s -S | %FileCheck -check-prefix=ALWAYS %s
4+
// RUN: %target-swift-frontend -disable-availability-checking -target arm64_32-apple-watchos7 -swift-async-frame-pointer=never %s -S | %FileCheck -check-prefix=NEVER %s
5+
// RUN: %target-swift-frontend -disable-availability-checking -target arm64_32-apple-watchos7 -swift-async-frame-pointer=auto %s -S | %FileCheck -check-prefix=AUTO %s
6+
7+
// REQUIRES: OS=watchos
8+
// REQUIRES: CPU=armv7k || CPU=arm64_32
9+
10+
public func someAsyncFunction() async {
11+
}
12+
13+
// AUTO: swift_async_extendedFramePointerFlags
14+
15+
// ALWAYS-NOT: swift_async_extendedFramePointerFlags
16+
// ALWAYS: 0x1000000000000000
17+
// ALWAYS-NOT: swift_async_extendedFramePointerFlags
18+
19+
// NEVER-NOT: swift_async_extendedFramePointerFlags
20+
// NEVER-NOT: 0x1000000000000000

utils/swift_build_support/swift_build_support/products/backdeployconcurrency.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ def build(self, host_target):
8484
self.cmake_options.define('SWIFT_HOST_VARIANT_ARCH:STRING', arch)
8585
self.cmake_options.define('BUILD_STANDALONE:BOOL', True)
8686

87+
# Propagate version information
88+
if self.args.swift_user_visible_version is not None:
89+
self.cmake_options.define('SWIFT_VERSION',
90+
str(self.args.swift_user_visible_version))
91+
if self.args.swift_compiler_version is not None:
92+
self.cmake_options.define('SWIFT_COMPILER_VERSION',
93+
str(self.args.swift_compiler_version))
94+
8795
# Only install the "stdlib" component, which contains the concurrency
8896
# module.
8997
self.cmake_options.define('SWIFT_INSTALL_COMPONENTS:STRING', 'back-deployment')

0 commit comments

Comments
 (0)