减少 golang 二进制文件大小操作
The linker in the gc toolchain creates statically-linked binaries by default. All Go binaries therefore include the Go runtime, along with the run-time type information necessary to support dynamic type checks, reflection, and even panic-time stack traces.A simple C “hello, world” program compiled and linked statically using gcc on Linux is around 750 kB, including an implementation of printf. An equivalent Go program using fmt.Printf weighs a couple of megabytes, but that includes more powerful run-time support and type and debugging information.所以,为什么 go 二进制比 C 大很多就比较明显了。golang 静态编译,不依赖动态库。二. 如何减小 go 二进制文件大小上面已经提到了过了。下面是支持 Go 的 IDA helper可以看到 go 的一些函数名。已经看不到函数名信息,只有类似 sub_47BF70 这样。
用户评论