Please contact or Mt Xia for assistance with all your shell programming needs.
cc(1) cc(1) NAME cc, c89 - C compiler SYNOPSIS cc [flag] ... file ... DESCRIPTION The cc command invokes the DEC OSF/1 C compiler and produces files in the following formats: object code in extended COFF format (the normal result), binary or symbolic ucode, ucode object files, and binary or symbolic assem- bly language. The cc command can also invoke the linker (ld) or the assem- bler (as). By using the -migrate compilation flag, you can take advantage of the DEC C compilation environment. The DEC C compiler is the same DEC C compiler on other platforms. The default DEC OSF/1 C compiler uses ucode optimization techniques and produces ucode output, while the DEC C compiler uses other optimizations. Both compilers however, produce object files that comply with the common object file format (COFF). If you performed a full installation of DEC OSF/1, then DEC C is part of your system. Otherwise, you will have to install DEC C using the setld com- mand. For more information on installing subsets see the Programming Sup- port Tools manual and the Installation Guide. For a complete listing of DEC C flags on DEC OSF/1, see the description of -migrate. The cc command accepts several types of arguments: ++ Arguments whose names end with .c are assumed to be C source programs. They are compiled, and each object program is left in the file whose name consists of the last component of the source with .o substituted for .c. The .o file is deleted only when a single source program is compiled and loaded all at once. ++ Arguments whose names end with .s are assumed to be symbolic assembly language source programs. They are assembled, producing a .o file. ++ Arguments whose names end with .i are assumed to be C source files after being processed by the C preprocessor. They are compiled without being processed by the C preprocessor. ++ If the highest level of optimization is specified (with the -O3 flag) or only ucode object files are to be produced (with the -j flag), each C source file is compiled into a ucode object file. The ucode object file is left in a file whose name consists of the last component of the source with .u substituted for .c. ++ The following suffixes primarily aid compiler development and are not generally used. Arguments whose names end with .B, .O, .S, and .M are assumed to be binary ucode, produced by the front end, optimizer, ucode object file splitter and ucode merger, respectively. Arguments whose names end with .U are assumed to be symbolic ucode. Arguments whose names end with .G are assumed to be binary assembly language, which is produced by the code generator and the symbolic to binary assembler. ++ Files that are assumed to be binary ucode, symbolic ucode, or binary assembly language by the suffix conventions are also assumed to have their corresponding symbol table in a file with a .T suffix. The cc compiler defines the C preprocessor macro unix to the C macro preprocessor and defines the C preprocessor macro LANGUAGE_C when compiling a .c file with the -std0 flag, which is the default. The cc compiler defines the C preprocessor macro LANGUAGE_ASSEMBLY when compiling a .s file. In addition, the cc compiler defines the preprocessor macro __LANGUAGE_C__ for files with the .c suffix and the preprocessor macro __LANGUAGE_ASSEMBLY__ for files with the .s suffix. The following table shows which macros are defined for each of the -std flags. ______________________________________________ Macro std0 std std1 (default) ______________________________________________ LANGUAGE_C yes no no __LANGUAGE_C__ yes yes yes unix yes no no __unix__ yes yes yes __osf__ yes yes yes __alpha yes yes yes SYSTYPE_BSD yes no no _SYSTYPE_BSD yes yes yes LANGUAGE_ASSEMBLY yes yes yes __LANGUAGE_ASSEMBLY__ yes yes yes ______________________________________________ You can explicitly define the following macros with the -D flag to control which functions are declared in header files and obtain standards confor- mance checking: _________________________________ Macro Standard _________________________________ _XOPEN_SOURCE XPG4 _POSIX_SOURCE POSIX _ANSI_C_SOURCE ISO C and ANSI C _________________________________ These macros are hierarchical, so that _ANSI_C_SOURCE is included in _POSIX_SOURCE, and _POSIX_SOURCE is included in _XOPEN_SOURCE. While the -D flag controls which functions are declared in header files, th standard. For strict ISO C and ANSI C conformance, the compiler command line must include the -std1 flag. The following flags can be used together or individually to improve run- time performance. Please note that using these flags might cause a reduc- tion in accuracy or adherence to standards. See the -migrate section for a listing of flags that will improve performance in the DEC C environment. ++ -D_INTRINSICS ++ -O3 FLAGS The following flags are interpreted by cc. See ld(1) for the link-time flags. -assume [no]accuracy_sensitive Specify whether certain code transformations that affect floating-point operations are allowed. These changes may affect the accuracy of the program's results. The noaccuracy_sensitive qualifier frees the compiler to reorder floating-point operations based on algebraic identities (inverses, associativity, and distribution). This allows the compiler to move divide operations outside of loops, which improves performance. The accuracy_sensitive qualifier, the default, directs the compiler to use only certain scalar rules for calculations. This setting can prevent some optimizations. If you specify -assume noaccuracy_sensitive, the compiler might reorder code (based on alge- braic identities) to improve performance. The results can be different from the default (-assume accuracy_sensitive) because of how the inter- mediate results are rounded. However, the noaccuracy_sensitive results are not categorically less accurate than those gained by the default. -c Suppress the loading phase of the compilation and force an object file to be produced. -call_shared Produce dynamic executable file that uses shareable objects during run- time. This is the default. The loader uses shareable objects to resolve undefined symbols. The run-time loader (/sbin/loader) is invoked to bring in all required shareable objects and to resolve any symbols that remained undefined during static link time. -compress Pass the -compress flag to as if the -c flag is present, or the -compress_r flag to ld if the -r flag is present. Use of this flag causes the output object file to be produced in compressed object file format, resulting in a substantially smaller object file. -cord Run the procedure rearranger, cord, on the resulting file after link- ing. The rearrangement is done to reduce the cache conflicts of the program's text. The output of cord is left in the file specified by the -o output flag or a.out by default. At least one -feedback file must be specified. -cpp Run the C macro preprocessor on C and assembly source files before com- piling. This is the default for cc. Not applicable to -migrate flag. -C This flag is passed directly to cpp. -Dname -Dname=def Define the name to the C macro preprocessor, as if by a #define statement. If no definition is given, the name is defined as 1. -edit[0-9] Invoke the editor of choice (as defined by the environment variable EDITOR, or vi if EDITOR is not defined) when syntax or semantic errors are detected by the compiler's front end. When compiling on a character based terminal, the compile job has to be in the foreground for this flag to take effect. For compile jobs done on a workstation, this flag would always take effect whether it is in the foreground or background. The editor is invoked with two files: the error message file and the source file. First use the error message file to locate the line numbers of all the errors, then switch to the source file to make corrections. Once you exit out of the editor, the compile job is restarted. This process can be repeated up to 9 times, depending on the single digit number speci- fied in the flag. If no number is specified, this compile-edit-compile process repeats indefinitely until all errors are corrected. The -edit0 flag turns off this edit feature. -exact_version Used in conjunction with -call_shared, this flag requests strict depen- dency testing for the executable file produced. Executable files built in this manner can only be executed if the shared libraries that they use were not modified after the executable was built. -E Run only the C macro preprocessor on the files and send the result to the standard output. -feedback file Specify which file is to be used as a feedback file. This flag is used with the -cord, -O2, or -O3 flag. This file is produced by prof with its -feedback flag from an execution of the program produced by pixie. -float_const By default, all floating point constants are treated as double preci- sion. The -float_const flag causes the C front end to inspect the floating point value and treat the value as a float if it can be represented as a single precision value. To ensure that this change has no impact on standards conformance, this flag is disabled when strict ANSI mode is specified on the compile command line (-std1) and the com- piler issues a warning message. -fp_reorder Same as -assume noaccuracy_sensitive. -framepointer Assert the requirement of frame pointer for all procedures defined in the source file. Not applicable to -migrate flag. 0 Do not produce symbol table information for symbolic debugging. This is the default. 1 Produce symbol table information for accurate, but limited, sym- bolic debugging of partially optimized code. 2 Produce symbol table information for full symbolic debugging and suppress optimizations that limit full symbolic debugging. 3 Produce symbol table information for full symbolic debugging for fully optimized code. This flag makes the debugger inaccurate. -G num Specify the maximum size, in bytes, of a data item that is to be put in one of the small data sections. Data items in the small data sections are more likely to be candidates for global pointer optimizations by link-time optimizations. The num argument is interpreted as a decimal number. The default value for num is 8 bytes. -I Cause #include files never to be searched for in the standard direc- tory, /usr/include. -Idir This flag specifies that #include files whose names do not begin with / are always sought first in the directory of the file argument, then in directories specified in -I flags, and finally in the standard direc- tory, /usr/include. -j Compile the specified source programs, and leave the ucode object file output in corresponding files suffixed with .u. Not applicable to -migrate flag. -k Pass flags that start with a -k to the ucode loader. This flag is used to specify ucode libraries (with -kl x) and other ucode loader flags. Not applicable to -migrate flag. output. This file is not removed. If this file is compiled, the object file is left in a file whose name consists of output with the suffix changed to .o. If output has no suffix, a .o suffix is appended to output. Not applicable to -migrate flag. -M This flag is passed directly to cpp. See cpp(1) for details. -MD This flag is passed directly to the preprocessor and linker. For more information, see cpp(1) and ld(1). -[no_]misalign The -misalign flag specifies that code generated for indirect load instructions and store instructions will not generate alignment faults for arbitrarily aligned addresses. Using this flag increases the size of generated code and might have a negative impact on performance. The default condition is for code generated for indirect load instruc- tions and store instructions to generate alignment faults for arbi- trarily aligned addresses. The -no_misalign flag negates the -misalign flag. -no_archive Prevent the linker from using archive libraries to resolve symbols. flag is position sensitive in that it affects only those flags and variables that follow it on the command line. This flag can also be used more than once on the command line. -no_cpp Do not run the C macro preprocessor on C and assembly source files before compiling. Not applicable to -migrate flag. -no_inline Disable the inlining optimization performed under the -O3 flag. This flag is meaningful only when -O3 is specified. -nocurrent_include This flag is passed directly to the preprocessor. For more information, see cpp(1). -no_pg Prevent gprof profiling for the object immediately following this flag. Can be used in conjunction with the -pg to toggle call-graph profiling on and off. -non_shared Do not produce a dynamic executable file. The loader uses regular archives to resolve undefined symbols and object files (.o suffix) from archives that are included in the executable produced. -o output Name the final output file output. If this flag is used, the file a.out is undisturbed. -O flag invokes the ucode optimizer. The 0 Turn off all optimizations. 1 Turn on all optimizations that can be done quickly. This is the default. 2 Invoke the global ucode optimizer. 3, 4 Do all optimizations, including global register allocation and pro- cedure inlining. This flag must precede all source file arguments. If the -c flag is also specified, optimizations are restricted so that shared library symbol preemption behavior is preserved. If -c is not specified, a ucode object file is created for each C source file and left in a .u file. The newly created ucode object files, the ucode object files specified on the command line, the run-time startup routine, and all the run-time libraries are ucode linked. Optimization is done on the resulting ucode linked file which is then linked as normal producing an a.out file. No resulting .o file is left from the ucode linked result. -oldcomment In the preprocessor, delete comments (replace comments with nothing at all), rather than replacing comments with a space. This allows tradi- tional token concatenation. This is the default in -std0 mode. -Olimit num Specify the maximum size, in basic blocks, of a routine that will be optimized by the global optimizer. If a routine has more than this number of basic blocks it will not be optimized and a message will be printed. A flag specifying that the global optimizer is to be run (-O, -O2, or -O3) must also be specified. The num is assumed to be a decimal number. The default value for num is 500 basic blocks. Not applicable to -migrate flag. -om Perform code optimization after linking, including nop (No Operation) removal, .lita removal, and reallocation of common symbols. This flag also positions the global pointer register so the maximum addresses fall in the global pointer/-accessible window. The -om flag is sup- ported only for programs compiled with the -non_shared flag. The fol- lowing options can be passed directly to -om by using the -WL compiler flag: -WL,-om_compress_lita Removes unused .lita entries after optimization, and then compresses the .lita section. -WL,-om_dead_code Removes dead code (unreachable instructions) generated after apply- ing optimizations. The .lita section is not compressed by this flag. -WL,-om_ireorg_feedback,file U to reorganize the instructions to reduce cache thrashing. Turn off instruction scheduling. -WL,-om_no_align_labels Turn off alignment of labels. Normally, the -om flag will quadword align the targets of all branches to improve loop performance. -WL,-om_Gcommon,num Set size threshold of "common" symbols. Every "common" symbol whose size is less than or equal to num will be allocated close to each other. This flag can be used to improve the probability that the symbol can be accessed directory from the global pointer register. Normally, the om tries to collect all "common" symbols together. -p flag prepares for profiling by periodically sampling the value of the program counter. This flag affects only the loading, so that when loading occurs, the standard run-time startup routine is replaced by the profiling run-time startup routine (mcrt0.o) and the level 1 profiling library (libprof1.a) is searched. When you use the -p and -threads flags together, the libprof1_r.a profiling library is used. When profiling begins, the startup routine calls monstartup (see moni- tor(3)) and produces a file named mon.out which contains execution- profiling data for use with the postprocessor prof). 0 Do not permit any profiling. This is the default. If loading occurs, the standard run-time startup routine (crt0.o) is used, and no profiling library is searched. 1 Same as -p. -pg Set up for profiling with the gprof profiler, which produces a call graph showing the execution of a C program. With this flag, the stan- dard run-time startup routine is replaced by the gcrt0.o routine. Pro- grams that are linked with the -pg flag and then run will produce the files gmon.out, containing a dynamic call graph and profile, and gmon.sum, which contains a summarized dynamic call graph and profile. You then run gprof on the gmon.out file to display the output. When you use the -pg and -threads flags together, the profiling library libprof1_r.a is used. For more information, see the gprof(1) reference page. -proto[is] Extract prototype declarations for function definitions into a .H suf- fixed file. The suboption i includes identifiers in the prototype, and the suboption s generates prototypes for static functions as well. Not implemented for the -migrate flag. -P Run only the C macro preprocessor and put the result for each source file (by suffix convention, such as .c and .s) in a corresponding .i file. The .i file has no # lines in it. This sets the -cpp flag. -Q This flag is passed directly to cpp. See cpp(1) for details. -readonly_strings Make all string literals readonly. If you attempt to write to a readonly string you might experience unpredictable results, such as a segmentation fault. -std0. The -std flag enforces the ANSI C standard with popular extensions. and causes the macro __STDC__=0 to be passed to the preprocessor. 0 Enforce the K & R standard with some ANSI extensions, and causes the __STDC__ macro to be undefined. 1 Enforce the ANSI C standard and causes the macro __STDC__=1 to be passed to the preprocessor. Note that the -std1 flag also affects linker defined symbols. See the ld(1) reference page for more information. -S Compile the specified source programs and leave the symbolic assembly language output in corresponding files suffixed with .s. Not imple- mented for the -migrate flag. -taso Tell the linker that the executable file should be loaded in the lower 31-bit addressable virtual address range. The -T and -D flags to the ld command can also be used to ensure that the text and data segments addresses, respectively, are loaded into low memory. The -taso flag, however, in addition to setting default addresses for text and data segments, also causes shared libraries linked outside the 31-bit address space to be appropriately relocated by the loader. If you specify -taso and also specify text and data segment addresses with -T and -D, those addresses override the -taso default addresses. The -taso flag is useful for porting 32-bit programs to DEC OSF/1. -threads Tell the linker to use the threadsafe version of libc, and - if it exists - the threadsafe version of any library specified with the -l flag, when linking programs. This flag also tells the linker to include libpthreads and its support libraries when linking with a pro- gram. Note that when you use this flag, it should appear last on the command line. -traditional Is the same as the -std0 flag. -trapuv Force all uninitialized stack variables to be initialized with 0xfffa5a5afffa5a5a. When this value is used as a floating point vari- able, it is treated as a floating point NaN and it causes a floating point trap. When it is used as a pointer, an address or segmentation violation will most likely occur. -tune option Selects processor-specific instruction tuning for implementations of the Alpha AXP architecture. Regardless of the setting of the -tune flag, the generated code will run correctly on all implementations of the Alpha AXP architecture. Tuning for a specific implementation can provide improvements in runtime performance. It is possible that code tuned for a specific target may run slower on another target. The option keyword can be one of the following: generic Selects instruction tuning that is appropriate for all implementations of the Alpha AXP architecture. This option is the default. host Selects instruction tuning that is appropriate for the machine on which the code is being compiled. ev4 Selects instruction tuning for the 21064, 21064A, 21066, and 21068 implementations of the Alpha AXP architecture. ev5 Selects instruction tuning for the 21164 implementation of the Alpha AXP architecture. -Uname Remove any initial definition of name. -v Print the passes as they execute with their arguments and their input and output files. Also print resource usage in the C-shell time for- mat. If specified more than once, the passes are printed but not exe- cuted. -verbose Cause output of the long form of error and warning messages. These may give the user some hints as to the reason the compilation failed. -V Print the version of the driver and the versions of all passes. This is done with the what command. Not implemented for the -migrate flag. -w flag 1 Suppress warning messages. Same as -w. 2 Abort on warnings after printing them as if an error occurred. 3 Do not print warning messages, however exit with nonzero status when warnings occur. -warnprotos Cause the compiler to produce warning messages when a function is called that is not declared with a full prototype. This checking is more strict than required by ANSI C. -writable_strings Make string literals writable. This is the default. -x Do not preserve local (non-.globl) symbols in the output symbol table; enter external and static symbols only. This flag, which cc passes to ld, saves space in the output file. -xtaso Cause the compiler to respond to the #pragma pointer_size preprocessor directives which control pointer size allocations. This flag allows you to specify 32-bit pointers when used in conjunction with the pragma pointer_size directive. You must place pragmas where appropriate in your program to use 32-bit pointers. Images built with this flag must be linked with the -taso flag in order to run correctly. See the Programmer's Guide for information on #pragma pointer_size. -xtaso_short Force the compiler to allocate 32-bit pointers by default. You can still use 64-bit pointers, but only by the use of pragmas. -signed Cause all char declarations to be signed char declarations. This is the default. -unsigned Cause all char declarations to be unsigned char declarations. This is usually used to override a previous -signed flag. -volatile Cause all variables to be treated as volatile. -varargs Print warnings for lines that may require the varargs.h macros. -float Cause the compiler to never promote expressions of type float to type double. To facilitate setting of default compiler options for cross compilation environments, use the option configuration file named comp.config. This file, located at the compiler target directory, contains a single line of ASCII text of compiler options. These options are processed ahead of the user-specified options in the command line. The line can be up to BUFSIZ-1 long, with up to 64 tokens (separated by blanks and tabs). Flags specified in the command line override those specified in the configuration file. The following flags primarily aid compiler development and are not gen- erally used: -Hc Halt compiling after the pass specified by the character c, producing lowing: [ fjusmoca ]. It selects the compiler pass in the same way as the -t flag. If this flag is used, the symbol table file produced and used by the passes is the last component of the source file with the suffix changed to .T and is not removed. -K Build and use intermediate file names with the last component of the source file's name replacing its suffix with the conventional suffix for the type of file (for example .B file for binary ucode, produced by the front end). These intermediate files are never removed even when a pass encounters a fatal error. When ucode linking is performed and the -K flag is specified, the base name of the files created after the ucode link is u.out by default. If -ko output is specified, the base name of the object file, if it exists, is output without the suffix, or suffixes are appended to output if it has no suffix. -Wc[c...],arg1,[arg2...] Pass the argument, or arguments, argi to the compiler pass, or passes: piler pass in the same way as the -t flag. The flags from the set -t [hpfjusmocablyzrntL], -hpath, and -Bstring select a name to use for a particular pass, startup routine, or standard library. These arguments are processed from left to right so their order is signifi- cant. When the -B flag is encountered, the selection of names takes place using the last -h and -t flags. Therefore, the -B flag is always required when using -h or -t. Sets of these flags can be used to select any combi- nation of names. The -p flags must precede all -B flags because they can affect the location of run times and what run times are used. Use the -t [hpfjusmocablyzrntL] suboptions to select the names. The names selected are those designated by the characters following the -t flag according to the following table: _________________________________________ Name Character _________________________________________ include h (see note following table) cfe p, f ujoin j uld u usplit s umerge m uopt o ugen c as0 a as1 b ld l ftoc y cord z [m]crt0.o r libprof1.a n btou, utob t om L _________________________________________ If the character h is in the -t argument, a directory is added to the list of directories to be used in searching for #include files. This directory name has the form $COMP_TARGET_ROOT/usr/includestring. This directory is to contain the include files for the string release of the compiler. The standard directory is still searched. -hpath Use path rather than the directory where the name is normally found. -Bstring Append string to all names specified by the -t flag. If no -t flag has been processed before the -B, the -t flag is assumed to be hpfjusmocablyzrntL. This list designates all names. If no -t argument has been processed before the -B, then a Invoking the compiler with a name of the form ccstring has the same effect as using a -Bstring flag on the command line. If the environment variable COMP_HOST_ROOT is set, the value is used as the root directory for all pass names rather than the default directory, which is /. If the environment variable COMP_TARGET_ROOT is set, the value is used as the root directory for all include and library names rather than the default /. This affects the standard directory for #include files, /usr/include, and the standard library, /usr/lib/libc.a. If this is set, th $COMP_TARGET_ROOT/usr/lib/cmplrs/cc. The standard directories for libraries are then searched. See ld(1). If the environment variable TMPDIR is set, the value is used as the direc- tory to place any temporary files rather than the default /tmp/. If the environment variable RLS_ID_OBJECT is set, the value is used as the name of an object to link in if a link takes place. This is used to add release identification information to objects. It is always the last object specified to the loader. The user can choose which error message file to use at the time the com- piler is invoked. The following locations are searched (in order): 1. A file name specified on the command line. 2. A file specified by the environment variable __ERROR_FILE. 3. A file in the same directory as the resulting binary, with file name err.$__LANG.cc, where $__LANG is the value of the environment variable __LANG. The default for __LANG is english. 4. A file err$__LANG.cc in the current directory. 5. If none of the previous locations are present, the file /usr/lib/cmplrs/err.cc is used. The following flags determine the rounding mode applied to IEEE floating- point instructions generated by the compiler. If you do not specify a -fprm n flag, the IEEE floating-point rounding mode defaults to normal rounding. -fprm n Normal rounding (unbiased round to nearest). -fprm m Round toward minus infinity. -fprm c Chopped rounding (round towards zero). The following flag enables the dynamic setting of the rounding mode of IEEE floating-point instructions. The dynamic rounding mode is determined from the contents of the floating-point control register and can be changed or read at execution time by a call to write_rnd or read_rnd. If you specify -fprm d, the IEEE floating-point rounding mode defaults to normal rounding. -fprm d Set rounding mode for IEEE floating-point instructions dynami- cally. The following flags provide support for exception handling: -fptm n No floating point trapping modes. -fptm u Trap floating point on underflow. -fptm su Trap floating point on underflow with software completion. -fptm sui Trap floating point on underflow or inexact with software comple- tion. -scope_safe Ensure that any trap (such as floating overflow) is reported to have occurred in the procedure or guarded scope that caused the trap. Any trap occurring outside that scope is not reported to have occurred in the procedure or guarded scope, with the excep- tion of well-defined trapbs following jsrs. -resumption_safe Restrict all -scope_safe functionality plus the code generated in trap shadows so that it is reexecutable. -ieee_with_inexact Provide full IEEE support. This flag sets the -resumption_safe and -fptm sui compiler flags and marks the procedures as IEEE- conformant. As a result, system library routines will handle denormalized numbers, NaNs, and infinities, and return the correct IEEE default value in error cases. In addition, the mac- ros _IEEE_FP and _IEEE_FP_INEXACT are set. The inexact value flag is set when the results of a computation cannot be represented exactly, such as a division with a remainder. The value of the flag can be examined by calling ieee_get_fp_control(). (See ieee_get_fp_control(3) for more information.) This flag can result in significantly slower execution because all computations that produce inexact results trap on Alpha sys- tems prior to the 21164 implementation. The -ieee_with_no_inexact flag provides many of the same features but without the performance degradation. Use -ieee_with_inexact if your program calls ieee_get_fp_control() to check the IEEE inex- act value flag, set when the results of a computation cannot be represented exactly, such as a division with a remainder. (See ieee_get_fp_control(3) for more information.) Otherwise, use -ieee_with_no_inexact. -ieee_with_inexact, but set only the -fptm su flag and _IEEE_FP macro. Programs compiled with this flag run faster than those compiled with -ieee_with_inexact, because they do not set the IEEE-specified inexact value flag. Use -ieee_with_no_inexact if your program does not call ieee_get_fp_control(), but you want the other IEEE behaviors described in -ieee_with_inexact. If you are not dealing with denormalized numbers, NaNs, or infinities, do not specify either flag. This produces the fastest possible performance. Other arguments are assumed to be either linker flags for C-compatible object files, typically produced by an earlier cc run, or perhaps libraries of C-compatible routines. These files, together with the results of any compilations specified, are loaded in the order given, producing an execut- able program with the default name a.out. The cc command recognizes position-sensitive linker flags and maintains their relative order when it invokes the linker (ld). These flags are: -L, -all, -exclude, -exported_symbol, -hidden, -hidden_symbol, -kl, -l, -none, -non_hidden, and -no_archive. See the ld(1) reference page for a full description of these flags. THE -migrate FLAG The -migrate flag enables language processing rules and language extensions for the DEC C compilation environment. Existing cc Command Flags Not Supported When you specify the -migrate flag, the following cc flags are either not applicable or not supported: -cpp, -j, -ko output, -k, -no_cpp, -proto[is], -Olimit num, -S, and -V. Default cc Flags In the absence of any cc command line flags other than -migrate, the com- piler uses the following defaults: -std0 - Enforce the K & R standard with some ANSI extensions. -g1 - Produce line number information for limited symbolic debugging. -O1 - Enable all optimizations that can be done quickly. -inline none - Do no inlining. Flags to Improve Run-Time Performance In addition to the list of cc flags in the DESCRIPTION section of this reference page that can be used together to improve run-time performance, the following flags can be used with the -migrate flag: ++ -O4 (in place of -O3) ++ -ifo Additional cc Command Flags Supported The -migrate flag enables the following additional cc command flags which are native to the DEC C compilation environment, but not part of the DEC OSF/1 cc compiler options: -ansi_alias Direct the compiler to assume the ANSI C aliasing rules. The aliasing rules referred to are explained in Section 3.3, paragraphs 20 and 25 of the ANSI C Standard, reprinted as follows: An object shall have its stored value accessed only by an lvalue that has one of the following types: The declared type of the object, A qualified version of the declared type of the object, A type that is the signed or unsigned type corresponding to the declared type of the object, A type that is the signed or unsigned type corresponding to a quali- fied version of the declared type of the object, An aggregate or union type that includes one of the aforementioned types among its members (including, recursively, a member of a subaggregate or contained union), or A character type. If your program does not access the same data through pointers of a dif- ferent type (and for this purpose, signed and qualified versions of an otherwise same type are considered to be the same type), then assuming ANSI C aliasing rules allows the compiler to generate better optimized code. If your program does access the same data through pointers of a dif- ferent type (for example, by a "pointer to int" and a "pointer to float"), then you must not allow the compiler to assume ANSI C aliasing rules. Otherwise, incorrect code might be generated. The default is to assume no ANSI C aliasing rules when compiling with the -vaxc or -std0 flag. The default is -ansi_alias for the other com- piler modes (-std, -std1). -assume aligned_objects flag, the default, allows the compiler to make such an assumption, and thereby generate more efficient code for pointer dereferences of aligned pointer types. The -assume noaligned_objects prevents the compiler from assuming the pointer type's alignment for objects that it points to. The compiler assumes that pointers point to objects that are aligned at least as much as the alignment of the pointer type. For example: ++ A pointer of type short points to objects that are at least short- aligned. ++ A pointer of type int points to objects that are at least int-aligned. ++ A pointer of type struct truct points to objects that have an align- ment of struct truct (that is, the alignment of the strictest member alignment, or byte alignment if you have specified #pragma nomember_alignment for struct truct). If your module breaks this rule, you must use the -assume noaligned_objects flag to compile the module; otherwise, your program may get alignment faults during execution that will degrade per- formance. On AXP systems, the compiler aligns all nonmember declarations on natural boundaries, so by default all objects do comply with the previ- ous assumption. -check Perform compile-time code checking. With this flag, the compiler checks for code that exhibits nonportable behavior, represents a possible unin- tended code sequence, or possibly affects operation of the program because of a quiet change in the ANSI C Standard. Some of these checks have traditionally been associated with the lint utility. -gen_feedback Generate accurate profile information to be used with -feedback optimi- zations. It should be used in the compiling and linking phases. When compiling a program for profiling, add -gen_feedback to your existing set of command line flags. The -feedback flag should not be used when generating profile information. -inline keyword Provide inline expansion of functions that yield optimized code when they are expanded. Functions must conform to the rules specified in the description of the #pragma inline preprocessor directive to be eligible for inline expansion. In choosing calls to expand inline the compiler also considers the function size, how often the call is executed, how many registers the inline expansion will require, and other factors. You can specify one of the following as the keyword to control inlining: none No inlining is done, even if requested by a #pragma inline prepro- cessor directive. This is the default when compiling with -O0 and -O1 optimization level). manual Inlines only those function calls explicitly requested for inlining by a #pragma inline directive. This is the default when compiling with the -O2 and -O3 flags. size Inlines all of the function calls in the manual category, plus any additional calls that the compiler determines would improve run-time performance without significantly increasing the size of the pro- gram. This is the default when compiling with -O, -O4, or -O5. speed Inlines all of the function calls in the manual category, plus any additional calls that the compiler determines would improve run-time performance, even where it may signficantly increase the size of the program. all Inlines every call that can be inlined while still generating correct code. Recursive routines, however, will not cause an infin- ite loop at compile time. For optimization level 0 (-O0), the -inline flag is ignored and no inlining is done. The #pragma noinline preprocessor directive can also be used to prevent inlining of any function. -machine_code List the generated machine code in the listing file. To produce the listing file, you must also specify -source_listing. The default is to not list the generated machine code. #pragma member_alignment, #pragma nomember_alignment, or #pragma pack directives within the source code overrides the setting established by this flag. -noobject Suppress creation of an object module file. By default, an object module file is created with the same name as that of the first source file of a compilation unit and with the .o file extension. Use the -noobject flag when you need only a listing of a program or when you want the compiler to check a source file for errors. -O flag without a value enables inline expansion of small procedures. Symbol preemption with shared libraries is only supported at optimization levels -O0, -O1, -O2 and following: 0 Disables all optimizations. 1 Enables local optimizations and recognition of common subexpressions. The call graph determines the order of compilation of procedures. This is the default. 2 Enables global optimization. This includes code motion, strength reduction and test replacement, split lifetime analysis, and code scheduling. 3 Enables additional global optimizations that improve speed (at the cost of extra code size). For example: integer multiplication and division expansion (using shifts), loop unrolling, and code replica- tion to eliminate branches. 4 Enable inline expansion of small procedures. (Same as -O.) This is the recommended optimization level for working in the DEC C environ- ment. 5 Enables the following additional optimizations: Software pipelining using dependence analysis Vectorization of some loops on 8-bit and 16-bit data (char and short) Insertion of NOP instructions to improve scheduling. To determine whether using -O5 benefits your particular program, you should time program execution for the same program compiled at levels -O4 and -O5. -ifo Provide improved optimization (inter-file optimization) and code genera- tion across file boundaries that would not be available if the files were compiled separately. In previous Versions of the DEC OSF/1 operat- ing system, this flag was known as -plus_list_optimize. When you specify -ifo on the command line in conjunction with a series of file specifications, the compiler does not concatenate each of the specified source files together. Instead, each file is treated separately for purposes of parsing, except that the compiler will issue diagnostics about conflicting external declarations and function defini- tions that occur in different files. For purposes of code generation, the compiler treats the files as one application. The default is to not provide inter-file optimization. -portable Place the compiler in VAX C mode and enable the issuance of diagnostics that warn about any nonportable usages encountered. -show keyword[,keyword,...] Specify one or more items to be included in the listing file. When specifying multiple keywords, separate them by commas (with no interven- ing blanks). To use any of the -show keywords, you must also specify the -source_listing option. The -show keywords are as follows: none Turn off all show options. all Turn on all show options. [no]expansion Place final macro expansions in the program listing. When you specify expansion, the number printed in the margin indicates the maximum depth of macro substitutions that occur on each line. [no]header Produce header lines at top of each page of listing. [no]include Place contents of #include files in program listing. [no]source Place source program statements in program listing. [no]statistics Place compiler performance statistics in the program listing. The default is to show page headers and source ( -show header, source). -source_listing Produce a source program listing file with the same name as the source file and with a file extension of .lis. You must specify this qualifier to get a listing. The default is to not produce a listing file. -unroll n unrolls loop bodies n times. Specifying -unroll 0 means the optimizer uses its own default unroll amount. The default is -unroll 0. -vaxc Place the compiler in VAX C compatibility mode. This mode of compilation allows the same language as the ANSI C language, but also supports VAX C extensions that are incompatible with the ANSI C Standard and that change the language semantics. This mode provides compatibility for pro- grams that depend on old VAX C behavior. -w0 Display all levels of compiler messages. By default, informational mes- sages are suppressed. ERRORS The diagnostics produced by cc are intended to be self-explanatory. Occa- sional messages may be produced by the assembler or loader. FILES file.c input file file.o object file a.out loaded output err.english.cc compiler error messages in English /tmp/ctm? temporary /usr/lib/cmplrs/cc/comp.config compiler configuration file (optional) /usr/lib/cmplrs/cc/cfe C front end /usr/lib/cmplrs/cc/cpp C macro preprocessor /usr/lib/cmplrs/cc/ujoin binary ucode and symbol table joiner /usr/bin/uld ucode loader /usr/lib/cmplrs/cc/usplit binary ucode and symbol table splitter /usr/lib/cmplrs/cc/umerge procedure integrator /usr/lib/cmplrs/cc/uopt optional global ucode optimizer /usr/lib/cmplrs/cc/om post-link optimizer /usr/lib/cmplrs/cc/ugen code generator /usr/lib/cmplrs/cc/as0 symbolic to binary assembly language translator /usr/lib/cmplrs/cc/as1 binary assembly language assembler and reorganizer /usr/lib/cmplrs/cc/crt0.o run-time startup /usr/lib/cmplrs/cc/mcrt0.o startup for profiling /usr/ccs/lib/libc.a standard library, see intro(3) /usr/lib/cmplrs/cc/libprof1.a level 1 profiling library /usr/include standard directory for #include files /usr/lib/cmplrs/cc/ftoc interface between prof and cord /usr/lib/cmplrs/cc/cord procedure-rearranger /usr/bin/btou binary to symbolic ucode translator /usr/bin/utob symbolic to binary ucode translator mon.out file produced for analysis by prof gmon.out file produced for analysis by gprof RELATED INFORMATION ANSI X3.159-1989 B. W. Kernighan and D. M. Ritchie, The C Programming Language B. D. M. Ritchie, C Reference Manual Assembly Language Programmer's Guide as(1), cord(1), decladebug(1), dbx(1), ftoc(1), ld(1), pixie(1), prof(1), what(1), monitor(3)