Define an assembly function
Useasm, a function signature, a syntax target, and the required text section:
return emits a return instruction. The function returns the value in rax. You can call an assembly function from i++ code like an ordinary function:
Target and build pipeline
Usesyntax x86_64_linux and section .text for the documented Linux target. The compiler handles assembly generation and linking as part of compilation.
Constraints
- Include a text section in each assembly function.
- Use the
returnconstruct instead of writing a rawret. - Do not use raw data directives such as
db,dw, ordd; declare data using i++ declarations. - Assembly blocks are opaque to compiler analysis. Manage pointers passed into assembly manually.
- ARM64 and macOS assembly targets are not documented as supported targets.