Seems like from sdk 2.0.9, imported JavaScripts functions need to have
`__sig` specified in the js library file. So it looks embind/emval JS
libraries still not conforming to this change.
From: ChangeLog.md
*2.0.9: 11/16/2020*
*-----------------*
- The ABI used for importing symbol by address in dynamic linking
(MAIN_MODULE +
SIDE_MODULE) is now the same as the ABI used by llvm and wasm-ld. That
is,
symbol addresses are imported from the 'GOT.mem' and 'GOT.func' pseudo
modules. As one side effect of this change it is now required that
JavaScript
functions that are imported by address are now required to* have a
`__sig`*
* specified in the library JavaScript file.*
*From:* library_dylib.js
if (typeof result === 'function') {
* // Insert the function into the wasm table. If its a direct wasm
function*
* // the second argument will not be needed. If its a JS function we
rely*
* // on the `sig` attribute being set based on the `<func>__sig`
specified*
* // in library JS file.*
return addFunctionWasm(result, result.sig);
} else {
return result;
}
},
On Thursday, 28 January 2021 at 21:12:36 UTC+5:30 Angad Gupta wrote:
> Hi All,
>
> I am facing problem when using MAIN_MODULE=2 (dead code elimination). I
> have explicity added emval_decref in EXPORTED_SYMBOLS list to keep this
> symbol alive. Once main module is loading it checked undefined symbols in
> the module preloadDylibs > reportUndefinedSymbols and tries to add to GOT
> using addFunctionWasm, but the signature of emval_decref is never provided
> in main JS file.
>
> *JS file exports this only:*
> *Module["__emval_decref"] = __emval_decref;*
>
> However it seems signature for this is also required to make WASM/JS
> binding work. For example as shown below - the exports provide the
> signature too.
> *Example:*
> * Module["_alBuffer3f"] = _alBuffer3f;*
> * _alBuffer3f.sig = 'viifff';*
>
>
> My linker flag looks like this:
> emcc -std=c++14 -pthread -s DISABLE_EXCEPTION_CATCHING=0 -DDEBUG -D_DEBUG
> -g -s PTHREADS_DEBUG=1 -error-limit=0 --bind -s
> DISABLE_EXCEPTION_CATCHING=0 -s USE_SDL=2 -s USE_WEBGL2=1 -s
> LLD_REPORT_UNDEFINED <input object files> --o <html_path> -s MAIN_MODULE=2
> -s EXPORTED_FUNCTIONS=@exports_list.txt
>
> *Is this a problem with embind implementation, how to fix it? I am using
> latest emsdk.*
>
> MAIN_MODULE=1 is not an option because it exports millions of symbols and
> wasm initiation fails because of 1lacs limit.
>
> [image: Screenshot 2021-01-28 at 8.55.46 PM.png]
>
--
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/ec9d5d71-a1ea-4ffa-9a3d-12fe0cef98a7n%40googlegroups.com.