Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
spasm - sytem programming assembler About: A minimal assembler written for the custom assembler dialect generated by the compilers written for the system programmings class at hs karlsruhe SS 2011. The assembler is written in C89 and capable of parsing an assembly input file and transforming it into an linux compatible ELF32 executable that should execute on any x86 compatible linux platform. spasm generated binaries are intentionally kept as low-level as possible (not relying on a linker / dynamic libraries). Requirements: * C89 compatible compiler (gcc and clang supported by Makefile. tcc tested) * nasm (only needed for spasm development) * python (only needed for spasm development) Build: Default builds using gcc in debug mode targeting the system native architecture. To fix the target architecture, build release or use clang the following parameters are accepted by make: $ make [mode=debug|release] [tool=gcc|clang] [arch=32|64] Usage: $ ./spasm <source> <target> [-i/--info] Whereas source is the assembly input file and target is the name for the binary to create. The optional info flag will make spasm output parts of its internal AST information extended with virtual address information created for binary generation. The resulting target binary can be executed like any other binary. Architecture: spasm is split into two seperated steps of operation: 1) The parsing of the assembly file to an AST representation located in spasm_parser.c/h 2) The generation of the binary output from the AST located in spasm_writer.c/h The generation step uses one-to-one replacements of AST command types with predefined binary sequences for the executable (see spasm_commands.h/c). Non-relative commands are re-written during generation. (Note: For a detailed explanation on how to adjust/extend commands see asm/README) The executable code produced that way is inserted into an ELF32 binary using the helper functions from helpers/elfwrite.c/h. Author: Stefan Hacker <email@example.com>