unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

CC(1V)                                                                  CC(1V)



NAME
       cc - C compiler

SYNOPSIS
       cc [ -a ] [ -align _block ] [ -Bbinding ] [ -c ] [ -C ]
            [ -dalign ] [ -dryrun ] [ -Dname [=def ] ] [ -E ]
            [ float_option ] [ -fsingle ] [ -g ] [ -go ] [ -help ]
            [ -Ipathname ] [ -J ] [ -Ldirectory ] [ -M ]
            [ -misalign ] [ -o outputfile ] [ -O[level] ]
            [ -p ] [ -P ] [ -pg ] [ -pic ] [ -PIC ] [ -pipe ]
            [ -Qoption prog opt ] [ -Qpath pathname ]
            [ -Qproduce sourcetype ] [ -R ] [ -S ] [ -sb ]
            [ -target target_arch ] [ -temp=directory ] [ -time ]
            [ -Uname ] [ -w ] sourcefile ...  [ -llibrary ]

SYSTEM V SYNOPSIS
       /usr/5bin/cc arguments

       /usr/xpg2bin/cc arguments

       Note:  arguments  to  /usr/5bin/cc and /usr/xpg2bin/cc are identical to
       those listed above.

AVAILABILITY
       The System V version of this command is available  with  the  System  V
       software  installation  option.   Refer  to  for  information on how to
       install optional software.

DESCRIPTION
       cc is the C compiler.  It translates programs written in the C program-
       ming  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, cc 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  pro-
       gram  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  speci-
       fied  compilations  or  assemblies,  are loaded (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 loaded all at once, the intermediate
       file is deleted.

       /usr/xpg2bin/cc is a shell script that should be used to compile X/Open
       compliant  applications.   /usr/5bin/cc  and /usr/xpg2bin/cc accept the
       same  arguments  and   options   as   cc.    /usr/xpg2bin/cc   searches
       /usr/xpg2include  for #include files before /usr/include, and specifies
       /usr/xpg2lib/libxpg.a as an additional static library of object-library
       routines.

OPTIONS
       When  debugging  or  profiling objects are compiled using the -g or -pg
       options, respectively, the ld command for linking them should also con-
       tain the appropriate option.

       See ld(1) for link-time options.

       -a        Insert  code to count how many times each basic block is exe-
                 cuted.  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 _block
                 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.

       -dalign        (Sun-4 systems only.)
                 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  com-
                 pilation driver.

       -Dname[=def]
                 Define a symbol name to the C preprocessor (cpp(1)).  Equiva-
                 lent to a #define directive in the  source.   If  no  def  is
                 given, name is defined as `1'.

       -E        Run the source file through cpp(1), 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 informa-
                 tion.  (See also, the -P option.)

       float_option
                 Floating-point code generation option.  Can be one of:

                 -f68881   Generate in-line code for Motorola  MC68881  float-
                           ing-point  processor  (supported only on Sun-3 sys-
                           tems).

                 -ffpa     Generate in-line code for Sun Floating Point Accel-
                           erator (supported only on Sun-3 systems).

                 -fsky     Generate  in-line  code for Sky floating-point pro-
                           cessor (supported only on Sun-2 systems).

                 -fsoft    Generate software floating-point calls.   Supported
                           only  on  Sun-2  and Sun-3 systems, for which it is
                           the default.

                 -fstore   Insure that expressions allocated to extended  pre-
                           cision  registers  are rounded to storage precision
                           whenever an assignment occurs in the  source  code.
                           Only  has  effect  when -f68881 is specified (Sun-3
                           systems only).

                 -fswitch  Run-time-switched floating-point calls.   The  com-
                           piled  object code is linked at runtime to routines
                           that support one of the  above  types  of  floating
                           point  code.   This  was  the  default  in previous
                           releases.  Only for  use  with  programs  that  are
                           floating-point  intensive,  and must be portable to
                           machines  with  various   floating-point   hardware
                           options  (supported  only  on  Sun-2 and Sun-3 sys-
                           tems).

       -fsingle       (Sun-2, Sun-3 and Sun-4 systems)
                 Use single-precision  arithmetic  in  computations  involving
                 only float expressions.  Do not convert everything to double,
                 which is the default.  Note:  floating-point  parameters  are
                 still  converted to double precision, and functions returning
                 values still return double-precision values.

                 Although not standard C, certain  programs  run  much  faster
                 using  this  option.   Be aware that some significance can be
                 lost due to lower-precision intermediate values.

       -g        Produce additional symbol table information  for  dbx(1)  and
                 dbxtool(1) and pass -lg option to ld(1) (so as to include the
                 g library, that is: /usr/lib/libg.a).  When  this  option  is
                 given, the -O and -R options are suppressed.

       -go       Produce additional symbol table information for adb(1).  When
                 this option is given, the -O and -R options are suppressed.

       -help     Display helpful information about cc.

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

       -J        Generate 32-bit offsets in switch statement labels (supported
                 only on Sun-2 and Sun-3 systems).

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

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

       -misalign Generate code to allow loading and storage of misaligned data
                 (Sun-4 systems only).

       -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, -go, or -a
                 is used.  -O with the level omitted is equivalent to -O2.  On
                 Sun386i systems, any level supplied is treated  as  level  1.
                 level is one of:

                        1      Do postpass assembly-level optimization only.

                        2      Do  global  optimization  prior to code genera-
                               tion, including loop optimizations, common sub-
                               expression  elimination,  copy propagation, and
                               automatic register allocation.   -O2  does  not
                               optimize references to or definitions of exter-
                               nal or indirect variables.

                        3      Same as -O2, but optimize uses and  definitions
                               of  external variables.  -O3 does not trace the
                               effects of pointer  assignments.   Neither  -O3
                               nor  -O4  should  be used when compiling either
                               device drivers, or programs that modify  exter-
                               nal variables from within signal handlers.

                        4      Same  as  -O3, but trace the effects of pointer
                               assignments.

       -p        Prepare the object code to collect data  for  profiling  with
                 prof(1).   Invokes  a  run-time recording mechanism that pro-
                 duces a mon.out file (at normal termination).

       -P        Run the source file through cpp(1), 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 pro-
                 duces 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 ta-
                 ble.  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.

       -pipe     Use pipes, rather than intermediate files, between cpp(1) and
                 ccom compilation stages.  Very cpu-intensive.

       -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 pathname
                 Insert  directory pathname into the compilation search  path.
                 pathname  will be searched for alternate versions of the com-
                 pilation 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 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 inline, or c2).

       -R        Merge data segment with text segment for  as(1).   Data  ini-
                 tialized  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.   This  is  an  unbundled product that will be
                 released based on 4.1.

       -target target_arch
                 Compile object files for the  specified  processor  architec-
                 ture.   Unless used in conjunction with one of the Sun Cross-
                 Compilers, correct programs can be  generated  only  for  the
                 architecture  of  the  host  on which the compilation is per-
                 formed.  target_arch can be one of:
                        sun2      Produce object files for a Sun-2 system.
                        sun3      Produce object files for a Sun-3 system.
                        sun4      Produce object files for a Sun-4 system.

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

       -w        Do not print warnings.

ENVIRONMENT
       FLOAT_OPTION        (Sun-2, Sun-3, Sun-4 systems only.)  When no float-
                           ing-point option is specified,  the  compiler  uses
                           the  value  of  this environment variable (if set).
                           Recognized values are: f68881, ffpa, fsky,  fswitch
                           and fsoft.

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 (Sun-2, Sun-3,
                           Sun-4 systems only)
       file.i              C source file after preprocessing with cpp(1)
       file.il             inline expansion file
       file.o              object file
       file.s              assembler source file
       file.S              assembler source for cpp(1)
       file.tcov           output from tcov(1) (Sun-2,  Sun-3,  Sun-4  systems
                           only)
       /usr/lib/c2         object code optimizer
       /usr/lib/ccom       compiler
       /usr/lib/compile    compiler command-line processing driver
       /usr/lib/cpp        macro preprocessor
       /usr/lib/crt0.o     runtime startup code
       /usr/lib/Fcrt1.o    startup code for -fsoft option (Sun-2, Sun-3, Sun-4
                           systems only)
       /usr/lib/gcrt0.o    startup for profiling with gprof(1)
       /usr/lib/libc.a     standard library, see intro(3)
       /usr/lib/mcrt0.o    startup for profiling with prof(1) intro(3)
       /usr/lib/Mcrt1.o    startup code for -f68881 option (for Sun-3 systems)
       /lib/optim          Sun386i code optimizer
       /lib/Scrt1.o        startup code for -fsky option (for Sun-2 systems)
       /usr/lib/Wcrt1.o    startup code for -ffpa option (for Sun-3 systems)
       /usr/include        standard directory for #include files
       /usr/lib/bb_link.o  basic block counting routine
       /usr/lib/cg         code generator used with /usr/lib/iropt
       /usr/lib/libc_p.a   profiling library, see gprof(1) or prof(1)
       /usr/lib/inline     inline expander of library calls
       /usr/lib/iropt      intermediate representation optimizer
       /usr/lib/libm.a     math library
       /usr/5lib/libc.a    System  V  standard  compatibility   library,   see
                           intro(3)
       /usr/5lib/libc_p.a  System V profiling library, see gprof(1) or prof(1)
       /tmp/*              compiler temporary files
       /usr/xpg2include    directory for X/Open #include files
       /usr/xpg2lib/libxpg.a
                           X/Open XPG2 compatibility library
       /usr/xpg2lib/libxpg_p.a
                           Profiled   version  of  X/Open  XPG2  compatibility
                           library
       mon.out             file produced for analysis by prof(1)
       gmon.out            file produced for analysis by gprof(1)
       .cb                 subdirectory that holds the  information  generated
                           by the -cb option

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),  lint(1V),  m4(1V),  make(1),
       prof(1), tcov(1), intro(3), monitor(3)

       B.  W.  Kernighan  and D. M. Ritchie, The C Programming Language, Pren-
       tice-Hall, 1978

DIAGNOSTICS
       The diagnostics produced by the C compiler are  intended  to  be  self-
       explanatory.   Occasional  obscure messages may be produced by the pre-
       processor, assembler, or loader.

NOTES
       While the compiler allows 8-bit strings and comments,  8-bits  are  not
       allowed  anywhere  else.   The  cc command does not generate or support
       8-bit symbol names because, until ANSI C,  non-ASCII  support  was  not
       expected.   The  ANSI C specification now suggests that string literals
       and comments can contain any characters from any character code set.

       The following commands are affected by this lack of support  for  8-bit
       characters:  cflow(1V),  cpp(1), ctags(1), cxref(1V), dbx(1), lint(1V),
       m4(1V), and yacc(1).

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 ref-
       erences or manifest constants may be misleading.

       Compiling  with  optimization  level 2 or greater may produce incorrect
       object code if  tail-recursion  elimination  is  applied  to  functions
       called with fewer actual parameters (arguments) than the number of for-
       mal parameters in the function's definition.  Such parameter-count mis-
       matches can be detected using lint(1V).



                                6 October 1988                          CC(1V)