内容简介:简单的源码生成汇编的代码生成的汇编
简单的源码
package main func main(){ }
生成汇编的代码
go tool compile -S -l test.go -S 是打印汇编 -l 是防止内联
生成的汇编
"".main STEXT nosplit size=1 args=0x0 locals=0x0 0x0000 00000 (test.go:3) TEXT "".main(SB), NOSPLIT, $0-0 # "".main(SB) 函数名称 (SB -> static base) # NOSPLIT 无需提供参数大小 # $0-0 (局部变量的大小字节数) - (传入参数 + 返回值所占的字节数) 0x0000 00000 (test.go:3) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) 0x0000 00000 (test.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) 0x0000 00000 (test.go:3) FUNCDATA $3, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) # FUNCDATA 跟gc的垃圾回收有关... 编译器自动生成的 0x0000 00000 (test.go:4) RET # RET 函数返回 0x0000 c3 . "".init STEXT size=80 args=0x0 locals=0x8 0x0000 00000 (<autogenerated>:1) TEXT "".init(SB), $8-0 0x0000 00000 (<autogenerated>:1) MOVQ (TLS), CX 0x0009 00009 (<autogenerated>:1) CMPQ SP, 16(CX) 0x000d 00013 (<autogenerated>:1) JLS 73 0x000f 00015 (<autogenerated>:1) SUBQ $8, SP 0x0013 00019 (<autogenerated>:1) MOVQ BP, (SP) 0x0017 00023 (<autogenerated>:1) LEAQ (SP), BP 0x001b 00027 (<autogenerated>:1) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) 0x001b 00027 (<autogenerated>:1) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) 0x001b 00027 (<autogenerated>:1) FUNCDATA $3, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) 0x001b 00027 (<autogenerated>:1) PCDATA $2, $0 0x001b 00027 (<autogenerated>:1) PCDATA $0, $0 0x001b 00027 (<autogenerated>:1) MOVBLZX "".initdone·(SB), AX 0x0022 00034 (<autogenerated>:1) CMPB AL, $1 0x0025 00037 (<autogenerated>:1) JLS 48 0x0027 00039 (<autogenerated>:1) PCDATA $2, $-2 0x0027 00039 (<autogenerated>:1) PCDATA $0, $-2 0x0027 00039 (<autogenerated>:1) MOVQ (SP), BP 0x002b 00043 (<autogenerated>:1) ADDQ $8, SP 0x002f 00047 (<autogenerated>:1) RET 0x0030 00048 (<autogenerated>:1) JNE 57 0x0032 00050 (<autogenerated>:1) PCDATA $2, $0 0x0032 00050 (<autogenerated>:1) PCDATA $0, $0 0x0032 00050 (<autogenerated>:1) CALL runtime.throwinit(SB) 0x0037 00055 (<autogenerated>:1) UNDEF 0x0039 00057 (<autogenerated>:1) MOVB $2, "".initdone·(SB) 0x0040 00064 (<autogenerated>:1) MOVQ (SP), BP 0x0044 00068 (<autogenerated>:1) ADDQ $8, SP 0x0048 00072 (<autogenerated>:1) RET 0x0049 00073 (<autogenerated>:1) NOP 0x0049 00073 (<autogenerated>:1) PCDATA $0, $-1 0x0049 00073 (<autogenerated>:1) PCDATA $2, $-1 0x0049 00073 (<autogenerated>:1) CALL runtime.morestack_noctxt(SB) 0x004e 00078 (<autogenerated>:1) JMP 0 0x0000 64 48 8b 0c 25 00 00 00 00 48 3b 61 10 76 3a 48 dH..%....H;a.v:H 0x0010 83 ec 08 48 89 2c 24 48 8d 2c 24 0f b6 05 00 00 ...H.,$H.,$..... 0x0020 00 00 80 f8 01 76 09 48 8b 2c 24 48 83 c4 08 c3 .....v.H.,$H.... 0x0030 75 07 e8 00 00 00 00 0f 0b c6 05 00 00 00 00 02 u............... 0x0040 48 8b 2c 24 48 83 c4 08 c3 e8 00 00 00 00 eb b0 H.,$H........... rel 5+4 t=16 TLS+0 rel 30+4 t=15 "".initdone·+0 rel 51+4 t=8 runtime.throwinit+0 rel 59+4 t=15 "".initdone·+-1 rel 74+4 t=8 runtime.morestack_noctxt+0 go.loc."".main SDWARFLOC size=0 go.info."".main SDWARFINFO size=33 0x0000 02 22 22 2e 6d 61 69 6e 00 00 00 00 00 00 00 00 ."".main........ 0x0010 00 00 00 00 00 00 00 00 00 01 9c 00 00 00 00 01 ................ 0x0020 00 . rel 9+8 t=1 "".main+0 rel 17+8 t=1 "".main+1 rel 27+4 t=29 gofile../home/work/workspace/Go/src/shenshida.com/hello/test/test.go+0 go.range."".main SDWARFRANGE size=0 go.isstmt."".main SDWARFMISC size=0 0x0000 04 01 00 ... go.loc."".init SDWARFLOC size=0 go.info."".init SDWARFINFO size=33 0x0000 02 22 22 2e 69 6e 69 74 00 00 00 00 00 00 00 00 ."".init........ 0x0010 00 00 00 00 00 00 00 00 00 01 9c 00 00 00 00 01 ................ 0x0020 00 . rel 9+8 t=1 "".init+0 rel 17+8 t=1 "".init+80 rel 27+4 t=29 gofile..<autogenerated>+0 go.range."".init SDWARFRANGE size=0 go.isstmt."".init SDWARFMISC size=0 0x0000 04 0f 04 0c 03 07 01 05 02 09 01 07 02 09 01 09 ................ 0x0010 02 07 00 ... "".initdone· SNOPTRBSS size=1 gclocals·33cdeccccebe80329f1fdbee7f5874cb SRODATA dupok size=8 0x0000 01 00 00 00 00 00 00 00 ........
剩下的好多我也看不懂呀。。。难受想哭
自动生成的好多都看不懂。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- iOS汇编入门教程(一)ARM64汇编基础
- iOS 汇编入门教程(一):ARM64 汇编基础
- iOS汇编入门教程(三)汇编中的 Section 与数据存取
- iOS汇编入门教程(二)在Xcode工程中嵌入汇编代码
- 汇编语言8086笔记
- python编程(反汇编)
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。