mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The `_diagnoseUnavailableCodeReached()` function was introduced in the Swift 5.9 standard library and employs `@backDeployed` to support compilation of binaries that target OS releases aligned with earlier Swift releases. Unfortunately, though, this backdeployment strategy doesn't work well for some unusual build environments. Specifically, in some configurations code may be built with a compiler from a recent Swift toolchain and then linked against the dylibs in an older toolchain. When linking against the older dylibs, the `_diagnoseUnavailableCodeReached()` function does not exist but the `@backDeployed` thunks emitted into the binary reference that function and therefore linking fails. The idea of building with one toolchain and then linking to the dylibs in a different, older toolchain is extremely dubious. However, it exists and for now we need to support it. This PR introduces an alternative `_diagnoseUnavailableCodeReached()` function that is annotated with `@_alwaysEmitIntoClient`. Calls to the AEIC variant are now emitted by the compiler when the deployment target is before Swift 5.9. Once these unusual build environments upgrade and start linking against a Swift 5.9 toolchain or later we can revert all of this. Resolves rdar://119046537
230 KiB
230 KiB