ACC(1) — USER COMMANDS
NAME
acc − ANSI C compiler
SYNOPSIS
acc [ −a ] [ −align _block ] [ −Bbinding ] [ −c ] [ −C ] [ −cg87 ] [ −cg89 ] [ −dryrun ]
[ −Dname [=def ] ] [ −E ] [ −f float_option ] [ −fast ] [ −fnonstd ] [ −g ]
[ −help ] [ −Ipathname ] [ −Ldirectory ] [ −libmil ] [ −M ] [ −native ] [ −nolibmil ]
[ −o outputfile ] [ −O[ level] ] [ −p ] [ −P ] [ −pg ] [ −pic ]
[ −Qdir or −qdir directory ] [ −Qoption or −qoption prog opt ][ −Qpath or −qpath pathname ]
[ −Qproduce or −qproduce sourcetype ] [ −R ] [ −S ] [ −sb ] [ −strconst ] [ −temp=directory ]
[ −time ] [ −Uname ] [ −V ] [ −v ] [ −vc ] [ −w ] [ −Xact ] sourcefile ... [ −llibrary ]
DESCRIPTION
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.
Before you use the acc command, insert /usr/lang (or the name of the directory in which you have chosen to install the C compiler) at the beginning of your search path. This is usually done in the .cshrc file, in a line with set PATH = at the start.
Before you use the man command for acc man pages, insert /usr/lang (or the name of the directory in which you have chosen to install the C compiler) at the beginning of your man path. This is usually done in the .cshrc file, in a line with set MANPATH = at the start.
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.
−align Force the global uninitialized data symbol block to be page-aligned by increasing its size to a whole number of pages, and placing its first byte at the beginning of a page.
−Bbinding Specify whether bindings of libraries for linking are static or dynamic, indicating whether libraries are non-shared or shared, respectively.
−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.
−C Prevent the C preprocessor, cpp(1), from removing comments.
−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.
-cg89 and -cg89 are mutually exclusive. This consistency may be enforced at run time.
−dalign Not supported in Sun ANSI C.
−dryrun Show but do not execute the commands constructed by the compilation driver.
−Dname[=def]
Define a symbol name to the C preprocessor (cpp(1)). Equivalent to a #define directive in the source. If no def is given, name is defined as ‘1’.
−E Run the source file through the C preprocessor, only. Sends the output to the standard output, or to a file named with the −o option. Includes the cpp line numbering information. (See also, the −P option.)
−fast Select the optimum combination of compilation options for speed. This should provide close to the maximum performance for most realistic applications.
It is a convenience option, and it chooses the fastest code generation option available on the compile-time hardware ( −cg8x ), the optimization level −O2, a set of inline expansion templates, and the −fnonstd floating-point 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.
−fnonstd Cause 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).
−fsingleNot Supported in Sun ANSI C.
−g Produce additional symbol table information for dbx(1) and dbxtool(1). When this option is given, the −O and −R options are suppressed.
−help Display helpful information about acc.
−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.
−llibrary Link with object library library (for ld(1)). This option must follow the sourcefile arguments.
−Ldirectory Add directory to the list of directories containing object-library routines (for linking using ld(1).
−libmil Select the best inline templates for the floating-point option and SunOS release available on this system.
−M Run only the macro preprocessor 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).
−native This option directs the compiler to compile code targeted for the machine that is doing the compiling. For a Sun-4 that means cg87 or cg89.
−nolibmil Reset −fast so that it does not include inline templates. Use this after the −fast option:
acc –fast –nolibmil ...
−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. Ignored when either −g or −a is used. −O with the level omitted is equivalent to −O2. level is one of:
1 Do postpass assembly-level optimization only.
2 Do global optimization prior to code generation, including loop optimizations, common subexpression elimination, copy propagation, and automatic register allocation. −O2 does not optimize references to or definitions of external or indirect variables.
3 Not supported in Sun ANSI C.
4 Not supported in Sun ANSI C.
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.
−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).
−P Run the source file through the C preprocessor, only. Puts the output in a file with a .i suffix. Does not include cpp-type line number information in the output.
−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 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 limited to 64K on MC68000-family processors, or to 8K on SPARC processors.
−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.
−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: as, cpp, inline, or ld.
−Qpath or −qpath pathname
Insert directory pathname into the compilation search path. pathname will be searched for alternate compilation programs, such as cpp(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 cpp(1).
.o Object file from as(1).
.s Assembler source (from ccom, inline(1) or c2).
−R Merge data segment with 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. Ignored when either −g or −go is used.
−S Do not assemble the program but produce an assembly source file.
−sb Generate extra symbol table information for the Sun Source Code Browser.
−strconst Insert string literals into the text segment instead of the data segment.
−temp=directory
Set directory for temporary files to be directory.
−time Report execution times for the various compilation passes.
−Uname Remove any initial definition of the cpp(1) symbol name. (Inverse of the −D option.)
−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.
−Xact
−Xa provides ANSI conformance, but it will also provide warnings when there is a conflict in the old (K&R) C style and the ANSI Standard and default to the ANSI semantics.
−Xc provides strict ANSI conformance; the compiler will not allow non-ANSI constructs and issue an error in most cases.
−Xt provides a transition mode and is the default. It will provide warnings when there is a conflict with the old (K&R) C style and the ANSI Standard and default to the old (K&R) C style.
ENVIRONMENT
PATH The acc command requires that you insert /usr/lang (or the name of the directory in which you have chosen to install the C compiler) at the beginning of your search path. This is usually done in the .cshrc file, in a line with set PATH = at the start.
MANPATH To use the man command for acc man pages, insert /usr/lang (or the name of the directory in which you have chosen to install the C compiler) at the beginning of your man path. This is usually done in the .cshrc file, in a line with set MANPATH = at the start.
NOTE If you must use LD_LIBRARY_PATH , be sure to put the path /usr/lang/SC1.0 (or the name of the directory in which you have chosen to install the C compiler) at the start of that path list. It is safer to avoid this environment variable if you can.
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 with cpp(1)
file.il inline(1) expansion file
file.o object file
file.s assembler source file
file.S assembler source for cpp(1)
file.tcov output from tcov(1)
mon.out file produced for analysis by prof(1)
gmon.out file produced for analysis by gprof(1)
.sb subdirectory that holds the information generated by the −sb option
/usr/lang/SC1.0/README/c_docs
known C documentation bugs
/usr/lang/SC1.0/README/c_software
known C software bugs
/usr/lang/SC1.0/README/dbx_docs
known dbx(1) documentation bugs
/usr/lang/SC1.0/README/dbx_software
known dbx(1) software bugs
/usr/lang/SC1.0/README/sb_docs
known Sun SourceBrowser documentation bugs
/usr/lang/SC1.0/README/sb_software
known Sun SourceBrowser software bugs
/usr/lang/SC1.0/acc compiler command-line driver
/usr/lang/SC1.0/acomp compiler
/usr/lang/SC1.0/alint link to /usr/lang/SC1.0/ansi/alint
/usr/lang/SC1.0/ansi/lint ANSI C program verifier
/usr/lang/SC1.0/ansi/lint1 first pass of alint(1)
/usr/lang/SC1.0/ansi/lint2 second pass of alint(2)
/usr/lang/SC1.0/ansi/llib-lansi.ln
lint(1) library
/usr/lang/SC1.0/ansi/libansi.a
additional ANSI functionality
/usr/lang/SC1.0/ansi/libansi_p.a
profiled version of libansi.a
/usr/lang/SC1.0/ansi/yacc ANSI C compiler compiler
/usr/lang/SC1.0/ansi/yaccpar
parser prototype for ANSI C programs
/usr/lang/SC1.0/as assembler
/usr/lang/SC1.0/ayacc link to /usr/lang/SC1.0/ansi/yacc
/usr/lang/SC1.0/bb_link.o basic block counting routine
/usr/lang/SC1.0/cg code generator
/usr/lang/SC1.0/cpp macro processor
/usr/lang/SC1.0/crt0.o runtime startup code
/usr/lang/SC1.0/dbx symbolic debugger
/usr/lang/SC1.0/gcrt0.o startup for profiling with gprof(1)
/usr/lang/SC1.0/iropt global optimizer
/usr/lang/SC1.0/inline program that accomplishes inlining for libm.il
/usr/lang/SC1.0/libm.a math library
/usr/lang/SC1.0/libm.il math in-line library
/usr/lang/SC1.0/libm_p.a profiling library
/usr/lang/SC1.0/mcrt0.o start-up for profiling with prof(1) and intro(3)
/usr/lang/SC1.0/sbrowser window interface to SourceBrowser
/usr/lang/SC1.0/sbquery command line interface to SourceBrowser
/usr/lang/SC1.0/sun_source_browser.ex
internal data file used by sbrowser and sbquery
/usr/lang/SC1.0/version gives version name
/usr/lang/SC1.0/_crt1.o initializes FPU in standard IEEE mode; C runtime object file
/usr/lang/SC1.0/_nonstd_crt1.o
initializes FPU in non-IEEE mode; C runtime object file
/usr/lang/SC1.0/cg87/_crt1.o
initializes FPU in standard IEEE mode; C runtime object file
/usr/lang/SC1.0/cg87/nonstd_crt1.o
initializes FPU in non-IEEE mode; C runtime object file
/usr/lang/SC1.0/cg87/libm.a math library
/usr/lang/SC1.0/cg87/libm.il math library inline
/usr/lang/SC1.0/cg87/libm_p.a
profiled version of libm.a
/usr/lang/SC1.0/cg89/crt1.o initializes FPU in standard IEEE mode; C runtime object file
/usr/lang/SC1.0/cg89/nonstd_crt1.o
initializes FPU in non-IEEE mode; C runtime object file
/usr/lang/SC1.0/cg89/libm.a math library
/usr/lang/SC1.0/cg89/libm.il math library inline templates
/usr/lang/SC1.0/cg89/libm_p.a
profiled version of libm.a
SEE ALSO
adb(1), ar(1V), as(1), cflow(1V), cpp(1), ctags(1), cxref(1V), dbx(1), dbxtool(1), gprof(1), inline(1), ld(1), alint(1V), m4(1V), make(1), prof(1), tcov(1), intro(3), monitor(3)
Numerical Computation Guide
Programming Utilities and Libraries
B. W. Kernighan and D. M. Ritchie, The C Programming Language, (Second Edition) Prentice-Hall, 1988
DIAGNOSTICS
The diagnostics produced by the C compiler are intended to be self-explanatory. Occasional obscure messages may be produced by the preprocessor, assembler, or loader.
BUGS
The program context given in syntax error messages is taken from the input text after the C preprocessor has performed substitutions. Therefore, error messages involving syntax errors in or near macro references or manifest constants may be misleading.
Sun ANSI C — Last change: 22 January 1991