sbc100 wrote:

> > It looks like maybe OP is running into the issue of Emscripten's hack from 
> > the ancient times where EMSCRIPTEN_KEEPALIVE (which compiles to 
> > attribute("used") and then WASM_SYM_NO_STRIP)
> 
> Exactly this is the problem.

It seems like there are actually two different issues:

1. `attribute("used")` implies `WASM_SYM_EXPORTED` on emscripten.  
2. exported symbols that are not valid JS identifiers generate `invalid export 
name` under emscripten.

We already have a fix for (2) in flight which works around this issue for now I 
believe.

The fix for (1) is harder, but I would like to get this fixed eventually.  The 
problem stems from the fact that we have an `EMSCRIPTEN_KEEPALIVE` macro in 
emscripten.  This macro will cause both functions *and* data to be exported and 
currently relies on `attribute("used")`.    I have a PR from back in 2022 to 
try to fix it: https://github.com/emscripten-core/emscripten/pull/16149.   
However it ran into the issue that LLVM currently doesn't support attributes on 
data symbols.  Fixing that seems like it could be hard, but I'm not sure.

https://github.com/llvm/llvm-project/pull/169043
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to