Skip to main content

Crate rsasm

Crate rsasm 

Source
Expand description

rsasm — a multi-syntax, multi-architecture assembler.

use rsasm::{arch, assembler::{Assembler, Options}, section::SectionId};

let mut asm = Assembler::new(arch::lookup("x86-64").unwrap(), Options::default());
asm.assemble_str("example.s", "movq %rbx, %rax\nret\n");
assert!(asm.finish());
assert_eq!(asm.section_bytes(SectionId(0)), vec![0x48, 0x89, 0xd8, 0xc3]);

The pipeline is lexer to parser to an architecture backend (arch), which produces section fragments that layout resolves into bytes and relocations for output.

Modules§

arch
Architecture backends.
assembler
The assembler driver: section state, statement processing, layout and fixup resolution.
cursor
A cursor over the tokens of a single statement.
diag
Diagnostics: collection and rendering of errors, warnings and notes.
directives
Built-in assembler directives.
expr
Expression syntax tree, parser and evaluator.
intern
String interning.
layout
Layout, relaxation and fixup resolution.
lexer
Tokenizer.
output
Output writers.
parser
Statement-level parsing.
section
Sections, fragments and fixups.
source
Source file management.
symbol
The symbol table.