emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.35k stars 3.25k forks source link

Fix for `-pthread` + `-sRELOCATABLE` #22110

Closed sbc100 closed 1 week ago

sbc100 commented 1 week ago

Fixes: #22108

dschuff commented 1 week ago

Why doesn't this function actually need to work?

sbc100 commented 1 week ago

The function is only used to keep track of shared library loading (i.e. when MAIN_MODULE is defined).

The problem is that the native code that calls this function cannot distinguish between MAIN_MODULE and RELOCATABLE since we only build just one PIC flavor of libc.. not one for MAIN_MODULE and another for RELOCATABLE.

sbc100 commented 1 week ago

See https://github.com/emscripten-core/emscripten/blob/131cb71c020cebc976f276c65fae83bfb3ad1ba1/system/lib/pthread/pthread_create.c#L343-L346

sbc100 commented 1 week ago

I would really love to completely get rid of the "RELOCATABLE but not MAIN_MODULE" build mode one day.. because I don't think it has any/many valid uses.