Skip to content

Conversation

@DougGregor
Copy link
Member

Adds the asmname attribute to SIL functions and global variables, which provides a different name that will be used when lowering the symbol to LLVM IR. Make sure asmname lowers correctly and round-trips through serialized SIL. This is part of a larger scheme to prevent Swift-level type differences in the declarations of C functions from manifesting as deserialization failures for SIL (rdar://137014448). The substantive part of that is still to come.

While here, use the SIL serialization logic needed for asmname to make the existing section attribute on SIL functions properly round-trip through SIL serialization. Do the same for SIL global variables, which also means adding support for parsing the section attribute on SIL global variables. Fixes rdar://162549960.

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor requested a review from ktoso as a code owner October 16, 2025 02:14
@DougGregor DougGregor force-pushed the sil-asmname-and-section branch from 630da51 to 03ec963 Compare October 16, 2025 02:16
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor enabled auto-merge October 16, 2025 02:16
The asmname attribute allows one to specify the name that will be used
when lowering a given SIL declaration to LLVM IR. It is not currently
exposed in the surface language.

Make sure this attribute round-trips through the parser and
serialization.

Part of rdar://137014448O.
@DougGregor DougGregor force-pushed the sil-asmname-and-section branch from 03ec963 to 081b5cd Compare October 16, 2025 03:44
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit 4c33e75 into swiftlang:main Oct 16, 2025
3 checks passed
@DougGregor DougGregor deleted the sil-asmname-and-section branch October 16, 2025 13:07
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