Cebollita Toolset
Introduction
The Cebollita toolset provides a set of command-line tools for
compiling, assembling, linking, inspecting, and simulating
programs.
Environment Issues
Please see the Setup Guide for JDK requirements and
environment variables, like CLASSPATH.
Compiling
A C-- program can be compiled thusly:
java comp.Scc [sourcefile]
[sourcefile] is the name of a C-- program. C-- is a C-subset that
is defined elsewhere. If successful, the compiler will deposit
a file with a .s extension in the same directory as the sourcefile.
The compiler will also produce (in the local directory) an HTML file
(called out.html) that corresponds to the parse-tree for the given
source file.
java comp.Scc --version
Will print out the version of the toolset.
Assembling
Given an assembly file, it can be transformed into an object
file thusly:
java asm.Asm [asmfile]
If successful, a file with a .o extension will be created. The assembler
also understands the following flags:
--version
- Print the current toolset version and quit.
--verbose
- Print lots of messages while assembling.
--bare
- Just dump a "bare" executable, rather than an object file. This will
just dump a stream of instructions. This facility is deprecated -- it can't be guaranteed to do anything interesting anymore.
-O
- Perform (possibly incorrect) peephole optimizations. Very much under development -- use at great risk to your family and home.
Linking
Given a set of object files, the linker will attempt to build an executable.
java asm.Linker [object-files]
will resolve inter- and intra-file references and dump an executable
called a.out in the specified executable format. The linker will also
dump a file called a.sym, which is a symbol table for the executable.
Having this is sometimes helpful for debugging. The linker also
understands the following flags:
--version
- Print the current toolset version and quit.
--verbose
- Print lots of messages while linking.
--entry [name]
- Set the entry point to the given symbol name. By default, the symbol
__start
is used to define the entry point.
--at [address]
- Link the program as if the text
segment will begin at the given address. By default, this value is
zero. This option is useful for linking system-level programs that
may expect to live at memory-resident locations other than those
starting at address zero.
--bare
- Just dump a "bare" executable, consisting only of a sequence of
instructions. This file will contain no header, and no data segment.
This option is useful for building system-level programs that need to
be loaded before the OS loader is running.
Inspecting Executables
Executables can be inspected (dumped) as follows:
java util.Exe [exefile]
This will dump meta-information about the executable, as well as disassembly of the instructions. A useful variant is to use the --smokmem
flag, which will dump an executable in a SMOK compatible memory file format:
java util.Exe --smokmem [exefile]
This will dump header, data, and text segment information about the current
module.
Inspecting Modules
Individual modules can be inspected (dumped) as follows:
java asm.Module [object-file]
This will dump header, data, and text segment information about the current
module.
dugan@cs.washington.edu