Hi,
Putting this here because I think it could lead to an interesting
discussion. (and because by writing things down, I can understand them
better. This is (very) new to me)
cross compiling this
[thread_local]$ cat main.c
#include <threads.h>
#include <stdio.h>
thread_local int a;
int main()
{
printf("%d\n", a);
}
with:
emcc -pthread main.c
or:
emcc -s USE_PTHREADS=1
or:
clang-9 --target=wasm32-unknown-emscripten -I../../emsdk/upstream/emscripten
/system/include/libc/ -pthread main.c)
leads to a SIGABORT because this assertion fails:
virtual uint64_t (anonymous namespace)::WasmObjectWriter::writeObject(llvm::
MCAssembler &, const llvm::MCAsmLayout &): Assertion
`Sec.getKind().isMetadata()'
failed
WasmObjectWriter fails to write object code because of the IR, which has
weird or unrecognized sections. Question is, if we change the code to
initialise the sections, would it be recognised by WASM if so, how ? :)
there doesn't seem to be any reference of thread_local in WebAssembly.
Since pthread support is experimental in WASM (although we can already do a
lot of things), I wanted to know if there was something we could do to work
around it?
Complete logs are here. <https://bugs.llvm.org/show_bug.cgi?id=42510>
Cheers!
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/78f61504-4e78-4afb-a4be-3e0314f5e29f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.