[][src]Function x64_asm::assemble_code

pub fn assemble_code(
    assembly_code: String,
    output_file: &str,
    syntax: Syntax
) -> Result<ELFBuilder, Box<dyn Error>>

translate assembly code into object file.

Examples

use x64_asm::*;

let s = "    .globl main
    .type main, @function
main:
    pushq %rbp
    movq %rsp, %rbp
    movq $42, %rax
    popq %rbp
    ret"
    .to_string();
let elf_builder = assemble_code(s, "obj.o", Syntax::ATANDT).unwrap();
elf_builder.generate_elf_file(0o644);