Package qualification: what package does it belong to? . is a convenience for current package
Static flag: is it visible outside this file?
For arcane reasons . and / are replaced with unicode in asm source code
Name is required. The others are optional and we see all 4 possibilities in the standard library:
no pkg, no static: p256SubInternal
pkg, no static: sync∕atomic·LoadInt32
no pkg, static: _expand_key_192b<>
pkg, static: runtime∕internal∕atomic·kernelcas<>
Examples
The following TEXT symbol names do occur in the standard library:
_expand_key_192b<> (static, no dot)
cmpbody<> (static, no dot)
runtime·sigprofNonGoWrapper<> (static, package qualified)
runtime∕internal∕atomic·kernelcas<> (static, package qualified)
sync∕atomic·LoadInt32 (package qualified)
p256SubInternal (no dot)
Similar to #37 it may be reasonable for this "syntactic sugar" function to handle the common case (leaving other use cases to other context methods). Leaving open for consideration.
TEXT
andGLOBL
symbols are currently too restrictive. I think we do not correctly support:See:
https://github.com/mmcloughlin/avo/blob/49b1691ac09bb443b60c77e0cc97bc0fad23521f/printer/goasm.go#L106
https://github.com/mmcloughlin/avo/blob/49b1691ac09bb443b60c77e0cc97bc0fad23521f/printer/goasm.go#L78
Related to #37
Summary
Symbols have:
.
is a convenience for current package.
and/
are replaced with unicode in asm source codeName is required. The others are optional and we see all 4 possibilities in the standard library:
Examples
The following
TEXT
symbol names do occur in the standard library:Static
TEXT
Symbolshttps://github.com/golang/go/blob/fd752d5ede482cdf52a920c75486677cbcb441b0/src/crypto/aes/asm_amd64.s#L243 https://github.com/golang/go/blob/master/src/internal/bytealg/compare_amd64.s#L30
Almost always these do not include the dot symbol, but there are some weird exceptions.
https://github.com/golang/go/blob/14560da7e469aff46a6f1270ce84204bbd6ffdb3/src/runtime/sys_linux_ppc64x.s#L420 https://github.com/golang/go/blob/14560da7e469aff46a6f1270ce84204bbd6ffdb3/src/runtime/internal/atomic/sys_linux_arm.s#L34
Package-Qualified TEXT Symbols
https://github.com/golang/go/blob/14560da7e469aff46a6f1270ce84204bbd6ffdb3/src/runtime/race_amd64.s#L204
Note this is the unicode "division slash U+2215"
Missing a dot
https://github.com/golang/go/blob/14560da7e469aff46a6f1270ce84204bbd6ffdb3/src/crypto/elliptic/p256_asm_amd64.s#L1313
Processing Code
Assembler lexer:
https://github.com/golang/go/blob/fd752d5ede482cdf52a920c75486677cbcb441b0/src/cmd/asm/internal/lex/lex.go#L104-L114 https://github.com/golang/go/blob/fd752d5ede482cdf52a920c75486677cbcb441b0/src/cmd/asm/internal/lex/tokenizer.go#L52-L67
.
and/
"".
Assembler:
https://github.com/golang/go/blob/fd752d5ede482cdf52a920c75486677cbcb441b0/src/cmd/asm/internal/asm/asm.go#L79-L90 https://github.com/golang/go/blob/fd752d5ede482cdf52a920c75486677cbcb441b0/src/cmd/internal/obj/plist.go#L80-L82
NAME_EXTERN
orNAME_STATIC
asmdecl
passhttps://github.com/golang/tools/blob/3ef68632349c4eab68426d81d981d131b625cafc/go/analysis/passes/asmdecl/asmdecl.go#L277-L279
<>
must have Go declarations