Go语言编译后的汇编指令
Go1.20以及之后的版本为了减小Go发行版的大小,默认不再安装标准库的预编译包,需要执行以下命令自行安装。
GODEBUG=installgoroot=all go install std
否则若依赖到标准库,会抛出类似以下异常:
could not import fmt (open fmt.a: no such file or directory)
//main.go
package main
func main() {
}
go tool compile -S main.go
//Output:
"".main STEXT nosplit size=1 args=0x0 locals=0x0 funcid=0x0
0x0000 00000 (main.go:3) TEXT "".main(SB), NOSPLIT|ABIInternal, $0-0
0x0000 00000 (main.go:3) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0000 00000 (main.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0000 00000 (main.go:8) RET
0x0000 c3 .
go.cuinfo.packagename. SDWARFCUINFO dupok size=0
0x0000 6d 61 69 6e main
""..inittask SNOPTRDATA size=24
0x0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0010 00 00 00 00 00 00 00 00 ........
gclocals·33cdeccccebe80329f1fdbee7f5874cb SRODATA dupok size=8
0x0000 01 00 00 00 00 00 00 00 ........
-N 参数禁止编译器进行优化, -l 参数禁止内联代码,
标签:汇编,00,0x0000,go,Go,main,size From: https://www.cnblogs.com/acethan/p/18156445