Skip to content

Shims: strongly link swift_isStackAllocationSafe on !Darwin #40075

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
Nov 6, 2021

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Nov 6, 2021

Windows objects to the multiple different aliases for
swift_isStackAllocationSafe. Use strong linkage on all non-ABI stable
targets. This should repair the Windows build and matches the
conditional emission in the stdlib.

Thanks to @lorentey for the discussion around how to handle this and the
pointer to where this was getting introduced!

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

Windows objects to the multiple different aliases for
`swift_isStackAllocationSafe`.  Use strong linkage on all non-ABI stable
targets.  This should repair the Windows build and matches the
conditional emission in the stdlib.

Thanks to @lorentey for the discussion around how to handle this and the
pointer to where this was getting introduced!
@compnerd
Copy link
Member Author

compnerd commented Nov 6, 2021

@swift-ci please test

@compnerd
Copy link
Member Author

compnerd commented Nov 6, 2021

CC: @lorentey

SWIFT_RUNTIME_STDLIB_API
#if defined(__APPLE__) && defined(__MACH__)
SWIFT_WEAK_IMPORT
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this becomes a regular thing, then it may be a good idea to pull this out into a separate macro (SWIFT_RUNTIME_AVAILABLE_FUTURE or something like that).

Cc @mikeash Our intention is that once we have the OS version numbers corresponding to Swift 5.6, then this entry point will gain availability. For now, we need to arrange for this to be a weak symbol on Darwin, but strong elsewehere. (I think we may need to define regular availability macros too -- afaict we don't currently have those?)

(_swift_stdlib_getCurrentStackBounds below should probably have the same treatment, but it's only used in tests right now. Which reminds me that it may not even need to be exported. 🤔)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the typical way to do this sort of thing is to redeclare the function in Swift with @_silgen_name and then stick the @available annotation on that.

@lorentey lorentey requested a review from mikeash November 6, 2021 01:53
@compnerd
Copy link
Member Author

compnerd commented Nov 6, 2021

Going to merge this for now to restore the Foundation build on Windows.

@compnerd compnerd merged commit a854e8e into swiftlang:main Nov 6, 2021
@compnerd compnerd deleted the safes-should-be-strong branch November 6, 2021 16:44
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.

3 participants