Commit Graph

7 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
f309215514 crt1-command.c: fix whitespace issues (#480) 2024-06-25 12:13:35 +02:00
韩朴宇
a00bf321ee
threads: implement init of TLS and stack pointer (#342)
* threads: implement init of TLS and stack pointer

* fix: rename wasi_snapshot_preview2_thread_spawn to wasi_thread_spawn

Signed-off-by: Harald Hoyer <harald@profian.com>

* fix: change signature of wasi_thread_start

Signed-off-by: Harald Hoyer <harald@profian.com>

* fix: pthread_exit for WASI

Can't use `exit()` because it is too high level.
Have to unlock the thread list.

Signed-off-by: Harald Hoyer <harald@profian.com>

* fix: initialize struct pthread for the main thread

Signed-off-by: Harald Hoyer <harald@profian.com>

* fix: store the aligned stack minus `struct start_args`

Signed-off-by: Harald Hoyer <harald@profian.com>

Signed-off-by: Harald Hoyer <harald@profian.com>
Co-authored-by: Harald Hoyer <harald@profian.com>
2022-11-10 14:12:53 -08:00
Dan Gohman
b99173e177
Support threads in the new crt1-command.c ctor check. (#339)
Use an atomic compare-and-swap for checking whether constructors have
been run, when threads are enabled.
2022-11-08 13:37:44 -08:00
Dan Gohman
21d93b927d
Add a check to command modules to ensure that they're only started once. (#329)
* Add a check to command modules to ensure that they're only started once.

Wasm command modules should only be called once per instance, because
the programming model doesn't leave linear memory in a reusable state
when the program exits. As use cases arise for loading wasm modules in
environments that want to treat them like reactors, add a safety check
to ensure that command modules are used according to their
expectations.
2022-10-13 17:58:14 -07:00
Dan Gohman
907d10fecb Don't run static constructors on arbitrary user exports.
Previously, "new-style commmands" considered every user-defined
export to be a potential command entrypoint, so wasi-libc and wasm-ld
cooperated to run the user's static constructors on each entrypoint.

This form of new-style command turned out not to be useful, and it
interferes with some use cases, so disable it.

This is done by making an explicit call to `__wasm_call_ctors`, which
tells wasm-ld that it shouldn't synthesize any calls to
`__wasm_call_ctors` on its own.
2022-09-29 13:15:32 -07:00
Dan Gohman
d8d00bcd5a
Remove support for __original_main. (#295)
* Remove support for `__original_main`.

This was used in old LLVM versions. Recent LLVM versions all emit either
`__main_void` or `__main_argv_argc`, so we can use those directly.

* Update the CI to use LLVM 14.0.0.
2022-06-01 08:51:20 -07:00
Dan Gohman
614d783e92
New-style command support. (#203)
This adds a new crt1-command.c startup file, which uses
[new-style command support]. Instead of calling `__wasm_call_ctors`
and `__wasm_call_dtors` directly, this lets wasm-ld automatically call
them.

This preserves the existing crt1.c, so that the same wasi-libc build
can support old-style and new-style commands, for compatibility during
the transition.

[new-style command support]: https://reviews.llvm.org/D81689

Co-authored-by: Dan Gohman <sunfish@mozilla.com>
2020-10-03 14:18:39 -07:00