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

Ability to pass flags to external linker (such as `wasm-ld`) #4320

Open jmillikin opened 2 days ago

jmillikin commented 2 days ago

While looking into https://github.com/tinygo-org/tinygo/issues/4319, I discovered that there doesn't seem to be a way to pass flags to the wasm-ld external linker from the tinygo build command. The only way I could find is to create a custom target JSON, which is a bit heavyweight.

There is -ldflags, but it's documented as being for flags compatible with the Go linker.

The standard Go build system defines -extldflags which seems to be what I want, but tinygo build doesn't have that flag.