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

__wasm_call_ctors #3

Open
yamt opened this issue Jul 24, 2023 · 4 comments
Open

__wasm_call_ctors #3

yamt opened this issue Jul 24, 2023 · 4 comments

Comments

@yamt
Copy link
Contributor

yamt commented Jul 24, 2023

libc.so needs __wasm_call_ctors to be called. it doesn't seem like a standard.
i guess it makes more sense for libc.so exports _initiailize as specified for wasi reactor modules.
https://github.com/WebAssembly/WASI/blob/main/legacy/application-abi.md
probably by linking crt1-reactor, maybe reverting https://reviews.llvm.org/D153293 partly.

how do you think?

@dicej
Copy link
Owner

dicej commented Jul 24, 2023

It's true that __wasm_call_ctors has not been standardized, but this whole project relies on conventions which have not yet been standardized, including all of https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md. _initialize has also not been standardized, and is part of the old, module-based WASI ABI which will soon be superseded by WASI Preview 2.

My understanding is that we do want to have an official, standard "init" function in WebAssembly (i.e. like start, but able to call host functions), but until such a thing exists we use __wasm_call_ctors by convention. @sunfishcode does that sound right to you?

FWIW, I'm happy to change to something "more standard" if/when it becomes available, but I don't think that's happened yet.

@yamt
Copy link
Contributor Author

yamt commented Jul 24, 2023

_initialize has also not been standardized, and is part of the old, module-based WASI ABI which will soon be superseded by WASI Preview 2.

the "old, module-based WASI ABI" is what's the most commonly used right now.

also, _initialize is being proposed as toolchain-independent abi.
WebAssembly/tool-conventions#203

@dicej
Copy link
Owner

dicej commented Jul 24, 2023

Ah, thanks for the link -- I hadn't seen that conversation. I'm fine with changing to _initialize once LLVM/wasm-ld start generating it, then.

@yamt
Copy link
Contributor Author

yamt commented Jul 25, 2023

sbc100 pushed a commit to llvm/llvm-project that referenced this issue Aug 14, 2023
This allows -mexec-model=reactor -shared produces a library module
with _initialize entrypoint, which is preferrable over __wasm_call_ctors.

This partially reverts https://reviews.llvm.org/D153293

Discussion: dicej/component-linking-demo#3

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D156205
llvmbot pushed a commit to llvm/llvm-project-release-prs that referenced this issue Nov 10, 2023
This allows -mexec-model=reactor -shared produces a library module
with _initialize entrypoint, which is preferrable over __wasm_call_ctors.

This partially reverts https://reviews.llvm.org/D153293

Discussion: dicej/component-linking-demo#3

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D156205

(cherry picked from commit 989ce06)
llvmbot pushed a commit to llvm/llvm-project-release-prs that referenced this issue Nov 10, 2023
This allows -mexec-model=reactor -shared produces a library module
with _initialize entrypoint, which is preferrable over __wasm_call_ctors.

This partially reverts https://reviews.llvm.org/D153293

Discussion: dicej/component-linking-demo#3

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D156205

(cherry picked from commit 989ce06)
llvmbot pushed a commit to llvm/llvm-project-release-prs that referenced this issue Nov 10, 2023
This allows -mexec-model=reactor -shared produces a library module
with _initialize entrypoint, which is preferrable over __wasm_call_ctors.

This partially reverts https://reviews.llvm.org/D153293

Discussion: dicej/component-linking-demo#3

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D156205

(cherry picked from commit 989ce06)
tru pushed a commit to llvm/llvm-project-release-prs that referenced this issue Nov 20, 2023
This allows -mexec-model=reactor -shared produces a library module
with _initialize entrypoint, which is preferrable over __wasm_call_ctors.

This partially reverts https://reviews.llvm.org/D153293

Discussion: dicej/component-linking-demo#3

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D156205

(cherry picked from commit 989ce06)
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

No branches or pull requests

2 participants