Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cc(1) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

as(1)

dis(1)

ld(1)

setcompat(2)




cc(1) cc(1)
NAME cc - C compiler SYNOPSIS cc [-A factor] [-B string] [-c] [-C] [-Dsymbol[=def]] [-E] [-fm68881] [-F] [-g] [-Idir] [-lx] [-L dir] [-n] [-o outfile] [-O] [-p] [-P] [-R] [-s] [-S] [-t [p012al]] [-T] [-Usymbol] [-v] [-W c,arg1[,arg2...]] [-X] [-Zflags] [-#] ... file ... DESCRIPTION cc is a front-end program that invokes the preprocessor, compiler, assembler, and link editor, as appropriate. The default is to invoke each one in turn. Arguments whose names end with .c are taken to be C source programs. They are compiled, and each object program is left in a file in the current directory, whose name is that of the source, with .o substituted for .c. In the same way, arguments whose names end with .s are taken to be assembly source programs and are assembled to produce a .o file. By default, the named files are loaded to produce an output file named a.out. If a single C program is compiled and loaded all at once, the .o file is deleted. FLAG OPTIONS The following flag options are interpreted by cc. (Other flag options may be passed to the assembler and the linker. See ld(1) for link-editor flag options and as(1) for assem- bler options.) -A factor Expand the default symbol table allocations for the compiler, assembler, and link editor. The default allocation is multiplied by the factor given. -B string Construct pathnames for substitute preprocessor, compiler, assembler, and link-editor passes by con- catenating string with the suffixes cpp, comp, op- tim, as, and ld. If string is empty, it is taken to be /lib/. For example, versions of the C compiler, assembler, and link editor can be found in the directory /usr/lib/big. These tools operate just like their standard counterparts, except that their symbol tables are very large. If you receive an overflow error message when you compile your program with the standard versions, you may wish to switch to the alternate versions using cc -B /usr/lib/big/ -o filename filename.c April, 1990 1



cc(1) cc(1)
You should have 4 MB or more of main memory in order to use the big versions of these programs safely. -c Suppress the link-editing phase of the compilation and force an object file to be produced even if only one program is compiled. -C Pass along all comments except those found on cpp(1) directive lines. The default strips out all com- ments. -Dsymbol[=def] Define the external symbol to the preprocessor and give it the value def (if specified). If no def is given, symbol is defined as 1. This mechanism is useful for conditional compilation using preproces- sor control lines. -E Run only cpp(1) on the named C programs and send the result to the standard output. -fm68881 Generate inline code for the MC68881 floating-point coprocessor. This is the default. -F Do not generate inline code for the MC68881 floating-point coprocessor. -g Generate additional information needed for the use of sdb(1). -Idir Search for #include files (whose names do not begin with /) in dir before looking in the directories on the standard list. Thus, #include files whose names are enclosed in `` '' (double quotes) are initially searched for in the directory of the .c file currently being compiled, then in directories named in -I flag options, and finally in directories on a standard list. For #include files whose names are enclosed in <>, the directory of the .c file is not searched. -lx Same as -l in ld(1). Search the library libx.a, where x is up to 7 characters long. A library is searched when its name is encountered, so the place- ment of -l is significant. By default, libraries are located in LIBDIR. If you plan to use the -L option, that option must precede -l on the command line. -L dir Same as -L in ld(1). Change the algorithm of searching for libx.a to look in dir before looking 2 April, 1990



cc(1) cc(1)
in LIBDIR. This option is effective only if it pre- cedes the -l option on the command line. -n Arrange for the loader to produce an executable which is linked in such a manner that the text can be made read-only and shared (nonvirtual) or paged (virtual). -o outfile Same as -o in ld(1). Produce an output object file, outfile. The default name of the object file is a.out. -O Invoke an object-code optimizer. The optimizer moves, merges, and deletes code, so symbolic debug- ging with line numbers could be confusing when the optimizer is used. For this reason, use of the -g flag option disables the -O flag option. This op- tion may not work properly on code containing asm directives. -p Arrange for the compiler to produce code that counts the number of times each routine is called. Also, if link-editing takes place, replace the standard startoff routine by one that automatically calls monitor(3C) at the start and arranges to write out a mon.out file at normal termination of execution of the object program. -P Run only cpp(1) on the named C programs and leave the result on corresponding files suffixed .i. -R Have assembler remove its input file when finished. -s Same as -s in ld(1). Strip line-number entries and symbol-table information from the output of the ob- ject file. -S Compile, but do not assemble, the named C programs and leave the assembly-language output on corresponding files suffixed .s. -t [p012al] Find only the designated preprocessor passes whose names are constructed with the string argument of the -B flag option, that is, (p), compiler (0 and 1), optimizer (2), assembler (a), and link editor (1). In the absence of a -B option and its argument, string is taken to be /lib/n. Using -t with no argument is equivalent to -tp012. -T Truncate symbol names to 8 significant characters. April, 1990 3



cc(1) cc(1)
Many modern C compilers, as well as the proposed ANSI standard for C, allow arbitrary-length variable names. cc follows this convention. The -T option is provided for compatibility with earlier systems. -Usymbol Undefine symbol to the preprocessor. -v Print the command line for each subprocess executed. -Wc,arg1[,arg2...] Hand off the argument(s) argi (where i = 1,2, ..., n) to pass c, where c is one of [p012al] indicating preprocessor, compiler first pass, compiler second pass, optimizer, assembler, or link editor, respec- tively. For example, -Wa,-m invokes the m4 macro preprocessor on the input to the assembler. (The -m flag option to as causes it to go through m4.) This must be done for a source file that contains assembler escapes. -X Ignored by A/UX(Reg.) for the Motorola 68020 and 68030 host processors. -Zflags Special flags to override the default behavior (see NOTES in this section). Currently recognized flags are: c Suppress returning pointers in both a0 and d0. n Emit no code for stack-growth. This is the de- fault. m Use Motorola SGS-compatible stack growth code. p Use tst.b stack probes. E Ignore all environment variables. I Emit inline code for the MC68881 floating-point coprocessor. This is the default. l Suppress selection of a loader command file. t Do not delete temporary files. S Compile to be SVID-compatible. Link the pro- gram with a library module that calls setcompat(2) with the COMPAT_SVID flag set. 4 April, 1990



cc(1) cc(1)
Define only the SYSV_SOURCE feature test macro. P Compile for the POSIX environment. Link the program with a library module that calls setcompat(2) with the COMPAT_POSIX flag set. Define only the POSIX_SOURCE feature test mac- ro. B Compile to be BSD-compatible. Link the program with a library module that calls setcompat(2) with the COMPAT_BSD flag set. Define only the BSD_SOURCE feature test macro. -# Without actually starting the program, echo the names and arguments of subprocesses that would have started. This is a special debug option. Other arguments are taken to be link-editor flag-option ar- guments, C-compatible object programs (typically produced by an earlier run of cc), or libraries of C-compatible rou- tines. These programs, together with the results of any compilations specified, are link edited (in the order given) to produce an executable program with the name a.out unless the -o flag option of the link editor is used. FILES /usr/bin/cc file.c input file file.o object file file.s assembly language file a.out link-edited output /usr/tmp/mc68? temporary /lib/cpp preprocessor /lib/comp compiler /lib/optim optimizer /bin/as assembler, as(1) /bin/ld link editor, ld(1) /lib/libc.a standard library, see (3) /lib/libposix.a POSIX library, see (2P) and (3P) /lib/libbsd.a BSD library /lib/libsvid.a SVID library /usr/lib/shared.ld loader command file for shared text or paged programs /usr/lib/shlib.ld loader command file for shared text or paged programs using shared libraries /usr/lib/unshared.ld loader command file for unshared text programs /usr/lib/unshlib.ld loader command file for unshared text programs using shared libraries /lib/crt0.o run-time startoff /lib/crt1.o run-time startoff with shared library April, 1990 5



cc(1) cc(1)
support /lib/crt2.o run-time startoff used with crt1.o for shared library support /lib/crtn.o run-time startoff used with crt1.o and crt2.o for shared library support /lib/mcrt0.o run-time startoff for profiling SEE ALSO as(1), dis(1), ld(1), setcompat(2). The C Programming Language by B. W. Kernighan and D. M. Ritchie, (New Jersey, Prentice-Hall: 1978); ``cc Command Syntax'' in A/UX Programming Languages and Tools, Volume 1; ``A/UX POSIX Environment,'' in A/UX Programming Languages and Tools, Volume 1. DIAGNOSTICS The diagnostics produced by the C compiler are sometimes cryptic. Occasional messages may be produced by the assem- bler or link editor. WARNINGS By default, the return value from a C program is completely random. The only two guaranteed ways to return a specific value are to call exit explicitly (see exit(2)) or to leave the function main() with a return(expression) statement. NOTES This version of cc is based on the cc released with the Motorola SGS and has been changed in the following ways: ⊕ The -Z flag option has been added to explicitly con- trol generation of stack-growth code for cross- development environments or generation of stand- alone code. The Motorola SGS looks for an environ- ment variable called M68000 and generates stack- growth code if the variable is set to STACKCHECK. This cc defaults to no stack-growth code on the Ma- cintosh II(Reg.) 68020 and 68030 processors. ⊕ The default is to produce shared text programs. To produce nonshared text programs, you must run ld with the -N flag option. ⊕ When cc is used with the -g flag option, the argu- ments -u _dbargs -lg are inserted in the command line for the link phase. This causes the contents of libg.a to be linked in. Note that the Motorola SGS only generates the loader argument -lg, which is not sufficient to cause loading of the library's contents. ⊕ The -v (verbose) flag option has been added to print the command line for each subprocess executed. This helps to isolate problems to a specific phase of the compilation process by showing exactly what cc is doing, so that each phase can be run by hand, if 6 April, 1990



cc(1) cc(1)
necessary. ⊕ The Motorola SGS compiler expects functions that re- turn pointers or structures to return their values in a0 and expects other functions to return their values in d0/d1. Because of the large body of ex- isting code that has inconsistent type declarations. This version of the compiler emits code to return pointers in both a0 and d0 by copying a0 to d0 just prior to returning. This copy operation can be suppressed with the -Zc flag option, thus generating slightly smaller code. April, 1990 7

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026