Skip to content
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

DynamicLinking.md: add notes about memory/table exports #234

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yamt
Copy link
Contributor

@yamt yamt commented Sep 3, 2024

This is my attempt to capture the discussion in
#232

This is my attempt to capture the discussion in
WebAssembly#232
Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

LGTM % comments

### Note for memory/table exports

The commonly used C conventions including WASIp1 require modules to
export the "memory" memory and the "__indirect_function_table" table.
Copy link
Member

Choose a reason for hiding this comment

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

Use backticks here instead of quotes?


On the other hand, non-PIE executables need to export these instance
resources as usual.

## Implementation Status
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we can/should add something under this header for wasi now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean to update the implementation status section?

However, because PIE executables with this dynamic-linking convention
are already importing these instance resources, it's redundant to
export them as well. For that reason, for PIE executables, we don't
require these resources exported.
Copy link
Member

Choose a reason for hiding this comment

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

Who is "we" here? If its WASI the perhaps this belongs in the wasi repo instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i guess it should be in both. (wasi and here)

i added it here first because i feel the memory/table convention is more widely used than just wasi.

export them as well. For that reason, for PIE executables, we don't
require these resources exported.

Shared libraries don't need to export these instance resoures either
Copy link
Member

Choose a reason for hiding this comment

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

"Shared libraries should also import these resources, since they share a memory and function table with the main module."

@sunfishcode
Copy link
Member

@sbc100 It looks like you approved this; is this ready to land?

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