emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.84k stars 3.31k forks source link

EMSCRIPTEN_KEEPALIVE doesn't work with WebAssembly backend + metadce #8194

Closed kripken closed 5 years ago

kripken commented 5 years ago

Followup to #6233

wasm3.test_llvm_used fails due to this.

I think the issue is that in metadce we remove everything but what the user explicitly exported (if we see it is not used). What fastcomp does is append llvm.used to ORIGINAL_EXPORTED_FUNCTIONS. Do we have a way to do that with the LLVM wasm backend?

cc @sbc100

sbc100 commented 5 years ago

I don't see ORIGINAL_EXPORTED_FUNCTIONS ever getting appended to in the source code. Am I missing something? I'll keep digging.

sbc100 commented 5 years ago

I don't see ORIGINAL_EXPORTED_FUNCTIONS ever getting appended to in the source code. Am I missing something? I'll keep digging.

Looks like its shared.Building.user_requested_exports that is failing to include this.

kripken commented 5 years ago

Oh sorry, yeah, we may have renamed that at some point.