]> git.proxmox.com Git - wasi-libc.git/commit
threads: Retrieve default stack size from __heap_base/__data_end (#350)
authorMarcin Kolny <mkolny@amazon.com>
Mon, 19 Dec 2022 12:18:19 +0000 (12:18 +0000)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 2 Aug 2023 10:24:08 +0000 (12:24 +0200)
commit83662e2681c8ca398e4996b82cf0bc73f6d66328
treeb93e0279dfe3a69a72d266b0e85bc0d0e36853e4
parent54bf1cda4fd0124ff0bcf5e384f9718d9ded1954
threads: Retrieve default stack size from __heap_base/__data_end (#350)

When compiling with `-z stack-size` flag, only the main thread's stack
size is set to the specified value and other threads use musl's default value.
That's inconsistent with LLD's `-Wl,-stack_size`.

I think we can make it similar to MUSL's behavior, where thread's stack
size can be set via `PT_GNU_STACK` program header (via `-Wl,-z,stack-size`
flag).

Configuring stack size through `pthread_attr_t` still work as expected and
overrides the defaults ([pthread_create.c](https://github.com/WebAssembly/wasi-libc/blob/be1ffd6a9eba1704085987482557c2a32724227f/libc-top-half/musl/src/thread/pthread_create.c#L362))
default settings.
expected/wasm32-wasi-pthread/undefined-symbols.txt
libc-top-half/musl/src/env/__init_tls.c