MainActor.assumeIsolated crashes with EXC_BAD_ACCESS in mergeable library

Hi there.

I've recently tried to build our SDK (a XCFramework built from a SPM package for iOS) as a mergeable library and immediately ran into a problem where MainActor.assumeIsolated crashed with a EXC_BAD_ACCESS. Even merely accessing MainActor.shared lead to the same crash.

I'm wondering if I've configured something wrong and appreciate if someone could shed any light on this.

I'm attaching a small sample project, which consists of the following parts:

  1. A Swift package MyLibrary which exports a function doSomething() which accesses MainActor.shared and prints "Hello World" afterwards. The library target is configured to be mergeable (.unsafeFlags(["-Wl,-make_mergeable"]))
  2. A bash script build.sh to build the XCFramework from the Swift package
  3. An app project TestApp which consumes the XCFramework and calls doSomething()

Zip is here

To reproduce:
Build the XCFramework by running ./build.sh or use the bundled one from the zip. Then build & run the TestApp project in Release mode with MERGED_BINARY_TYPE set to automatic (should already be the case).

Result:
The app crashes

Expected result:
"Hello World" should be printed to the console.

Alternatively you can either run the app in Debug mode or set MERGED_BINARY_TYPE = none and run in either mode to get the desired console output.