Skip to content

stdlib: add wasi.modulemap.gyb for WebAssembly support #39360

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 3 commits into from

Conversation

MaxDesiatov
Copy link
Contributor

WASI libc is substantially different from Glibc, thus we need a separate modulemap for it.

Related to SR-9307

cc @kateinoigakukun

@Azoy

This comment has been minimized.

@MaxDesiatov
Copy link
Contributor Author

It does use it, for ${LIBC_INCLUDE_PATH} substitution.

@MaxDesiatov

This comment has been minimized.

COMPONENT sdk-overlay)

swift_install_in_component(FILES "${wasi_libc_modulemap_out}"
DESTINATION "lib/swift_static/${arch_subdir}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kateinoigakukun not quite sure why we're copying it to both lib/swift and lib/swift_static here, could you clarify please?

Copy link
Member

Choose a reason for hiding this comment

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

As far as I remember, it's just a workaround because some components only include /lib/swift even passing -static-stdlib. But not cure if it's still necessary. Sorry.

@MaxDesiatov
Copy link
Contributor Author

@swift-ci please smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci please smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci please smoke test

@karwa
Copy link
Contributor

karwa commented Sep 25, 2021

The SwiftGlibC modulemap moved away from using hard-coded paths a while ago; now it just includes a few link statements and includes a single header.

Would such an approach be feasible for WASI?

@MaxDesiatov
Copy link
Contributor Author

MaxDesiatov commented Sep 25, 2021

I'm not sure, I'm not aware of how exactly the change to the Glibc modulemap was made and what the removal of paths entails. What documentation is available out there that describes how that works?

@karwa
Copy link
Contributor

karwa commented Sep 25, 2021

@MaxDesiatov https://forums.swift.org/t/problems-with-swiftglibc-and-proposed-fix/37594 under the "Proposal" heading

Avoids the need to identify the right directory from which to include the header files, as SwiftGlibc currently does (see the references to ${GLIBC_INCLUDE_PATH} and ${GLIBC_ARCH_INCLUDE_PATH} in glibc.modulemap.gyb). Instead, we can use standard mechanisms (include path, sysroot) to ensure that an #include statement resolves to the correct header file.

It seems like that would be a good fit for WASI

@kateinoigakukun
Copy link
Member

Closing in favor of #66539

@kateinoigakukun kateinoigakukun deleted the maxd/wasi-modulemap branch October 3, 2023 21:25
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.

4 participants