使用golang汇编语言对golang方法进行下划线实现

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!

ok well you have 3 different tools you're talking about, as for go object dump it does dump the correct symbols. The go compiler compiles go source code and generates symbols such as the above. The go assembler can't use without modification symbols with '(', "*", ")" and many others. When it see's the parentheses it expects what's inside to be a register. So you got a few options, like use a different assembler that supports symbols like that, you could modify the assembler to allow symbols like that or you could rename your symbols to something that the go assembler allows.