tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
14.72k stars 858 forks source link

tweaks for wasm-opt running logic #4279

Closed dgryski closed 1 month ago

dgryski commented 1 month ago

1) if -work was passed don't overwrite original. .wasm binary 2) if -x was passed print out wasm-opt command line.

jameysharp commented 1 month ago

I asked Damian for this because it helps with troubleshooting bugs introduced by wasm-opt if we can check what the wasm looked like before that. For example, I was just now able to use this PR to verify that llvm-dwarfdump --verify finds no errors in the DWARF data before wasm-opt, but finds a bunch of errors after wasm-opt, for this program:

package main
import "os"
func main() {
        os.Lstat("some-filename")
}