-
Notifications
You must be signed in to change notification settings - Fork 10.5k
IRGen: Weakly link symbols for unavailable declarations #64353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IRGen: Weakly link symbols for unavailable declarations #64353
Conversation
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
29ffab3
to
cc05fbf
Compare
I tweaked this a bit to allow unavailable declarations with an |
When computing linkage, the compiler would treat unavailable declarations as if they were "always available" when they lack an `introduced:` version: ``` // Library @available(macOS, unavailable) public func foo() { // … } // Client import Library @available(macOS, unavailable) func bar() { // Even though foo() and bar() are unavalable on macOS the compiler still // strongly links foo(). foo() } ``` This created an unnecessary dependency between libraries and their clients and also can interfere with back deployment, since unavailable declarations may not be present in a library on all OS versions. Developers could work around these issues by conditionally compiling the code that references an unavailable declaration, but they shouldn't have to given that unavailable code is meant to be provably unreachable at runtime. Additionally, it could improve library code size if we allowed the compiler to strip unavailable declarations from a binary completely. Resolves rdar://106673713
…ions. If a declaration is unavailable but also has an `introduced:` availability version, treat that as an indication that it is considered ABI and should be linked as if it were available. Part of rdar://106673713
cc05fbf
to
084ef39
Compare
@swift-ci please test |
I believe that this is causing a regression for Windows:
https://ci-external.swift.org/job/oss-swift-windows-toolchain-x86_64-vs2019/2829/console |
When computing linkage, the compiler would treat unavailable declarations as if they were "always available" if they also lack an
introduced:
version:This created an unnecessary dependency between libraries and their clients and also can interfere with back deployment, since unavailable declarations may not be present in a library on all OS versions. Developers could work around these
issues by conditionally compiling the code that references an unavailable declaration, but they shouldn't have to given that unavailable code is meant to be provably unreachable at runtime. Additionally, in the future it could improve library code size if we allowed the compiler to strip unavailable declarations from a binary completely.
Resolves rdar://106673713