Thursday, March 24, 2011

Compiler options

with 0 comments
Compiler options are parameters you can specify to change the default behavior of the compiler. You can specify options from the command line

TYPES OF OPTIONS

There are two types of names for command line options, short names and long names.
Some options have both.
> short option name consists of one character, and it may have parameters. You specify it with a single dash, for example -e
> long option name consists of one or several words joined by underscores, and it may have parameters. You specify it with double dashes, for example
--char_is_signed.

Compiler options perform a wide variety of functions, such as setting compiler characteristics, describing the object code and compiler output to be produced, and performing some preprocessor functions. You can specify compiler options in one or more of three ways:
> on the command line
> in a configuration file (.cfg)
> in your source program

-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 from removing
comments.

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

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

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


-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 source-
file (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 optimiza-
tions, common subexpression elimination,
copy propagation, and automatic register
allocation. -O2 does not optimize refer-
ences to or definitions of external or
indirect variables.


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

0 comments:

Post a Comment