vas
is a lightweight assembler written in the V programming language that supports Linux x86-64 assembly with AT&T syntax. It compiles assembly source files into object files that can be linked with ld
.
- x86-64 instruction set support
- AT&T syntax
- ELF object file generation
- Support for common assembler directives
- Standard input support via
-
argument
# Build the Docker image
docker build ./ -t vas
# Run the container
# Linux/MacOS:
docker run --rm -it -v "$(pwd)":/root/env vas
# Windows (CMD):
docker run --rm -it -v "%cd%":/root/env vas
# Windows (PowerShell):
docker run --rm -it -v "${pwd}:/root/env" vas
Requires the V compiler to be installed.
v . -prod
Basic usage:
vas [options] <input_file>.s
Options:
-o <filename>
: Set output file name (default: input_file.o)--keep-locals
: Keep local symbols (e.g., those starting with.L
)
- Create an assembly file (hello.s):
# Hello world example
.global _start
.section .data, "aw"
msg:
.string "Hello, world!\n"
.section .text, "ax"
_start:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movq $1, %rax # write syscall
movq $1, %rdi # stdout
movq $msg, %rsi # message
movq $14, %rdx # length
syscall
movq $60, %rax # exit syscall
movq $0, %rdi # status code 0
syscall
- Assemble the file:
vas hello.s
- Link the object file:
ld hello.o
- Run the executable:
./a.out
Output:
Hello, world!
This project is licensed under the MIT License - see the LICENSE file for details.