emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.79k stars 3.3k forks source link

wasm built with SIDE_MODULE allows undefined symbols #18198

Open anggupta opened 1 year ago

anggupta commented 1 year ago

When building a side module ( for run time or load dynamically linking), it looks undefined symbols in the side module are not reported when building the side module (at linking phase), and undefined symbols are reported when it’s finally linked (load time linking) with main module. This behaviour is different from Native Dynamic Linking (say on osx .framework or linux .so) where an executable should have all the symbols either resolved or weakly linked at build time.

We want have same behaviour as on native platforms so that undefined symbols are reported at build time of that side module rather than quite later at final linking with main module. How can it be achieved?

sbc100 commented 1 year ago

This is a little tricky but I think we can probably make it work. The reason its tricky is that, with emscripten, all the system libraries are linked into the main module rather than being their own shared libraries (e.g. we don't have a libc.so).

sbc100 commented 8 months ago

I have made some significant progress on this on the llvm side but it now quite there yet.