Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build,ir, printer: Support for internal assembly functions #442

Open
Garrett-Bodley opened this issue Aug 20, 2024 · 0 comments · May be fixed by #443
Open

build,ir, printer: Support for internal assembly functions #442

Garrett-Bodley opened this issue Aug 20, 2024 · 0 comments · May be fixed by #443

Comments

@Garrett-Bodley
Copy link

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:

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:

Garrett-Bodley added a commit to Garrett-Bodley/avo that referenced this issue Aug 20, 2024
Adds support for internal assembly functions. The new InternalFunction()
call outputs a TEXT directive sans the pesky unicode dot used in Go
assembly. This allows Avo to generate an internal assembly function that
is not linked to any symbols in the corresponding package.

Closes mmcloughlin#442
@Garrett-Bodley Garrett-Bodley linked a pull request Aug 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant