In general the way to do this is to keep names around all the time until
the very end. So run emcc with --profiling-funcs. Then when you run
wasm-opt later, run it with -g. Then in your final wasm-opt command, do
*not* use -g, and instead run --print-function-map which is what is used to
print the function map by emcc.

Another way might be to use the BINARYEN_EXTRA_PASSES flag. Then emcc will
run extra wasm-opt work for you internally.

- Alon


On Tue, Jul 30, 2019 at 8:08 PM Александр Гурьянов <[email protected]>
wrote:

> HI. I used wasm-opt manually to optimize wasm binary. On last step I
> used Oz to finalize optimizations. My problem is that after Oz
> function indexes is changed and I can't get symbols map to restore
> function names. How I can map new function indexes to old one (from
> symbols file).
>
> In other words:
> 1) I have bin.wasm from emscripten with symbols file. E.g. for one
> function:
> export __GLOBAL__sub_I_Runtime_BaseClasses_0_cpp (func $3425) - 3809
>
> 2) I do some buisness releated optimizations (with wasm-opt) that
> didn't change function indexes, after this, I still have
> export __GLOBAL__sub_I_Runtime_BaseClasses_0_cpp (func $3425) - 3809
>
> 3) Next I finalize build with wasm-opt -Oz, after it indexes was
> changed (I think because of dead code elimination), and I have
> export "__GLOBAL__sub_I_Runtime_BaseClasses_0_cpp" (func $1637) - 1997
>
> I need some flag for Oz, that told generates mapping for new indexes,
> like $1637: $3425 then I can restore original function names. I think
> some flag or option to do it should be already there, because
> emscripten do this in some way. What is the best way to build this
> mappings?
>
> --
> 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/CAKOm%3DVGv21Ffn%2Bxc4Fs59t9pBpmMqfa6p2F%2B0p1CmF-O2JjvOQ%40mail.gmail.com
> .
>

-- 
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/CAEX4NpTbX1bFxNfCSe20PMamZXjMaT%2BY1kSJBe7e36cB85Q_rA%40mail.gmail.com.
  • Oz and symbols Александр Гурьянов
    • Re: Oz and symbols Alon Zakai

Reply via email to