导航

Unix cc options vs gcc options

Posted on 2007-12-23 10:19  hcfalan  阅读(1164)  评论(0编辑  收藏  举报
=================================================
cc options
=================================================

-#  Verbose mode
-###  Show compiler commands built by driver, no compilation
-A<name[(tokens)]> Preprocessor predicate assertion
-B<[static|dynamic]> Specify dynamic or static binding
-C  Prevent preprocessor from removing comments
-c  Compile only - produce .o files, suppress linking
-D<name[=token]> Associate name with token as if by #define
-d[y|n]  dynamic [-dy] or static [-dn] option to linker
-dalign  Expands to -xmemalign=8s
-E  Compile source through preprocessor only, output to stdout
-erroff=<t> Suppress warnings specified by tags t(%none, %all, <tag list>)
-errshort[=<a>] Control amount of type details in error messages, <a>={short|full|tags}
-errtags=<a> Display messages with tags a(no, yes)
-errwarn=<t> Treats warnings specified by tags t(%none, %all, <tag list>) as errors
-fast  Optimize using a selection of options
-fd  Report old-style function definitions and declarations
-features=<v> Enable/disable C language features, <v>= {[no%]extinl|[no%]typeof|[no%]extensions}
-flags  Show this summary of compiler options
-fnonstd Initialize floating-point hardware to non-standard preferences
-fns[=<yes|no>] Select non-standard floating point mode
-fround=<r> Select the IEEE rounding mode in effect at startup
-fsimple[=<n>] Select floating-point optimization preferences <n>
-fsingle Use single-precision arithmetic (-Xt and -Xs modes only)
-ftrap=<t> Select floating-point trapping mode in effect at startup
-G  Build a dynamic shared library
-g  Compile for debugging
-H  Print path name of each file included during compilation
-h <name> Assign <name> to generated dynamic shared library
-I<dir>  Add <dir> to preprocessor #include file search path
-i  Passed to linker to ignore any LD_LIBRARY_PATH setting
-keeptmp Keep temporary files created during compilation
-KPIC  Compile position independent code with 32-bit addresses
-Kpic  Compile position independent code
-L<dir>  Pass to linker to add <dir> to the library search path
-l<name> Link with library lib<name>.a or lib<name>.so
-m32  set 32-bit addressing model
-m64  set 64-bit addressing model
-mc  Remove duplicate strings from .comment section of output files
-misalign Expands to -xmemalign=1i
-misalign2 Expands to -xmemalign=2i
-mr  Remove all strings from .comment section of output files
-mr,"string" Remove all strings and append "string" to .comment section
-mt  Specify options needed when compiling multi-threaded code
-native  Optimize for the host system (-xtarget=native)
-O  Use default optimization level (-xO3)
-O<n>  Same as -xO<n>
-o <outputfile> Set name of output file to <outputfile>
-P  Compile source through preprocessor only, output to .i  file
-p  Compile for profiling with prof
-Q[y|n]  Emit/don't emit identification info to output file
-qp  Compile for profiling with prof
-R<dir[:dir]> Build runtime search path list into executable
-S  Compile and only generate assembly code (.s)
-s  Strip symbol table from the executable file
-U<name> Delete initial definition of preprocessor symbol <name>
-V  Report version number of each compilation phase
-v  Do stricter semantic checking
-W<c>,<arg> Pass <arg> to specified component <c> (a,c,l,m,p,0,2,o)
-w  Suppress compiler warning messages
-Xa  Compile assuming ANSI C conformance, allow K & R extensions (default mode)
-Xc  Compile assuming strict ANSI C conformance
-Xs  Compile assuming (pre-ANSI) K & R C style code
-Xt  Compile assuming K & R conformance, allow ANSI C
-xalias_level=<a> Enable optimizations based on the specified alias_level
-xarch=<a> Specify target architecture instruction set
-xautopar Enable automatic loop parallelization
-xbinopt={prepare|off} Prepare the binary for binary optimizations and analysis
-xbuiltin[=<b>] When profitable inline, or substitute intrinsic functions for system functions, b={%all,%none}
-xc99[=<a>] Enable ISO C99 features, <a>={all,none,[no_]lib}
-xcache=<c> Define cache properties for use by optimizer
-xCC  Accept C++ style comments
-xcg89  Expands to -xarch=v7 -xchip=old -xcache=64/32/1
-xcg92  Expands to -xarch=v8 -xchip=super -xcache=16/32/4:1024/32/1
-xchar=<v> Treat type char as signed (<v> = s or signed) or unsigned (<v> = u or unsigned).
-xchar_byte_order=<o> Specify multi-char byte order <o> (default, high, low)
-xcheck[=<a>[,<a>]] Generate runtime checks for error condition <a>={%all|%none|stkovf|no%stkovf}
-xchip=<c> Specify the target processor for use by the optimizer
-xcode=<c> Generate different code for forming addresses
-xcrossfile[=<n>] Enable optimization and inlining across source files, n={0|1}
-xcsi  Allow C source code using non-ISO C compliant locales
-xdebugformat=<a> Selects the format of debugging information; <a>={dwarf|stabs}
-xdepend[=<yes|no>] Analyze loops for data dependencies
-xdryrun The same as -###
-xe  Perform only syntax/semantic checking, no code generation
-xexplicitpar Parallelize loops explicitly marked with directives
-xF=<a>[,<a>] Compile for later mapfile reordering and data fragmentation, <a>={[no%]func|[no%]gbldata|%all|%none}
-xhelp=<f> Display on-line help information f(flags, readme)
-xhwcprof[=<a>] Enable/disable program annotation for hardware counter profiling <a>={enable|disable}
-xinline=[<a>,...,<a>]  Attempt inlining of specified user routines, <a>={%auto,func,no%func}
-xipo[=<n>] Enable optimization and inlining across source files, n={0|1|2}
-xipo_archive=<a> Enable crossfile optimization including archive files, <a>={none|readonly|writeback}
-xinstrument=<a> Enable/disable instrumentation for race detection tool, <a>=[no%]datarace
-xjobs=<n> Maximum number of components compiler will fork in parallel
-xldscope=<a> Indicates the appropriate linker scoping within the source program; <a>={global|symbolic|hidden}
-xlibmieee Force IEEE 754 return values for math routines in exceptional cases
-xlibmil Inline selected libm math routines for optimization
-xlibmopt Link with optimized math library
-xlic_lib=sunperf Link in the Sun supplied performance libraries
-xlinkopt[={0,1,2}] Perform optimizations on relocatable object files
-xloopinfo Show loops that parallelized
-xM  Generate makefile dependencies
-xM1  Generate makefile dependencies, but exclude /usr/include
-xmaxopt=[off,1,2,3,4,5] maximum optimization level allowed on #pragma opt
-xmemalign[=<a><b>] Controls memory alignment, <a>={1|2|4|8|16}, b={f|i|s}.
-xMerge  Merge data segment into text segment
-xnolib  Do not link with default system libraries
-xnolibmil Cancel -xlibmil on command line
-xnolibmopt Cancel -xlibmopt on command line
-xnorunpath Do not build a runtime search path into the executable
-xO<n>  Generate optimized code (n={1|2|3|4|5})
-xopenmp=<a> Enable OpenMP language extension <a>={noopt|parallel|none}
-xP  Print prototypes for function definitions
-xpagesize_heap=<a> Controls the preferred page size for the heap, a={8K|64K|512K|4M|32M|256M|2G|16G|default}
-xpagesize_stack=<a> Controls the preferred page size for the stack, a={8K|64K|512K|4M|32M|256M|2G|16G|default}
-xpagesize=<a> Controls the preferred page size for the stack and for the heap, a={8K|64K|512K|4M|32M|256M|2G|16G|default}
-xparallel Perform parallel compilation
-xpch=<p> Enable precompiled headers.  Collect data for, or use existing, PCH file <p>={auto|autofirst|{collect,use}:<file>[.cpch]}
-xpchstop=<file> Specified include file marks end of initial common sequence of pre-processing directives for precompiled headers.
-xpg  Compile for profiling with gprof
-xprefetch[=<p>] Specify instruction prefetch p (auto,no%auto,explicit,no%explicit,latx:<n>.<n>)
-xprefetch_auto_type=<a> Specify automatic indirect prefetch insertion for loops; <a>=[no%]indirect_array_access
-xprefetch_level[=<n>] Controls the aggressiveness of the -xprefetch=auto option (n={1|2|3})
-xprofile=<p> Collect data for a profile or use a profile to optimize <p>={{collect,use}[:<path>],tcov}
-xprofile_ircache[=path] Path to intermediate file cache used with -xprofile option
-xprofile_pathmap=<collect-path>:<use-path> Map object file path from <collect-path> to <use-path>
-xreduction Recognize reduction operations in parallelized loops
-xregs=<r> Specify the usage of optional registers
-xrestrict[=<f>] Treat pointer valued function parameters as restricted f(%none,%all,<function-name list>)
-xs  Allow debugging without object (.o) files
-xsafe=mem Assume that no memory based traps will occur
-xsb  Compile for use with the WorkShop source browser
-xsbfast Generate only WorkShop source browser information, no compilation
-xsfpconst Represent unsuffixed floating point constants as single precision
-xspace  Do not do optimizations that increase code size
-xstrconst Place string literals into read-only data segment
-xtarget=<t> Specify target system for optimization
-xtemp=<dir> Set directory for temporary files to <dir>
-xthreadvar=<a>[,<a>] Control code generation for thread variables <a>={[no%]dynamic|[no%]stack|%all|%none}
-xtime  Report the execution time for each compilation phase
-xtransition Emit warnings for differences between K&R C and ANSI C
-xtrigraphs[=<yes|no>] Enable|disable trigraph translation
-xunroll=n Enable unrolling loops n times where possible
-xustr=<a> Recognize sixteen-bit string literals <a>={no|ascii_utf16_ushort}
-xvector[=<a>] automatic generation of calls to the vector library functions and/or the generation of the SIMD instructions, <a>={[no%]lib|%none}
-xvis[=<yes|no>] Enable the use of VIS inline templates
-xvpara  Verbose parallelization warnings
-Y<c>,<dir> Specify <dir> for location of component <c> (a,c,l,m,p,0,2,o)
-YA,<dir> Change default directory searched for components
-YI,<dir> Change default directory searched for include files
-YP,<dir> Change default directory for finding libraries files
-YS,<dir> Change default directory for startup object files
-Zll  Create lock_lint database files (.ll)


=================================================
gcc options (more options, see gcc option summary
=================================================
-g
     Produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF 2). GDB can work with this debugging information.
-m32/-m64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits.
-mcpu=v7
Set the instruction set, register set, and instruction scheduling parameters for machine type cpu_type. Supported values for cpu_type are `v7', `cypress', `v8', `supersparc', `sparclite', `f930', `f934', `hypersparc', `sparclite86x', `sparclet', `tsc701', `v9', `ultrasparc', `ultrasparc3', `niagara' and `niagara2'.
-Ixxx
Add the directory dir to the head of the list of directories to be searched for header files. This can be used to override a system header file, substituting your own version, since these directories are searched before the system header file directories. However, you should not use this option to add directories that contain vendor-supplied system header files (use -isystem for that). If you use more than one -I option, the directories are scanned in left-to-right order; the standard system directories come after.
-DUNIX
Predefine name as a macro, with definition 1.
-c
Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.