I wrote a simple go package as follows:
package mytest
type T int32
func (a T) MyTest(b T) (T, T)
func (p *T) MyTestp(b T) (T, T)
func MyTest(a, b T) (T, T)
func MyTestp(p *T, b T) (T, T)
The corresponding assembly code(generated by go tool objdump), as follows:
TEXT ·MyTest(SB), $0-16
MOVL a + 0x0(FP), AX
MOVL b + 0x4(FP), BX
MOVL BX, CX
ADDL AX, CX
MOVL CX, r1 + 0x8(FP)
SUBL BX, AX
MOVL AX, r2 + 0xc(FP)
RET
TEXT ·MyTestp(SB), $0-24
MOVQ p + 0x0(FP), CX
MOVL b + 0x8(FP), BX
MOVL (CX), AX
MOVL BX, CX
ADDL AX, CX
MOVL CX, r1 + 0x10(FP)
SUBL BX, AX
MOVL AX, r2 + 0x14(FP)
RET
TEXT ·T·MyTest(SB), $0-16
MOVL a + 0x0(FP), AX
MOVL b + 0x4(FP), BX
MOVL BX, CX
ADDL AX, CX
MOVL CX, r1 + 0x8(FP)
SUBL BX, AX
MOVL AX, r2 + 0xc(FP)
RET
TEXT ·(*T)·MyTestp(SB), $0-24
MOVQ p + 0x0(FP), CX
MOVL b + 0x8(FP), BX
MOVL (CX), AX
MOVL BX, CX
ADDL AX, CX
MOVL CX, r1 + 0xC(FP)
SUBL BX, AX
MOVL AX, r2 + 0x10(FP)
RET
when I compile these assembly code, all is ok except "TEXT ·(*T)·MyTestp(SB), $0-24", error message as follows:
expected identifier, found *
I think objdump using a readable denotion (*T) for output, but for complier, it is wrong. so any one know the correct denotion? Thanks in advance!