WikiLeaks - Vault 7: Projects

# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Athena

# nasm-2-doc_internal

- 1
- 2
- 3
- 4
- 5

it (Microsoft .OBJ, for example).
Hence, if `textsym' is declared in a code segment with index 2, then
referencing `SEG textsym' would return zero offset from
segment-index 3. Or, in object formats which don't understand such
references, it would return an error instead.
The next twist is SEG_ABS. Some symbols may be declared with a
segment value of SEG_ABS plus a 16-bit constant: this indicates that
they are far-absolute symbols, such as the BIOS keyboard buffer
under MS-DOS, which always resides at 0040h:001Eh. Far-absolutes are
handled with care in the parser, since they are supposed to evaluate
simply to their offset part within expressions, but applying SEG to
one should yield its segment part. A far-absolute should never find
its way _out_ of the parser, unless it is enclosed in a WRT clause,
in which case Microsoft 16-bit object formats will want to know
about it.
Porting Issues
--------------
We have tried to write NASM in portable ANSI C: we do not assume
little-endianness or any hardware characteristics (in order that
NASM should work as a cross-assembler for x86 platforms, even when
run on other, stranger machines).
Assumptions we _have_ made are:
- We assume that `short' is at least 16 bits, and `long' at least
32. This really _shouldn't_ be a problem, since Kernighan and
Ritchie tell us we are entitled to do so.
- We rely on having more than 6 characters of significance on
externally linked symbols in the NASM sources. This may get fixed
at some point. We haven't yet come across a linker brain-dead
enough to get it wrong anyway.
- We assume that `fopen' using the mode "wb" can be used to write
binary data files. This may be wrong on systems like VMS, with a
strange file system. Though why you'd want to run NASM on VMS is
beyond me anyway.
That's it. Subject to those caveats, NASM should be completely
portable. If not, we _really_ want to know about it.
Porting Non-Issues
------------------
The following is _not_ a portability problem, although it looks like
one.
- When compiling with some versions of DJGPP, you may get errors
such as `warning: ANSI C forbids braced-groups within
expressions'. This isn't NASM's fault - the problem seems to be
that DJGPP's definitions of the <ctype.h> macros include a
GNU-specific C extension. So when compiling using -ansi and
-pedantic, DJGPP complains about its own header files. It isn't a
problem anyway, since it still generates correct code.

- 1
- 2
- 3
- 4
- 5