-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
This is a regression in 3.1.70, on previously tested version 3.1.56 it worked correctly. My application gets undefined reference to __embind_initialize_bindings during runtime.
There is a code which adds __embind_initialize_bindings to exported symbols:
Lines 508 to 509 in 119a427
| if settings.EMBIND: | |
| settings.REQUIRED_EXPORTS.append('_embind_initialize_bindings') |
but this seems to be stripped during call to binaryen:
Lines 842 to 847 in 119a427
| out = run_binaryen_command('wasm-metadce', | |
| wasm_file, | |
| wasm_file, | |
| args, | |
| debug=debug_info, | |
| stdout=PIPE) |
The binaryen takes an DCEGraph as an input, and when I inspect the json of graph it has following entry:
{
"name": "emcc$export$__embind_initialize_bindings",
"export": "_embind_initialize_bindings",
"reaches": []
},
I can fix this issue by manually editing this intermediate file and changing this entry to:
{
"name": "emcc$export$__embind_initialize_bindings",
"export": "_embind_initialize_bindings",
"reaches": [],
"root": true
}
My guess: _embind_initialize_bindings should be marked with root: true but for some reason is not.
Another workaround is manually exporting this function via:
EXPORTED_FUNCTIONS=_main,__embind_initialize_bindings"
but I believe it should not be needed.
This issue is similiar to: #21844