Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cc(1) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

as(1)

dis(1)

ld(1)

setcompat(2)

cc(1)




cc(1) cc(1)
NAME cc - invokes the C compiler SYNOPSIS cc [-A factor] [-a] [-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] [-y] [-Zflags] [-68030] [-68040] [-68851] [-#]... file... ARGUMENTS -# Echoes the names and arguments of subprocesses that would have started, without actually starting the program. This is a special debug option. -A factor Expands the default symbol table allocations for the compiler, assembler, and link editor. The default allocation is multiplied by the factor given. -a Includes source code as comments in the assembly file generated with the -S option. -B string Constructs pathnames for substitute preprocessor, compiler, assembler, and link-editor passes by concatenating string with the suffixes cpp, comp, optim, 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 You should have 4 MB or more of main memory in order to use the big versions of these programs safely. -c Suppresses the link-editing phase of the compilation and forces an object file to be produced even if only one program is compiled. -C Passes along all comments except those found on cpp(1) directive lines. The default strips out all comments. -Dsymbol[=def] Defines the external symbol to the preprocessor and gives it the value def (if specified). If no def is January 1992 1



cc(1) cc(1)
given, symbol is defined as 1. This mechanism is useful for conditional compilation using preprocessor control lines. -E Runs only cpp(1) on the named C programs and sends the result to the standard output. file Specifies the file that is to be compiled. -fm68881 Generates inline code for the MC68881 floating-point coprocessor. This is the default. -F Does not generate inline code for the MC68881 floating-point coprocessor. -g Generates additional information needed for the use of sdb(1). -Idir Searches 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 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 Searches the library libx.a, where x is up to 7 characters long. A library is searched when its name is encountered, so the placement 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. Same as -l in ld(1). -L dir Changes the algorithm of searching for libx.a to look in dir before looking in LIBDIR. This option is effective only if it precedes the -l option on the command line. Same as -L in ld(1). -n Arranges 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 Produces an output object file, outfile. The default name of the object file is a.out. Same as -o in ld(1). -O Invokes an object-code optimizer. The optimizer moves, 2 January 1992



cc(1) cc(1)
merges, and deletes code, so symbolic debugging with line numbers could be confusing when the optimizer is used. For this reason, use of the -g option disables the -O option. This option may not work properly on code containing asm directives. -p Arranges 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 Runs only cpp(1) on the named C programs and leaves the result on corresponding files suffixed .i. -R Causes the assembler to remove its input file when finished. -s Strips the line-number entries and symbol-table information from the output of the object file. Same as -s in ld(1). -S Compiles, but does not assemble, the named C programs and leaves the assembly-language output on corresponding files suffixed .s. -t [p012al] Finds only the designated preprocessor passes whose names are constructed with the string argument of the -B 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 the -t option with no argument is equivalent to -tp012. -T Truncates symbol names to 8 significant characters. 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 Undefines symbol to the preprocessor. -v Prints the command line for each subprocess executed. -W c,arg1[,arg2] Hands 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, January 1992 3



cc(1) cc(1)
respectively. For example: -Wa,-m invokes the m4 macro preprocessor on the input to the assembler. (The -m 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. -y Suppresses searching of /usr/include for header files and instead searches only in directories specified by the -I option. -Zflags Specifies special flags to override the default behavior (see NOTES in this section). Currently recognized flags are: c Return pointers in a0 without copying to d0. n Emits no code for stack-growth. This is the default. m Uses Motorola SGS-compatible stack growth code. p Uses tst.b stack probes. E Ignores all environment variables. I Emits inline code for the MC68881 floating-point coprocessor. This is the default. l Suppresses selection of a loader command file. t Does not delete temporary files. S Compiles to be SVID-compatible. Links the program with a library module that calls setcompat(2) with the COMPAT_SVID flag set. Defines only the SYSV_SOURCE feature test macro. P Compiles for the POSIX environment. Links the program with a library module that calls setcompat(2) with the COMPAT_POSIX flag set. Defines only the POSIX_SOURCE feature test macro. B Compiles to be BSD-compatible. Links the program with a library module that calls setcompat(2) with the COMPAT_BSD flag set. Defines only the 4 January 1992



cc(1) cc(1)
BSD_SOURCE feature test macro. -68030 Directs the assembler to recognize the memory management unit (MMU) instructions for a Motorola 68030 processor. -68040 Directs the assembler to recognize the instructions for a Motorola 68040 processor. -68851 Directs the assembler to recognize the coprocessor instructions for a Motorola 68851 PMMU. This is the default. 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. Other arguments are taken to be link-editor flag-option arguments, C-compatible object programs (typically produced by an earlier run of cc), or libraries of C-compatible routines. 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 option of the link editor is used. 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. STATUS MESSAGES AND VALUES The status messages produced by the C compiler are sometimes cryptic. Occasional messages may be produced by the assembler or link editor. January 1992 5



cc(1) cc(1)
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 option has been added to explicitly control generation of stack-growth code for cross- development environments or generation of stand- alone code. The Motorola SGS looks for an environment 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 Macintosh 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 option. ⊕ When cc is used with the -g option, the arguments -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) 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 necessary. ⊕ The Motorola SGS compiler expects functions that return 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 existing 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 option, thus generating slightly smaller code. FILES /usr/bin/cc Executable file file.c Input file file.o Object file file.s 6 January 1992



cc(1) cc(1)
Assembly language file a.out Link-edited output file /usr/tmp/mc68? Temporary file /lib/cpp Preprocessor file /lib/comp Compiler file /lib/optim Optimizer file /bin/as File containing the assembler /bin/ld File containing the link editor /lib/libc.a Standard library file /lib/libposix.a POSIX library file /lib/libbsd.a BSD library file /lib/libsvid.a SVID library file /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 file /lib/crt1.o Run-time startoff file with shared library support /lib/crt2.o Run-time startoff file used with crt1.o for shared library support /lib/crtn.o Run-time startoff file used with crt1.o and crt2.o for shared library support /lib/mcrt0.o Run-time startoff file for profiling SEE ALSO as(1), dis(1), ld(1) setcompat(2) in A/UX Programmer's Reference January 1992 7



cc(1) cc(1)
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 8 January 1992

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