mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 18:47:47 +00:00
be33de1086
With these flags, the TinyGo binary gets 18.8MB (11.6%) smaller. That seems like a quite useful win for such a small change! This is only for Linux for now. MacOS and Windows can be tested later, the flags for those probably need to be modified. Originally inspired by: https://discourse.llvm.org/t/state-of-the-art-for-reducing-executable-size-with-heavily-optimized-program/87952/18 There are some other flags like -Wl,--pack-dyn-relocs=relr that did not shrink binary size in my testing, so I've left them out. This also switches the linker to prefer mold or lld over the default linker, since the system linker is usually ld.bfd which is very slow. (Also, for some reason mold produces smaller binaries than lld).