Skip to content

[DO NOT MERGE] IRGen: add a hacky workaround to DLL Storage #11978

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

Closed
wants to merge 1 commit into from

Conversation

compnerd
Copy link
Member

The runtime functions should not have DLLImport storage for the runtime
functions. Without this change, we would see swift_unexpectedError be
given DLL Import DLL Storage. It should probably be given DLLExport DLL
Storage. This is needed to repair the Windows build.

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

Resolves SR-NNNN.

The runtime functions should not have DLLImport storage for the runtime
functions.  Without this change, we would see `swift_unexpectedError` be
given DLL Import DLL Storage.  It should probably be given DLLExport DLL
Storage.  This is needed to repair the Windows build.
@compnerd
Copy link
Member Author

I don't really know of a good way to handle this. Perhaps @rjmccall has some suggestions?

@compnerd compnerd changed the title IRGen: add a hacky workaround to DLL Storage [DO NOT MERGE] IRGen: add a hacky workaround to DLL Storage Sep 18, 2017
@troughton
Copy link
Contributor

troughton commented Sep 18, 2017

I was looking at this a few weeks back and couldn't come up with a fix, so thank you for this. As for a proper solution – I believe there was some discussion a while back on the swift-dev mailing list under the topic "swift (ABI) and Windows" which discussed propagating through the current module so this situation can be detected in a less hacky way.

@compnerd
Copy link
Member Author

@troughton I don't think that this would work here. getRuntimeFn does not actually deal with SILFunction but rather llvm::Function. It goes and creates the LLVM Function in the Module. There is no associated SILFunction (that I can see). Maybe Im mistaken about the approach that @rjmccall was suggesting?

@rjmccall
Copy link
Contributor

Why would it not be DLLImport? Is this specifically when building code that's going to be linked into the same DLL as the runtime?

@compnerd
Copy link
Member Author

Yeah, it is going to be in the same module. In this particular case, we have swift_unexpectedError being materialized for swiftCore, and the definition ends up receiving the dllimport storage.

@compnerd
Copy link
Member Author

compnerd commented Oct 9, 2017

The proper fix for this should be at #12353

@compnerd compnerd closed this Oct 9, 2017
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