Skip to content

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

@Garrett-Bodley

Description

@Garrett-Bodley

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions