-
Notifications
You must be signed in to change notification settings - Fork 92
Description
Issue
As referenced in #39, Avo cannot generate TEXT directives without prepending the "pesky unicode dot" to the associated symbol.
I have been working on porting the amd64 assembly in Go's crypto libraries to Avo. A few files (crypto/aes/asm_amd64.s, crypto/internal/nistec/p256_asm_amd64.s, and golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s) contain internal assembly functions that are not linked to any Go package.
Avo unconditionally prepends the "pesky unicode dot" to all function names:
Line 90 in 13668f4
| p.Printf("TEXT %s%s(SB)", dot, f.Name) |
This makes it impossible to write internal assembly functions using Avo.
Proposal
I propose adding an IsInternal field to the existing Function struct. This can be used to conditionally prepend the unicode dot during the printing process. We could add an InternalFunction() call which runs parallel to the existing Function() call but sets IsInternal to true. Additionally a call to SignatureExpr() should create an error if the active function has IsInternal: true
This will allow the generation of internal assembly functions. I am using the phrase "internal function" as that naming convention appears in crypto/internal/nistec/p256_asm_amd64.s and golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s
Reference
Internal amd64 assembly functions currently in Go's crypto library:
- https://github.com/golang/go/blob/27093581b2828a2752a6d2711def09517eb2513b/src/crypto/aes/asm_amd64.s#L211
- https://github.com/golang/go/blob/27093581b2828a2752a6d2711def09517eb2513b/src/crypto/aes/asm_amd64.s#L222
- https://github.com/golang/go/blob/27093581b2828a2752a6d2711def09517eb2513b/src/crypto/aes/asm_amd64.s#L245
- https://github.com/golang/go/blob/27093581b2828a2752a6d2711def09517eb2513b/src/crypto/aes/asm_amd64.s#L263
- https://github.com/golang/go/blob/27093581b2828a2752a6d2711def09517eb2513b/src/crypto/aes/asm_amd64.s#L266
- https://github.com/golang/go/blob/27093581b2828a2752a6d2711def09517eb2513b/src/crypto/internal/nistec/p256_asm_amd64.s#L1318
- https://github.com/golang/go/blob/27093581b2828a2752a6d2711def09517eb2513b/src/crypto/internal/nistec/p256_asm_amd64.s#L1344
- https://github.com/golang/go/blob/27093581b2828a2752a6d2711def09517eb2513b/src/crypto/internal/nistec/p256_asm_amd64.s#L1527
- https://github.com/golang/go/blob/27093581b2828a2752a6d2711def09517eb2513b/src/crypto/internal/nistec/p256_asm_amd64.s#L1996
- https://github.com/golang/crypto/blob/b2d3a6a4b4d36521cd7f653879cf6981e7c5c340/chacha20poly1305/chacha20poly1305_amd64.s#L232