Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.
module is through the one symbol it exports, `nasmlist', which is a
structure containing six function pointers. The calling semantics of
these functions isn't terribly well thought out, as yet, but it
works (just about) so it's going to get left alone for now...
outform.c
---------
This small module contains a set of routines to manage a list of
output formats, and select one given a keyword. It contains three
small routines: `ofmt_register' which registers an output driver as
part of the managed list, `ofmt_list' which lists the available
drivers on stdout, and `ofmt_find' which tries to find the driver
corresponding to a given name.
The output modules
------------------
Each of the output modules, `outbin.o', `outelf.o' and so on,
exports only one symbol, which is an output driver data structure
containing pointers to all the functions needed to produce output
files of the appropriate type.
The exception to this is `outcoff.o', which exports _two_ output
driver structures, since COFF and Win32 object file formats are very
similar and most of the code is shared between them.
nasm.c
------
This is the main program: it calls all the functions in the above
modules, and puts them together to form a working assembler. We
hope. :-)
Segment Mechanism
-----------------
In NASM, the term `segment' is used to separate the different
sections/segments/groups of which an object file is composed.
Essentially, every address NASM is capable of understanding is
expressed as an offset from the beginning of some segment.
The defining property of a segment is that if two symbols are
declared in the same segment, then the distance between them is
fixed at assembly time. Hence every externally-declared variable
must be declared in its own segment, since none of the locations of
these are known, and so no distances may be computed at assembly
time.
The special segment value NO_SEG (-1) is used to denote an absolute
value, e.g. a constant whose value does not depend on relocation,
such as the _size_ of a data object.
Apart from NO_SEG, segment indices all have their least significant
bit clear, if they refer to actual in-memory segments. For each
segment of this type, there is an auxiliary segment value, defined
to be the same number but with the LSB set, which denotes the
segment-base value of that segment, for object formats which support