NAME
0c, 1c, 2c, 5c, 6c, 7c, 8c, kc, qc, tc, vc – C compilers |
SYNOPSIS
2c [ option ... ] [ file ... ] etc. |
DESCRIPTION
These commands compile the named C files into object files for
the corresponding architecture. If there are multiple C files,
the compilers will attempt to keep $NPROC compilations running
concurrently. Associated with each compiler is a string objtype,
for example 0c spim little–endian MIPS 3000 family 1c 68000 Motorola MC68000 2c 68020 Motorola MC68020 5c arm little–endian ARM 6c amd64 AMD64 and compatibles (e.g., Intel EM64T) 7c arm64 ARM64 (ARMv8) 8c 386 Intel i386, i486, Pentium, etc. kc sparc Sun SPARC qc power Power PC tc thumb ARM Thumb vc mips big–endian MIPS 3000 family The compilers handle most preprocessing directives themselves; a complete preprocessor is available in cpp(1), which must be run separately. Let the first letter of the compiler name be O= 0, 1, 2, 5, 6, 7, 8, k, q, t, or v. The output object files end in .O. The letter is also the prefix of related programs: Oa is the assembler, Ol is the loader. Plan 9 conventionally sets the $objtype environment variable to the objtype string appropriate to the current machine's type. Plan 9 also conventionally has /objtype directories, which contain among other things: include, for machine–dependent include files; lib, for public object code libraries; bin, for public programs; and mkfile, for preconditioning mk(1).
The compiler options are:
–N Suppress automatic registerization and optimization. –S Print an assembly language version of the object code on standard output as well as generating the .O file. –T Pass type signatures on all external and global entities. The signature is based on the C signof operator. –V By default, the compilers are non–standardly lax about type equality between void* values and other pointers; this flag requires ANSI C conformance. –p Invoke a standard ANSI C preprocessor before compiling. –a Instead of compiling, print on standard output acid functions (see acid(1)) for examining structures declared in the source files. –aa Like –a except suppress information about structures declared in included header files. –n When used with –a or –aa, places acid functions in file.acid for input file.c, and not on standard output.
The compilers support several extensions to ANSI C:
– A #pragma of the form
– The compilers accept long long variables as a 64–bit type. The standard header typedefs this to vlong. Arithmetic on vlong values is usually emulated by a run–time library, though in at least 8c, only division and modulus use the run–time library and the other operators generate in–line code (and uvlong–
– The compilers use the original "unsigned preserving", rather than ANSI C "value preserving" rules, which means that, e.g., unsigned char gets promoted to unsigned int rather than int. – Parameters in macros are substituted inside of strings. |
EXAMPLE
For the 68020, produce a program prog from C files main.c and
sub.c:
|
FILES
/sys/include system area for machine–independent #include directives. /$objtype/include system area for machine–dependent #include directives. |
SOURCE
/sys/src/cmd/cc machine–independent part /sys/src/cmd/2c, etc. machine–dependent part |
SEE ALSO
2a(1), 2l(1), cpp(1), mk(1), nm(1), pcc(1), db(1), acid(1)
Rob Pike, ``How to Use the Plan 9 C Compiler'' |
BUGS
The list of compilers given above is only partial, not all architectures
are supported on all systems, some have been retired and some
are provided by third parties. The default preprocessor only handles #define, #include, #undef, #ifdef, #line, and #ifndef. For a full ANSI preprocessor, use the p option. The default search order for include files differs to that of cpp(1). Some features of C99, the 1999 ANSI C standard, are implemented. switch expressions may not be either signedness of vlong on 32–bit architectures (8c at least).
The implementation of vlong assignment can use a static location
and this can be disturbed by interrupts (e.g., notes) (8c at least). |