cc, pc, m2, acc, apc, am2, gcc, kcc - Minix C, Pascal, and Modula-2
cc|pc|m2|acc|apc|am2|gcc|kcc [-D name[=value]] ... [-U name] ... [-I
directory] ... [-.suffix] ... [-c] [-E] [-P] [-S] [-c.suffix]
[-O] [-Olevel] [-OS] [-OT] [-g] [-n] [-a] [-R] [-A] [-s] [-fsoft]
[-fnone] [-w] [-wo] [-ws] [-wa] [-3] [-_] [-Wname-option] ...
[-march] [-o outfile] [-L directory] ... [-sep] [-uzp] [-pal]
[-com] [-r] [-stack size] operand ...
Cc, pc, m2, acc, apc, am2, gcc and kcc are the call names of the Minix C,
Pascal, and Modula-2 compilers. It is a unified interface to all the
different compilers that can be used under Minix. The first three call
names are used for the default compilers, the next three name the ACK
(Amsterdam Compiler Kit) compilers explicitely, gcc is the GNU project C
compiler, and lastly kcc is the name of the C-compiler used to compile
the Minix kernel.
All these call names are links to the acd driver program, and each uses
the driver description file /usr/lib/name/descr that describes the steps
necessary to compile a source file. In /usr/lib/ one can find several
symlinks from call names to the proper compilers.
The transformations done by the compiler are modified by the following
options. They are a superset of the options required by POSIX, with the
Minix or compiler specific ones are marked as such. Options for one
specific compiler are ignored for others. Read the OPTIONS section of
acd(1) for the driver specific options.
Same as if #define name value had been given. 1 is assumed if value
is omitted. This argument, like all the other double arguments, may
also be given as a single argument. (I.e. either as -D name or
Undefine the pre-defined symbol name.
Extend the include directory path with the given directory. These
directories are searched for include files in the given order before
the standard places. The standard place for the C compiler is
/usr/include, and for the ACK Modula-2 compiler it is
Act as if a source file with the given suffix is present on the
command line. For each language found on the command line the
appropriate libraries are selected. The first language mentioned
selects the runtime startoff. The call name of the driver also
chooses the language, so cc is an implicit -.c. The runtime
startoff can be omitted by specifying -.o for those rare cases where
you want to supply your own startoff. (Minix)
-c Transform the input files to object files and stop. The -o option
may be used under Minix to set the name of the object file. Make(1)
likes this, because cc -c dir/file.c puts file.o in the current
directory, but cc -c dir/file.c -o dir/file.o puts the .o file where
make expects it to be by its builtin .c.o rule.
-E Run the preprocessor over the input files and send the result to
standard output or the file named by -o. Standard input is read if
an input file is named "-".
-P Run the preprocessor over the input files and put the result to
files with the suffix .i. File and line number information is
omitted from the output. Use -P -E under Minix to omit this info
for -E too.
-S Transform the input files to assembly files with suffix .s.
Transform the input files to files with the given suffix. This can
only succeed if there is a valid transformation from the input file
to the given suffix. The same goes for -c and other options that
are just special cases of this option, except for -P, -c.i keeps the
line number info. The option -c.a makes the driver transform the
input files to object files and add them to a library. (So you do
not need to know how the archiver works.) Note that you need to
give object files as arguments if you want to replace old object
files. Transformed files are added under a (unique) temporary name.
With -o you can name the library. (Minix)
-O Optimize code. This option is a no-op, because all the compilers
already use the -O1 optimization level to get code of reasonable
quality. Use -O0 to turn off optimization to speed up compilation
at debug time.
Compile with the given optimization level. (Minix)
Optimize for space or for time. (ACK)
-g Compile the C source with debugging information. (The way -g, -s
and -O interact is left unspecified.)
-n Omit the file and line number tracking that is used for runtime
error reports from Pascal or Modula-2 programs. The -n flag is
normally used to compile library modules, but may also be useful to
make a program smaller and faster once debugged. (ACK Pascal &
-a Enable assertions, i.e. statements of the form assert test that
cause a descriptive runtime error if the boolean expression test
evaluates false. (ACK Pascal & Modula-2)
-R Disable runtime checks like overflow checking. (ACK Pascal &
-A Enable array bound checks. (ACK Pascal & Modula-2)
-s Strip the resulting executable of its symbol table.
Use software floating point instead of hardware floating point.
This flag must be specified in all phases of the compilation so that
the compiler produces code that calls the floating point emulation
library, and that the loader uses libraries that have been compiled
with -fsoft. This option is a no-op for ACK, it figures things out
at runtime. Use GCC if you want fast hardware floating point.
No floating point is used, or more precisely, no floating point is
to be printed or read. A special library is used that contains
printf and scanf functions that don't deal with floating point.
This makes the resulting binary much smaller. (Minix)
-w Do not produce warnings about dubious C language constructs.
Normally the compiler is configured to do the maximum amount of
checking without being too annoying. (Minix)
-wo Omit warnings about old (K&R) style. (Minix)
-ws Omit strict warnings. (Minix)
-wa Omit all warnings. (Minix)
-3 Only accept 3rd edition Modula-2. (ACK Modula-2)
-_ Allow underscores in Pascal or Modula-2 identifiers, but not at the
beginning of an identifier. (ACK Pascal & Modula-2)
If name is the name of the compiler this driver is working for, then
option is activated for that compiler. See below for a per-compiler
list. Any other -W option is ignored. (-W is described by POSIX as
an optional flag to send options to the different compiler passes
with a totally different (and nicely ignored) syntax as described
Set the target architecture for a cross compiler. Normally the
compiler produces code for the same architecture it itself is
compiled for. The ARCH environment variable may also be used to set
the architecture. Architectures names are: i86 (Intel 8086 and
286), i386 (Intel 386, 486, ...), m68000 (Motorola MC68000 &
MC68010, 16-bit ints), m68010 (Motorola MC68000 & MC68010, 32-bit
ints), m68020 (Motorola MC68020, 32-bit ints), sparc (Sun SPARC).
Set the output file for the -c, -c.a, and -E options, or choose the
executable name instead of the default a.out.
Extend the library search path with directory. These directories
are searched for libraries named by -l in the given order before the
standard places. The standard places are /lib/name/arch, and
/usr/lib/name/arch. The search for libaries in directories added
with -L looks in directory/name/arch and directory itself. (Name
and arch are the compiler call name and machine architecture
respectively. This is Minix dependent, compilers on other systems
usually only look in directory.)
Set the attributes of the executable. All attributes are already
set by default. If one or more of these flags are given then the
attributes are determined by these flags. The attributes are:
Separate I&D (-sep), the text segment is read-only and shareable.
Unmapped Zero Page (-uzp), the first page is mapped out to trap null
pointer dereferences. Page aligned (-pal), the disk blocks of the
executable are aligned to the pages in memory. To reset all the
attributes use -com. Attributes are ignored if the target
architecture can't support them. (Minix)
-r Makes the loader produce a relocatable object file, i.e. a file that
may be loaded again. The runtime startoff and the default libraries
are omitted, only the files mentioned are combined. (Minix)
Allow the process size bytes of heap and stack. Size is a C-style
decimal, octal, or hexadecimal number, optionally followed by the
multipliers m, k, w, and b for mega (1024*1024), kilo (1024), "word"
(2 or 4), and byte (1). Uppercase letters are accepted too. A size
of 32kw is used by default, translating to 64k for i86, and 132k for
other architectures. Too large a size is rounded down to keep the
data segment within 64 kilobytes for the i86. Any size under 3
megabytes is rounded up to 3 megabytes at runtime for Minix-vmd.
For all other Minix systems this is a hard limit. (Minix)
All leftover operands are treated as files to be compiled, with one
exception. The construct -l library is used to denote a library, usually
liblibrary.a, that is to be searched in the directories mentioned with -L
or the standard places. These libraries keep their place among the
(transformed) input files when presented to the loader. (It is a common
mistake to write cc -lcurses x.c instead of cc x.c -lcurses.)
One large compiler description file has been created for Minix-vmd to
handle both the ACK and GNU compilers.
Given that this "unified" compiler interface is based on the ACK ANSI-C,
Pascal and Modula-2 compilers most options can be handed over to the ACK
Several additional flags are accepted as synonyms for other flags or
ignored to allow Makefiles written under standard Minix or for the normal
ACK compiler to work, so -f and -fp are synonyms for -fsoft, -m and -F
are ignored, -i sets separate I&D (normally already set by default),
-Rpass-option is seen as -Wack-Rpass-option. The last option can be used
to pass flags to specific ACK programs. Pass can be one of cpp, cem, m2,
pc, opt, ego, opt2, cg, as and led. Read ACK(7) for more detailed
information on the ACK compilers.
Users expecting gcc to work like the normal GCC driver will be
disappointed. The interface given is that described in this manual page.
By default ANSI C is expected with many warnings turned on. Default
options: -ansi -pedantic -Wall -Wstrict-prototypes. -wo takes away
-ansi -Wstrict-prototypes -Wreturn-type. The -wa option removes all
default -W options and warnings about GNU extensions to the C language.
The GCC -f and -W options may not be used directly, but need a -Wgcc
prefix. Any option given with -Wgcc is passed to the C front end.
Feature test macros
The preprocessors are given these arguments to define feature test
macros: -D__ACK__ or -D__GNUC__=2 tell what compiler is used. -D__minix
tells that this is some kind of Minix. -D__minix_vmd tells that this is
Minix-vmd. -D__arch tells the architecture. (More macros are defined,
but they are only to be used in the include files.)
The symbols above are predefined by the preprocessor so that your program
is able to "sense" the environment it is in. It is also possible for
your program to do the opposite, to tell what kind of environment it
likes to have. By default, cc compiles a standard C program. If you
want the extensions described in POSIX.1 to become visible, then you have
to set _POSIX_C_SOURCE to 1, at the start of your program. (Using the
older _POSIX_SOURCE define will also work.) To enable the POSIX.2
extensions you need to set _POSIX_C_SOURCE to 2. To enable UNIX or Minix
extensions you need to set _MINIX_SOURCE to 1. If you don't want to
clutter your source files with these symbols then you can use cc -D_MINIX
to get both the POSIX.2 and the Minix extensions. (This looks a bit
messy, which is no surprise when dealing with committee designed
Pascal, Modula-2, EM source (see below), and Assembly source are
preprocessed by the C preprocessor if the very first character in the
file is a '#' character.
No two compilers use the same assembly language. To be able to use the
same assembly dialect for the low level support routines an assembly
converter is provided. The input of this converter can be of type ack,
ncc, or bas, and the output can be of type ack, ncc, or gnu. The suffix
of the file tells the assembly dialect (see below), or one can use the
option -Was-dialect to tell the driver what the dialect of a plain .s
file is. The assembly converter is not as smart as the assembler, the
translation is more or less a text substitution. It leaves a lot of
checking to the target assembler. You have to restrict yourself to a
subset that is understood by both assemblers. The ACK assembler for
instance doesn't care if you use `ax' or `eax' for a 32 bit register, it
looks at the instruction type. The GNU assembler doesn't like this, so
you have to use the proper register name in ACK assembly that is to be
translated to GNU assembly. Expressions are converted as is, even if the
operator precedence rules of the two assembly languages differ. So use
parentheses. The converter does promise one thing: compiler output can
be properly translated.
The description file for all the compilers.
.c Suffix of a C source file.
.i Preprocessed C source.
.k ACK machine independent compact EM code produced by the C,
Pascal, or Modula-2 front end (or any other ACK front end.)
The ACK compilers are based on the UNCOL idea where several
front ends compile to a common intermediate language, and
several back ends transform the intermediate language to the
target machine language. The ACK intermediate language is
.m Peephole optimized EM.
.gk Result of the (optional) EM global optimizer.
.g Result of the second EM peephole optimizer used after the
.e Human readable EM. (Human created or decoded compact EM.)
.s Target machine assembly. (Current compiler dialect.)
.ack.s ACK assembly.
.ncc.s ACK Xenix style assembly. This dialect is used by the 16 bit
ACK ANSI C compiler.
.gnu.s GNU assembly.
.bas.s BCC assembly. (Used by the Bruce Evans' BCC compiler, for many
years the compiler for Minix-386.)
.o Object code.
.a Object code library.
a.out Default output executable.
Kees J. Bot (firstname.lastname@example.org)