Datasheet
536
Exploring the Software-Development Tools in Linux
Table 1-1 (continued)
Option Meaning
-fPIC
Generates position-independent code (PIC) suitable for
use in a shared library.
-freg-struct-
return
When possible, returns struct and union values
registers.
-g
Generates debugging information. (The GNU debugger
can use this information.)
-I DIRECTORY
Searches the specified directory for files that you include
by using the #include preprocessor directive.
-L DIRECTORY
Searches the specified directory for libraries.
-l LIBRARY
Searches the specified library when linking.
-mcpu=cputype Optimizes code for a specific processor. (cputype
can take many different values — some common
ones are i386, i486, i586, i686, pentium,
pentiumpro, pentium2, pentium3,
pentium4.)
-o FILE
Generates the specified output file (used to designate
the name of an executable file).
-00 (two zeros)
Does not optimize.
-O or -O1 (letter O)
Optimizes the generated code.
-O2 (letter O)
Optimizes even more.
-O3 (letter O) Performs optimizations beyond those done for -O2.
-Os (letter O)
Optimizes for size (to reduce the total amount of code).
-pedantic
Generates errors if any non-ANSI standard extensions
are used.
-pg
Adds extra code to the program so that, when run, this
program generates information that the gprof pro-
gram can use to display timing details for various parts
of the program.
-shared
Generates a shared object file (typically used to create
a shared library).
-UMACRO
Undefines the specified macros
-v
Displays the GCC version number.
-w
Doesn’t generate warning messages.
-W1, OPTION Passes the OPTION string (containing multiple
comma-separated options) to the linker. To create a
shared library named libXXX.so.1, for example,
use the following flag: -Wl,-soname,libXXX.
so.1
.
42_770191-bk08ch01.indd 53642_770191-bk08ch01.indd 536 8/6/10 9:51 AM8/6/10 9:51 AM