Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ acc(1) — SPARCworks 2.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1)

as(1)

cflow(1)

ctags(1)

cxref(1)

dbx(1)

gprof(1)

inline(1)

ld(1)

lint(1)

m4(1)

make(1S)

prof(1)

tcov(1)

acc(1)  —  USER COMMANDS

NAME

acc − C compiler

SYNOPSIS

acc [ −a ] [ −Bbinding ] [ −bsdmalloc ] [ −C ] [ −c ] [ −cg87 ] [ −cg89 ] [ −cg92 ] [ −dalign ]

[ −Dname [=def ] ] [ −dryrun ] [ −E ] [ −fast ] [ −fnonstd ] [ −fsingle ] [ −g ] [ −H ]

[ −help ] [ −Ipathname ] [ −keeptmp ] [ −Ldirectory ]

[ −llibrary ] [ −libmieee ] [ −libmil ] [ −M ] [ −misalign ] [ −native ] [ −nolib ]

[ −nolibmil ] [ −noqueue ] [ −O[ level] ] [ −o outputfile ] [ −P ] [ −p ] [ −pg ]

[ −PIC ] [ −pic ] [ −Qdir or −qdir directory ] [ −Qoption or −qoption prog opt ]

[ −Qpath or −qpath pathname ] [ −Qproduce or −qproduce sourcetype ]

[ −R ] [ −S ] [ −s ] [ −sb ] [ −sbfast ] [ −strconst ] [ −sys5 ] [ −temp=directory ]

[ −time ] [ −Uname ] [ −unroll =n ] [ −V ] [ −v ] [ −vc ] [ −w ] [ −X [a |c |s |t ]]

[ −xlicinfo ]

DESCRIPTION

For a comparison of cc options in Sun C (SunOS 4.x), Sun ANSI C (SunOS 4.x) and ANSI C (SunOS/SVR4), see the ANSI C Transition Guide.

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. 

−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.  Since this option entails some optimization, it is incompatible with −g. 

−Bbinding binding can be either dynamic or static.  −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 Faster malloc for SunOS 4.1.2 or 4.1.3 only; not available for SunOS 4.1.1.  Uses 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. 

−cg87 Generate code for any Sun-4.  It does not exploit features such as the fsqrts and fsqrtd instructions that are not implemented in hardware on all Sun-4 workstations. 

−cg89 Generate code for any newer Sun-4 that has features like hardware fsqrts and fsqrtd instructions.  Code compiled with −cg89 should not be executed on Sun-4/1xx and 4/2xx systems with Weitek 1164/5 floating-point hardware. 

−cg92 Generates code for machines implementing SPARC V8 (such as the SPARCstation-10 series); in particular, the following instructions may be generated in-line: smul, smulcc, sdiv, sdivcc, umul, umulcc, udiv, udivcc, and fsmuld.  In addition, the built-in assembler pass will perform TI,TMS390Z5x-specific instruction scheduling automatically.  Code compiled with −cg92 will run, but possibly much more slowly on pre-SPARC V8 machines; as such the practice is strongly discouraged. 

−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. 

−Dname [=tokens] Associates name with the specified tokens as if by a #define preprocessing directive.  If no =tokens is specified, the token 1 is supplied. 

Predefinitions:sparc
sun
unix

The above are not predefined in −Xc mode. 

−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 (−cg89), the optimization level −02, 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 −02 , the optimization part of −fast -01 is −01 . 

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. 

−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). 

−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. 

−Ipathname Add pathname 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. 

−keeptmp Retains files created during compilation, rather than automatically deleting them. 

−Ldirectory Add directory to the list of directories containing object-library routines (for linking using ld(1). 

−llibrary Link with object library library (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. 

−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. 

For SunOS 4.x there are three code-generation options for this release of C: −cg87 , −cg89 , and −cg92 . 

−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 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). 

−O[level] Optimize the object code.  May be used with −g; ignored when −a is used.  −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 optimize references or definitions for external or indirect variables.  In general, the −O2 level results in minimum code size. 

3 Beside what −O2 does, this also optimizes references and definitions for external variables.  The −O3 level does not trace the effects of pointer assignments.  Do not use −O3 when compiling either device drivers, or programs that modify external variables from within signal handlers.  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.  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.  You can prevent this in the C-shell by limiting the amount of virtual memory available to a single process.  To do this, use the limit command (see csh(1)). 

−P Run the source file through acpp(1), the C preprocessor, 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 Like −pic, 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 −pic. 

−pic 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. 

−Qdir or −qdir directory
Look for compiler components in directory X . 

−Qoption or −qoption prog opt
Pass the option opt to the program prog. The option must be appropriate to that program and may begin with a minus sign. prog can be one of: acomp, as, cg, inline, iropt, or ld. 

−Qpath or −qpath pathname
Insert  directory pathname into the compilation search path.  pathname will be searched for alternate 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 or −qproduce sourcetype
Produce source code of the type sourcetype. sourcetype can be one of:

.c C source (from bb_count). 

.i Preprocessed C source from acpp(1). 

.o Object file from as(1). 

.s Assembler source (from acomp, inline(1) or c2). 

−R Directs acc to merge the data segment with the text segment for as(1).  Data initialized in the object file produced by this compilation is read-only and (unless linked with ld-N) is shared between processes.  This option is ignored when −g is used. 

−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 Adds the System V header files and libraries to the compiler directory search paths. 

−temp=directory
Set directory for temporary files to be directory.

−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 reject programs that use non-ANSI C constructs.

s (Sun C)
The compiled language includes all features compatible with (pre-ANSI) Sun C.  The compiler warns about all language constructs that have differing behavior between Sun ANSI C and the old Sun C.

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. 

−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. 

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(1) expansion file

file.o object file

file.s assembler source file

file.S assembler source for preprocessor

file.tcov output from tcov(1)

/usr/lang/SC2.0.1/acc compiler command line driver

/usr/lang/SC2.0.1/acomp compiler

/usr/lang/SC2.0.1/as assembler

/usr/lang/SC2.0.1/bb_link.o basic block counting routine

/usr/lang/SC2.0.1/cg code generator

/usr/lang/SC2.0.1/cpp preprocessor ( −Xs mode only)

/usr/lang/SC2.0.1/crt0.o runtime startup code

/usr/lang/SC2.0.1/gcrt1.o startup for profiling with gprof(1)

/usr/lang/SC2.0.1/inline program that accomplishes inlining for libm.il

/usr/lang/SC2.0.1/iropt global optimzer

/usr/lang/SC2.0.1/libl.a lex library

/usr/lang/SC2.0.1/libm.a math library

/usr/lang/SC2.0.1/libp/libm_p.a
profiled libm

/usr/lang/SC2.0.1/liby.a yacc library

/usr/lang/SC2.0.1/mcrt1.o start-up for profiling with prof(1) and intro(3)

/usr/lang/SC2.0.1/pcrt1.o

SEE ALSO

ar(1), as(1), cflow(1), ctags(1), cxref(1), dbx(1), gprof(1), inline(1), ld(1), lint(1), m4(1), make(1S), prof(1), tcov(1)

SPARCompilers C 2.0.1 Programmer’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 SPARCompilers C 2.0 Programmer’s Guide manual.  Occasional obscure messages may be produced by the preprocessor, assembler, or loader. 

Sun Release 4.1  —  Last change: 29 July 1992

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