Skip to content

Instantly share code, notes, and snippets.

@felixge
Created February 4, 2023 10:29
Show Gist options
  • Save felixge/7f8c8b9adc0e8e26be5209a26e33fcd6 to your computer and use it in GitHub Desktop.
Save felixge/7f8c8b9adc0e8e26be5209a26e33fcd6 to your computer and use it in GitHub Desktop.
$ go tool compile -S main.go
main.main STEXT size=64 args=0x0 locals=0x8 funcid=0x0 align=0x0
0x0000 00000 (main.go:3) TEXT main.main(SB), ABIInternal, $16-0
0x0000 00000 (main.go:3) MOVD 16(g), R16
0x0004 00004 (main.go:3) PCDATA $0, $-2
0x0004 00004 (main.go:3) CMP R16, RSP
0x0008 00008 (main.go:3) BLS 40
0x000c 00012 (main.go:3) PCDATA $0, $-1
0x000c 00012 (main.go:3) MOVD.W R30, -16(RSP)
0x0010 00016 (main.go:3) MOVD R29, -8(RSP)
0x0014 00020 (main.go:3) SUB $8, RSP, R29
0x0018 00024 (main.go:3) FUNCDATA ZR, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
0x0018 00024 (main.go:3) FUNCDATA $1, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
0x0018 00024 (main.go:3) PCDATA $1, ZR
0x0018 00024 (main.go:3) CALL main.foo(SB)
0x001c 00028 (main.go:3) LDP -8(RSP), (R29, R30)
0x0020 00032 (main.go:3) ADD $16, RSP
0x0024 00036 (main.go:3) RET (R30)
0x0028 00040 (main.go:3) NOP
0x0028 00040 (main.go:3) PCDATA $1, $-1
0x0028 00040 (main.go:3) PCDATA $0, $-2
0x0028 00040 (main.go:3) MOVD R30, R3
0x002c 00044 (main.go:3) CALL runtime.morestack_noctxt(SB)
0x0030 00048 (main.go:3) PCDATA $0, $-1
0x0030 00048 (main.go:3) JMP 0
0x0000 90 0b 40 f9 ff 63 30 eb 09 01 00 54 fe 0f 1f f8 [email protected]....
0x0010 fd 83 1f f8 fd 23 00 d1 00 00 00 94 fd fb 7f a9 .....#..........
0x0020 ff 43 00 91 c0 03 5f d6 e3 03 1e aa 00 00 00 94 .C...._.........
0x0030 f4 ff ff 17 00 00 00 00 00 00 00 00 00 00 00 00 ................
rel 24+4 t=9 main.foo+0
rel 44+4 t=9 runtime.morestack_noctxt+0
main.foo STEXT size=64 args=0x0 locals=0x8 funcid=0x0 align=0x0
0x0000 00000 (main.go:6) TEXT main.foo(SB), ABIInternal, $16-0
0x0000 00000 (main.go:6) MOVD 16(g), R16
0x0004 00004 (main.go:6) PCDATA $0, $-2
0x0004 00004 (main.go:6) CMP R16, RSP
0x0008 00008 (main.go:6) BLS 40
0x000c 00012 (main.go:6) PCDATA $0, $-1
0x000c 00012 (main.go:6) MOVD.W R30, -16(RSP)
0x0010 00016 (main.go:6) MOVD R29, -8(RSP)
0x0014 00020 (main.go:6) SUB $8, RSP, R29
0x0018 00024 (main.go:6) FUNCDATA ZR, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
0x0018 00024 (main.go:6) FUNCDATA $1, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
0x0018 00024 (main.go:6) PCDATA $1, ZR
0x0018 00024 (main.go:6) CALL main.bar(SB)
0x001c 00028 (main.go:6) LDP -8(RSP), (R29, R30)
0x0020 00032 (main.go:6) ADD $16, RSP
0x0024 00036 (main.go:6) RET (R30)
0x0028 00040 (main.go:6) NOP
0x0028 00040 (main.go:6) PCDATA $1, $-1
0x0028 00040 (main.go:6) PCDATA $0, $-2
0x0028 00040 (main.go:6) MOVD R30, R3
0x002c 00044 (main.go:6) CALL runtime.morestack_noctxt(SB)
0x0030 00048 (main.go:6) PCDATA $0, $-1
0x0030 00048 (main.go:6) JMP 0
0x0000 90 0b 40 f9 ff 63 30 eb 09 01 00 54 fe 0f 1f f8 [email protected]....
0x0010 fd 83 1f f8 fd 23 00 d1 00 00 00 94 fd fb 7f a9 .....#..........
0x0020 ff 43 00 91 c0 03 5f d6 e3 03 1e aa 00 00 00 94 .C...._.........
0x0030 f4 ff ff 17 00 00 00 00 00 00 00 00 00 00 00 00 ................
rel 24+4 t=9 main.bar+0
rel 44+4 t=9 runtime.morestack_noctxt+0
main.bar STEXT size=16 args=0x0 locals=0x0 funcid=0x0 align=0x0 leaf
0x0000 00000 (main.go:9) TEXT main.bar(SB), LEAF|NOFRAME|ABIInternal, $0-0
0x0000 00000 (main.go:9) FUNCDATA ZR, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
0x0000 00000 (main.go:9) FUNCDATA $1, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
0x0000 00000 (main.go:9) RET (R30)
0x0000 c0 03 5f d6 00 00 00 00 00 00 00 00 00 00 00 00 .._.............
go.cuinfo.producer.<unlinkable> SDWARFCUINFO dupok size=0
0x0000 72 65 67 61 62 69 regabi
go.cuinfo.packagename.main SDWARFCUINFO dupok size=0
0x0000 6d 61 69 6e main
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·g2BeySu+wFnoycgXfElmcg== SRODATA dupok size=8
0x0000 01 00 00 00 00 00 00 00 ........
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment