-
Notifications
You must be signed in to change notification settings - Fork 206
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
threads: Retrieve default stack size from __heap_base/__data_end #350
Conversation
336f6fe
to
79a4360
Compare
df8ec15
to
60aba3b
Compare
60aba3b
to
7a7005a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me! I'll let @sbc100 be the final approver since he had some comments already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
I was about to merge this but now it has a merge conflict; @loganek, can you resolve that? |
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.
… they're defined
… of the memory I.e. when `--stack-first` flag is provided to the linker
7a7005a
to
f768d5a
Compare
@abrown should be ready for merge now |
…Assembly#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.
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 works as expected and overrides the defaults (pthread_create.c).