Was running into this issue with wasm-opt, and found that the -g option works well to preserve the necessary information. It looks like emcc supports the same option!
wasm-opt
-g
emcc