acc(1) — USER COMMANDS
NAME
acc − C compiler
SYNOPSIS
acc [ −Aname [(tokens) ] ] [ −a ] [ −align ] [ −assert ] [ −B [static|dynamic] ]
[ −C ] [ −c ] [ −cg89 ] [ −cg92 ] [ −Dname [=token ] ]
[ −dalign ] [ −dryrun ] [ −E ] [ −fast ] [ −fd ] [ −flags ]
[ −fnonstd ] [ −fpromote ] [ −fsimple ]
[ −fsingle ] [ −g ] [ −H ] [ −help ] [ −Idir ]
[ −inline=[f1,...,fn] ] [ −KPIC ] [ −Kpic ] [ −keeptmp ] [ −Ldir ]
[ −lname ] [ −libmieee ] [ −libmil ] [ −M ] [ −misalign ] [ −misalign2 ]
[ −native ] [ −nocx ] [ −nolib ] [ −nolibmil ] [ −noqueue ]
[ −O[ 1,2,3,4] ] [ −o outputfile ] [ −P ] [ −p ] [ −pg ] [ −PIC ] [ −pic ]
[ −Qdir dir ] [ −Qoption c arg ] [ −Qpath dir ] [ −Qproduce srctype ]
[ −qdir dir ] [ −qoption c arg ] [ −qpath dir ] [ −qproduce srctype ]
[ −R ] [ −S ] [ −s ] [ −sb ] [ −sbfast ] [ −strconst ]
[ −sys5 ] [ −temp=dir ] [ −time ] [ −Uname ] [ −unroll =n ] [ −V ]
[ −v ] [ −vc ] [ −w ] [ −X [a |c |s |t ]] [ −xa ] [ −xCC ] [ −xcg89 ]
[ −xcg92 ] [ −xe ] [ −xinline=[f1,...,fn] ] [ −xlibmieee ]
[ −xlibmil ] [ −xlicinfo ] [ −xM ] [ −xM1 ] [ −xnolib ]
[ −xnolibmil ] [ −xO[ 1,2,3,4] ] [ −xP ] [ −xpg ] [ −xsb ]
[ −xsbfast ] [ −xstrconst ] [ −xtime ] [ −xunroll=n ]
DESCRIPTION
For a comparison of cc options in Sun C (Solaris 1.x), Sun ANSI C (Solaris 1.x) and ANSI C (SunOS/SVR4), see the C 3.0.1 Transition Guide for SPARC Systems.
acc is the C compiler. It translates programs written in the C programming language into executable load modules, or into relocatable binary programs for subsequent loading with the ld(1) link editor.
In addition to the many options, acc accepts several types of filename arguments. For instance, files with names ending in .c are taken to be C source programs. They are compiled, and each resulting object program is placed in the current directory. The object file is named after its source file — the suffix .o replacing .c in the name of the object. In the same way, files whose names end with .s are taken to be assembly source programs. They are assembled, and produce .o files. Filenames ending in .il are taken to be inline expansion code template files; these are used to expand calls to selected routines in-line when code optimization is enabled. See FILES, below for a complete list of compiler-related filename suffixes.
Other arguments refer to assembler or loader options, object programs, or object libraries. Unless −c, −S, −E −P or −Qproduce is specified, these programs and libraries, together with the results of any specified compilations or assemblies, are linked (in the order given) to produce an output file named a.out. You can specify a name for the executable by using the −o option.
If a single file is compiled and linked all at once, the intermediate files are deleted.
OPTIONS
When debugging or profiling objects are compiled using the −g or −pg options, respectively, the ld command for linking them should also contain the appropriate option.
See ld(1) for link-time options.
−Aname[(tokens)]
Associate name as a predicate with the specified tokens as if by a #assert preprocessing directive.
Preassertions:system(unix)
cpu(sparc)
machine(sparc)
The above are not predefined in −Xc mode.
If −A is followed by a dash (-) only, it causes all predefined macros (other than those that begin with __) and predefined assertions to be forgotten.
−a Insert code to count how many times each basic block is executed. Invokes a run-time recording mechanism that creates a .d file for every .c file (at normal termination). The .d file accumulates execution data for the corresponding source file. The tcov(1) utility can then be run on the source file to generate statistics about the program. This option is incompatible with −g.
−align sym Passed to the linker to force the global uninitialized sym to be page aligned.
−assert keyword
Passed to the linker to check an assertion about the link editing being performed.
−B [static|dynamic]
−B dynamic causes the link editor to look for files named libx.so and then for files named libx.a when given the −lx option. −B static causes the link editor to look only for files named libx.a. This option may be specified multiple times on the command line as a toggle. This option and its argument are passed to ld.
−bsdmalloc Specifies faster malloc. Use the more efficient malloc from the the library libbsdmalloc.a. This option also causes the flags
−u _malloc /lib/libbsdmalloc.a
to be passed to the linker.
−C Cause the preprocessor to pass along all comments other than those on preprocessing directive lines.
−c Suppress linking with ld(1) and produce a .o file for each source file. A single object file can be named explicitly using the −o option.
−cg89 Generate code to run on the SPARC architecture. This is the default option. Use a subset of the SPARC V8 instruction set. With -cg89 and optimization, the instructions are scheduled for faster executables on a generic SPARC machine. Code compiled with -cg89 does run on -cg92 hardware.
−cg92 Generate code to run on SPARC V8 architecture. Allow the use of the full SPARC V8 instruction set. In particular, allow the following instructions to be generated in-line: smul, smulcc, sdiv, sdivcc, umul, umulcc, udiv, udivcc, and fsmuld. With -cg92 and optimization, the instructions are scheduled for faster executables on a SuperSPARC machine. Code compiled with -cg92 does run on older machines, but it may run slowly, as the new instructions added to SPARC V8 are emulated by traps to the operating system.
−Dname[=token]
Associates name with the specified token as if by a #define preprocessing directive. If no =token is specified, the token 1 is supplied.
Predefinitions:sparc
sun
unix
The above are not predefined in −Xc mode.
These predefinitions are valid in all modes:
__sparc,
__unix,
__sun,
__BUILTIN_VA_ARG_INCR
__SUNPRO_C=0x301
−dalign Generate double load/store instructions whenever possible for improved performance. Assumes that all double typed data are double aligned, and should not be used when correct alignment is not assured.
−dryrun Show but do not execute the commands constructed by the compilation driver.
−E Preprocess only the named C files and send the result to the standard output. The output will contain preprocessing directives for use by the next pass of the compilation system.
−fast Select the optimum combination of compilation options for speed. This should provide close to the maximum performance for most realistic applications. Modules compiled with −fast , must also be linked with −fast .
It is a convenience option, and it chooses the fastest code generation option available on the compile-time hardware, the optimization level −O2, a set of inline expansion templates, the −fnonstd floating-point option, and the −dalign option.
If you combine −fast with other options, the last specification applies. The code generation option, the optimization level and using inline template files can be overridden by subsequent switches. For example, although the optimization part of −fast is −O2 , the optimization part of −fast -O1 is −O1 .
Do not use this option for programs that depend on IEEE standard exception handling; you can get different numerical results, premature program termination, or unexpected SIGFPE signals.
−fd Report old-style function definitions and declarations.
−flags Print a summary of each compiler option.
−fnonstd This option causes non-standard initialization of floating-point arithmetic hardware. By default, IEEE 754 floating-point arithmetic is nonstop and underflows are gradual The −fnonstd option causes hardware traps to be enabled for floating-point overflow, division by zero, and invalid operation exceptions. These are converted into SIGFPE signals, and if the program has no SIGFPE handler, it will terminate with a memory dump. See ieee_handler(3M).
−fpromote Nonprototyped functions returning float are promoted to double. Normally, nonprototyped functions returning float always return float.
−fsimple Simple floating-point model. Allow optimization using mathematically equivalent expressions. The optimizer is allowed to act as if a simple floating-point model holds during compilation and runtime. It is allowed to optimize without regard to roundoff or numerical exceptions. That is, the optimizer can assume the following:
o The IEEE 754 default rounding and trapping modes hold.
o No exceptions arise other than inexact.
o The program does not test for inexact exceptions.
o There are no infinities or NaNs.
o The program does not depend on distinguishing by the sign of zero.
−fsingle ( −Xt and −Xs modes only). Causes the compiler to evaluate float expressions as single precision rather than double precision. (This option has no effect if the compiler is used in either −Xa or −Xc modes, as float expressions are already evaluated as single precision.)
−g Produce additional symbol table information for dbx(1). This option no longer overrides −O .
−H Print, one per line, the path name of each file included during the current compilation on the standard error output.
−help Display a one-line summary of compiler options.
−Idir Add dir to the list of directories in which to search for #include files with relative filenames (not beginning with slash /). The preprocessor first searches for #include files in the directory containing sourcefile, then in directories named with −I options (if any), and finally, in /usr/include.
−inline=[f1,...,fn]
For user-written routines, try to inline only those named in the list f1 to fn. It tries routines only in the file being compiled. The list is a comma-separated list of functions and subroutines.
If compiling with −O3, this can increase optimization by inlining some routines. The −O3 option inlines none by itself.
If compiling with −O4, this can decrease optimization by restricting inlining to only those routines in the list. With −O4, iropt normally tries to inline all user-written subroutines and functions. When xinline= is specified with an empty rlist, it indicates that none of the routines in the source file are to be inlined.
A routine is not inlined if any of the following apply (no warning):
o Optimization is less than -O3
o The routine cannot be found
o Inlining the routine does not look profitable or safe to iropt
o The source for the routine is not in the file being compiled
−KPIC Like −Kpic, but allows the global offset table to span the range of 32-bit addresses in those rare cases where there are too many global data objects for −Kpic.
−Kpic Produce position-independent code. Each reference to a global datum is generated as a dereference of a pointer in the global offset table. Each function call is generated in pc-relative addressing mode through a procedure linkage table. The size of the global offset table is 8K on SPARC processors.
−keeptmp Retains files created during compilation, rather than automatically deleting them.
−Ldir Add dir to the list of directories containing object-library routines (for linking using ld(1).
−lname Link with object library name (for ld(1)). This option must follow the sourcefile arguments.
−libmieee Force IEEE 754 style return values for math routines in exceptional cases. In such cases, no exeception message will be printed, and errno will not be set.
−libmil Select the best inline templates for the floating-point option and SunOS release available on this system.
−M Run only the macro preprocessor (cpp) on the named C programs, requesting that it generate makefile dependencies and send the result to the standard output (see make(1) for details about makefiles and dependencies).
−misalign Generate code to allow loading and storage of misaligned data.
−misalign2 Like -misalign, but assume data is half-word aligned.
−native Best native floating point. Decide which floating-point options are available on the machine the compiler is running on, and generate code for the best one.
−nocx Makes the output executable file about 128K bytes smaller by not linking with −lcx. However, the run-time performance and accuracy of binary-decimal base-conversion will be somewhat compromised. This option also disables the recognition of the long long data type during compilation, and it passes −D_NO_LONGLONG to the preprocessor.
If one or more of the object files were compiled without −nocx and if they contain the use of the long long data type, then −nocx may not be passed to the compiler at link-time.
−nolib Does not link any libraries by default; that is, no −l options are passed to ld . Normally, the acc driver passes −lm −lansi −lc to ld .
When you use −nolib , you have to pass all −l options yourself. For example:
acc test.c −nolib −lansi −Bstatic −lm −Bdynamic −lc
links libm statically and the other libraries dynamically.
−nolibmil Reset −fast so that it does not include inline templates. Use this after the −fast option: cc –fast –nolibmil ...
−noqueue Tells the compiler not to queue this compile request if a license is not available.
−O[1,2,3,4] Optimize the object code. May be used with −g. −O with the level omitted is equivalent to −O2. level is one of:
1 Do only the minimum amount of optimization (peephole). This is postpass assembly-level optimization.
2 Do basic local and global optimization. This is induction variable elimination, local and global common subexpression elimination, algebraic simplification, copy propagation, constant propagation, loop-invariant optimization, register allocation, basic block merging, tail recursion elimination, dead code elimination, tail call elimination and complex expression expansion.
The −O2 level does not assign global, external, or indirect references to registers. It treats these references and definitions as if they were declared "volatile." In general, the −O2 level results in minimum code size.
3 Beside what −O2 does, this also optimizes references and definitions for external variables. Loop unrolling and software pipelining are also performed. The −O3 level does not trace the effects of pointer assignments. When compiling either device drivers, or programs that modify external variables from within signal handlers, you may need to use the volatile type qualifier to protect the object from optimization. In general, the −O3 level results in increased code size.
4 Besides what −O3 does, this also does automatic inlining of functions contained in the same file; this usually improves execution speed. The −O4 level does trace the effects of pointer assignments. In general, the −O4 level results in increased code size.
If the optimizer runs out of memory, it tries to recover by retrying the current procedure at a lower level of optimization and resumes subsequent procedures at the original level specified in the command-line option.
If you optimize at −O3 or −O4 with very large procedures (thousands of lines of code in a single procedure), the optimizer may require an unreasonable amount of memory. In such cases, performance of the machine may degraded.
−o outputfile Name the output file outputfile. outputfile must have the appropriate suffix for the type of file to be produced by the compilation (see FILES, below). outputfile cannot be the same as sourcefile (the compiler will not overwrite the source file).
−P Preprocess only. Puts the output in a file with a .i suffix. The output will not contain any preprocessor line directives, unlike the −E option.
−p Prepare the object code to collect data for profiling with prof(1). Invokes a run-time recording mechanism that produces a mon.out file (at normal termination).
−pg Prepare the object code to collect data for profiling with gprof(1). Invokes a run-time recording mechanism that produces a gmon.out file (at normal termination).
−PIC Same as -KPIC.
−pic Same as -Kpic.
−Qdir dir Look for compiler components in directory dir.
−Qoption c arg
Pass the option arg to the component c. The option must be appropriate to that component and may begin with a minus sign. c can be one of: acomp, fbe (Solaris 2.x only) or as (Solaris 1.x only) cg, iropt, or ld.
−Qpath dir
Insert directory dir into the compilation search path. The path will be searched for alternate versions of the compilation programs, such as acomp(1), and ld(1). This path will also be searched first for certain relocatable object files that are implicitly referenced by the compiler driver, for example ∗crt∗.o and bb_link.o.
−Qproduce srctype
Produce source code of the type sourcetype. sourcetype can be one of:
.i Preprocessed C source.
.o Object file.
.s Assembler source.
−qdir dir Same as −Qdir dir.
−qoption c arg
Same as −Qoption c arg.
−qpath dir Same as −Qpath dir.
−qproduce srctype
Same as −Qproduce srctype.
−R Directs acc to merge the data segment with the text segment for assembler. Data initialized in the object file produced by this compilation is read-only and (unless linked with ld-N) is shared between processes.
−S Do not assemble the program but produce an assembly source file.
−s Remove all symbolic debugging information from the output object file. Passed to ld(1).
−sb Generate extra symbol table information for the Sun Source Code Browser.
−sbfast Create the database for the Sun Source Code Browser, but do not actually compile.
−strconst Inserts string literals into the text segment instead of the data segment.
−sys5 Set driver to Sys5 version. Predefine __SYS5__. Also search for include files in /usr/5include before /usr/include. Link in /usr/5lib libraries before /usr/lib.
−temp=dir Set directory for temporary files to be dir.
−time Report execution times for the various compilation passes.
−Uname Cause any definition of name to be undefined, as if by a #undef preprocessing directive. If the same name is specified for both −D and −U, name is not defined, regardless of the order of the options.
−unroll=n Specifies whether or not the compiler optimizes (unrolls) loops. n is a positive integer. When n is 1, it is a command and the compiler unrolls no loops. When n is greater than 1, the −unroll=n merely suggests to the compiler that unrolled loops be unrolled n times.
−V Print the name and version ID of each pass as the compiler executes.
−v Verbose. Print the version number of the compiler and the name of each program it executes.
−vc Directs the compiler to perform stricter semantic checks and enable other lint-like checks.
−w Do not print warnings.
−X[a|c|s|t] Specify the degree of conformance to the ANSI C standard. The degree of conformance can be one of the following:
a (ANSI)
ANSI C plus Sun C compatibility extensions, with semantic changes required by ANSI C. Where Sun C and ANSI C specify different semantics for the same construct, the compiler will issue warnings about the conflict and use the ANSI C interpretation.
c (conformance)
Maximally conformant ANSI C, without Sun C compatibility extensions. The compiler will issue errors and warnings for programs that use non-ANSI C constructs.
s (Sun C)
The compiled language includes all features compatible with (pre-ANSI) Sun C. The compiler tries to warn about all language constructs that have differing behavior between Sun ANSI C and the old Sun C. Invokes cpp for processing. __STDC__ is not defined in this mode.
t (transition)
ANSI C plus Sun C compatibility extensions, without semantic changes required by ANSI C. Where Sun C and ANSI C specify different semantics for the same construct, the compiler will issue warnings about the conflict and use the Sun C interpretation. This is the default mode.
The predefined macro __STDC__ has the value 0 for −Xt and −Xa, and 1 for −Xc. (It is not defined for −Xs.) All warning messages about differing behavior can be eliminated through appropriate coding; for example, use of casts can eliminate the integral promotion change warnings.
−xa Same as −a.
−xCC Accept C++-style comments.
−xcg89 Same as −cg89.
−xcg92 Same as −cg92.
−xe Performs only syntax and semantic checking on the source files, but does not produce any object or executable code.
−xinline=[f1,...,fn]
Same as −inline.
−xlibmieee Same as −libmieee.
−xlibmil Same as −libmil.
−xlicinfo Returns information about the licensing system. In particular, it returns the name of the license server and the userids of users who have licenses checked out. When you use this option, the compiler is not invoked and a license is not checked out.
−xM Generate makefile dependencies.
−xM1 Generate makefile dependencies.
−xnolib Same as −nolib.
−xnolibmil Same as −nolibmil.
−xO[1,2,3,4]
Same as −O[1,2,3,4].
−xP Print prototypes for function definitions.
−xpg Same as −pg.
−xsb Same as −sb.
−xsbfast Same as −sbfast.
−xstrconst Same as −strconst.
−xtime Same as −time.
−xunroll=n Same as −unroll.
acc recognizes -d, -N, -n, -r, -T, -Tdata, -Ttext, -t, -u, -X, -x, -yX, and -z, and passes these options and their arguments to ld. acc also passes any unrecognized options to ld with a warning.
FILES
a.out executable output file
file.a library of object files
file.c C source file
file.d tcov(1) test coverage input file
file.i C source file after preprocessing
file.il inline expansion file
file.o object file
file.s assembler source file
file.tcov output from tcov(1)
acc compiler command line driver
acomp compiler front end
cg code generator
crt1.o runtime startup code
crti.o runtime startup code
crtn.o runtime startup code
as assembler
gcrt1.o startup for profiling with gprof(1)
gmon.out default profile file for -pg
iropt global optimzer
mcrt1.o start-up for profiling with prof(1) and intro(3)
mon.out default profile file for -p
.sb The directory used to store sbrowser(1) data when the −xsb or −xsbfast flag is used.
.sbinit A file containing commands which can be used to specify the location of the .sb directory and to control the execution of sbcleanup
sbcleanup deletes obsolete files in the .sb directory and creates an up-to-date .sb/Index file
SEE ALSO
ar(1), as(1), cflow(1), ctags(1), cxref(1), dbx(1), gprof(1), ld(1), lint(1), m4(1), make(1S), prof(1), tcov(1)
C 3.0.1 User’s Guide
B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall, 1978
DIAGNOSTICS
The diagnostics produced by the C compiler are intended to be self-explanatory. If you need further explanation, see the C 3.0.1 User’s Guide manual. Occasional obscure messages may be produced by the preprocessor, assembler, or loader.
Sun Release 4.1 — Last change: 30 June 1994