Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions system/lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,26 @@ document.
These current set of static constructors in system libraries and their priorities
(lowest run first) are:

- 1: `emscripten_stack_init` (stack_limits.S)
- 47: `initialize_emmalloc_heap` (emmalloc.c)
- 48: `__emscripten_init_main_thread` (pthread/library_pthread.c)
- 49: `init_file_data` (generated by file_packager.py)
- 50: asan init (??)
- 100: `WasmFS wasmFS` (wasmfs/wasmfs.cpp)
- 1: `emscripten_stack_init` ([libemcc/stack_limits.S][stack_limits.S])
- 47: `initialize_emmalloc_heap` ([emmalloc.c][emmalloc.c])
- 48: `__emscripten_init_main_thread` ([pthread/library_pthread.c][library_pthread.c])
- 48: `emscripten_wasm_worker_main_thread_initialize` ([wasm_worker/library_wasm_worker.c][library_wasm_worker.c])
- 49: `init_file_data` (generated by [file_packager.py][file_packager.py])
- 50: `asan.module_ctor`, which calls `__asan_init` (generated by the LLVM
AddressSanitizer pass, see `kAsanEmscriptenCtorAndDtorPriority` in
[AddressSanitizer.cpp][AddressSanitizer.cpp])
- 100: `__emscripten_environ_constructor` ([libc/musl/src/env/__environ.c][__environ.c])
- 100: `WasmFS wasmFS` ([wasmfs/wasmfs.cpp][wasmfs.cpp])

Priorities 0 - 100 are reserved for system libraries and user-level

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you split this sentence so it reads correctly. How about:

"Priorities 0 - 100 are reserved for system libraries. User-level constructors should all run at 101 and above .."

constructors should all run at 101 and above (for example libc++ initializes
its standard I/O streams at priority 101).

[stack_limits.S]: https://github.com/emscripten-core/emscripten/blob/main/system/lib/libemcc/stack_limits.S
[emmalloc.c]: https://github.com/emscripten-core/emscripten/blob/main/system/lib/emmalloc.c
[library_pthread.c]: https://github.com/emscripten-core/emscripten/blob/main/system/lib/pthread/library_pthread.c
[library_wasm_worker.c]: https://github.com/emscripten-core/emscripten/blob/main/system/lib/wasm_worker/library_wasm_worker.c
[file_packager.py]: https://github.com/emscripten-core/emscripten/blob/main/tools/file_packager.py
[AddressSanitizer.cpp]: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
[__environ.c]: https://github.com/emscripten-core/emscripten/blob/main/system/lib/libc/musl/src/env/__environ.c
[wasmfs.cpp]: https://github.com/emscripten-core/emscripten/blob/main/system/lib/wasmfs/wasmfs.cpp
Loading