always use __errno_location for user ABI#614
Open
yamt wants to merge 1 commit intoWebAssembly:mainfrom
Open
Conversation
upsides: * by avoiding direct accesses to the TLS, increase the chances for third-party libraries to provide a single binary for threaded and non-threaded wasi targets. see [1] for an example. downsides: * increase the overhead of errno accesses. i suppose it isn't critical as errno is typically only accessed in the error handling logic. there are a few apis like strtoul which require errno accesses even in successful cases though. [1] https://github.com/bytecodealliance/wasm-micro-runtime/blob/d95b0e3d46da8e88f484f236cb4222f5a6dc5926/core/iwasm/libraries/lib-socket/src/wasi/wasi_socket_ext.c#L15-L33
|
We hit an issue that I believe may be related to this bug while working to update Firefox's WASI sysroot from wasi-sdk-20 to wasi-sdk-30. When linking a non-threaded wasm32-wasi binary (SpiderMonkey compiled to WASM), we get: The mismatch is that __errno.h declares extern _Thread_local int errno, causing the compiler to emit TLS relocations, but the compiled errno symbol in wasi-libc.a lands in .bss (non-TLS) since thread_local is a no-op without shared memory. We're working around it locally by stripping _Thread_local from the declaration and thread_local from the definition for the wasm32-wasi target, but a proper upstream fix would be welcome. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
upsides:
downsides:
[1] https://github.com/bytecodealliance/wasm-micro-runtime/blob/d95b0e3d46da8e88f484f236cb4222f5a6dc5926/core/iwasm/libraries/lib-socket/src/wasi/wasi_socket_ext.c#L15-L33