-
Notifications
You must be signed in to change notification settings - Fork 313
provide __stack_high and __stack_low globals when linking
#2375
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
Conversation
Beginning with WASI-SDK 28, `libc.so` requires these globals to be provided by the main module, presumably due to [these changes](WebAssembly/wasi-libc@abe7b08#diff-d570c8ef878addffd443fcdd7163ff830895658a0f43d08667b3545d7b323def). Signed-off-by: Joel Dice <[email protected]>
|
Since we're in control of the stack allocation, is it possible to use the actual extents rather than 0? Also, do you know if this is an LLD thing where LLD provides these symbols? And/or do you know if it's a bug that wasi-libc requires these symbols? |
I confess I don't know how all this fits together, but it appears to be related to how wasi-libc initializes the This comment indicates that |
When static linking, `wasm-ld` takes care of allocating the stack, but when "dynamic" linking with `wit-component`, it's our job to do so and set the `__stack_high` and `__stack_low` variables accordingly. Signed-off-by: Joel Dice <[email protected]>
|
I just pushed an update to set |
|
I'm having a tough time shaking a feeling though that something's not right here. For example: extern char __stack_high;
int foo() { return (int) &__stack_high; }compiles with: So I'm not sure what's supposed to happen here. I don't know if this is a bug in wasm-ld, a bug in wasi-libc for thinking these symbols should exist in dynamic libraries, or a bug here for wasm-tools as the symbols should be provided. @sbc100 would you perhaps know an answer to this question? Is it expected that wasm shared-everything-dynamic-libraries (e.g. compiled with |
|
There is an open PR against wasm-ld to allow such linker-defined symbols to be undefined in shared libraries: I believe in emscripten we always build our shared libraries with |
alexcrichton
left a comment
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.
Ok thanks for confirmation! In that case this looks good to me
e2bb0a2
Beginning with WASI-SDK 28,
libc.sorequires these globals to be provided by the main module, presumably due to thesechanges.