Skip to content

ClangImporter: import SwiftShims properly for static linking #82065

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

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Jun 6, 2025

When building against the static standard library, we should define SWIFT_STATIC_STDLIB to indicate to the shims that the declarations should be giving hidden visibility and default DLL storage. This is required to ensure that these symbols are known to be dso_local when compiling to avoid an unnecessary look up through the PLT/GOT or the indirection through the synthesized __imp_ symbol and the IAT. This corrects a number of incorrect code generation cases on Windows with the static standard library.

When building against the static standard library, we should define
`SWIFT_STATIC_STDLIB` to indicate to the shims that the declarations
should be giving hidden visibility and default DLL storage. This is
required to ensure that these symbols are known to be `dso_local` when
compiling to avoid an unnecessary look up through the PLT/GOT or the
indirection through the synthesized `__imp_` symbol and the IAT. This
corrects a number of incorrect code generation cases on Windows with the
static standard library.
@compnerd
Copy link
Member Author

compnerd commented Jun 6, 2025

@swift-ci please smoke test

@compnerd compnerd merged commit 083cb11 into swiftlang:main Jun 6, 2025
3 checks passed
@compnerd compnerd deleted the import-shims branch June 6, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant