[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

Chapter 16.

 

x86 Command-Line Settings



This chapter describes the compiler language options for the command-line tools. These options control the way the compiler parses and translates source code.

For detailed information on setting up and using the command-line tools, refer to the CodeWarrior Command-Line Tools Reference, which is located on the CodeWarrior Reference disc.

The sections of this chapter are:


x86 Language Options

The x86 language options covered in this section include:


Preprocessing and Precompiling

This section contains information about command-line options for controlling preprocessing and input file manipulation.


/c

Compile only, do not link


/CWD keyword

Specify #include searching semantics, using the following keywords.

proj  
begin search in current working directory.  
source  
begin search in directory of source file (this is the default).  
explicit  
begin search with first (/I)nclude path.  


/dis

Passed to all tools (linker, etc) this option forces disassembly of object code.


/D+name[=value]

Define symbol 'name' to 'value' if specified, else '1'


/E[P]

Preprocess to stdout. If only /E is specified, the file will be preprocessed to stdout. If /EP is specified, the file will be preprocessed to a file placed in the output directory or the current working directory (depending on the setting of /Fo (see
/Fo+file|dir). The file extension will be .inc.


/Ex+extension

Specify extension for generated object files; with a leading period ('.'), appends extension; without, replaces source file's extension.

For extension, the maximum length is 14 characters. The .obj extension is used by default.


/F+kilobytes

Specify stack size in kilobytes.


/Fa

Send assembly listing to <source>.asm. This command puts the .asm file in the source file's directory, not in the output directory.


/FI+file

Prefix text file or precompiled header onto all source files.


/Fo+file|dir

Specify output filename or directory for object file(s) or preprocessor output (with /P). If specifying a directory, `/Fo???' must appear before any source files.


/Fp+file

Name precompiled header file; same as /Yc+file


/I-

Delimit groups of user paths (before /i-) from system paths (after /i-). System paths are searched with #include <...> as well as #include "...". Default system includes (see /nodefaults and /nostdinc) are searched after paths specified on the command line, which implies /cwd explicit.

See also /CWD keyword


/I+path[;...]

Add path to list of #include search paths.


/LD

Create a DLL.


/LDd

Create a DLL with debugging information included.


/link

Add remainder of command line to linker's command line.


/linker string

Give name of alternate linker. For string, the maximum length is 63 characters. The default string is mwld


/M+keyword[,...]

Passed to linker, this selects the libraries to link with.


NOTE

Libraries will be linked before all other objects. However, this may not be what you want.


Possible keywords include:

D  
link with mwcrtl.lib  
Dd  
link with mwcrtld.lib debug lib  
L  
link with ansicx86.lib  
Ld  
link with ansicx86d.lib debug lib  
G  
link with gdi32.lib  
K  
link with kernel32.lib  
U  
link with user32.lib  


/MM

Emit dependency map.


/noFail

Continue working after errors in earlier files.


/noSys

Treat #include <...> like #include "..."


/OI

Prevent header files from being processed more than once.


/P

Preprocess to file <source>.i


/pragma foober

Specify a pragma for the compilation. This could also be done in the source code using:

#pragma foober


/U+name

Undefined symbol name.


/X

Do not use standard system include paths, as specified by the environment variable %MWCIncludes%


/Yc+file

Generate precompiled header to file, recommended extension .mch


/Yu+file

Use precompiled header.


/Zs

Check syntax only, do not compile.


Language Control

This section contains information about command-line options for controlling language attributes of code compilation.


/[no]Bool

Enable C++ bool type, the true and false constants.


/EH+keyword[,...]

Enable C++ exception handling. This is done by default.

The following keyword possibilities may be used:

s  
use the CodeWarrior IDE zero-overhead synchronous exception handling, this is the default  
a  
use Microsoft-compatible asynchronous exception handling  


/Ge

Disable stack probing calls.


/Gs

Enable stack probing calls; size fixed at 4k, this is done by default.


/Gf

Enable string pooling; not exactly the same as in Visual C++ .


/GI[-]

Use int-sized enums, this is done by default.


/GR[-]

Enable run-time typing information. This is the default.


/GSr[-]

Reuse equivalent strings. This is the default.


/GX[-]

Enable C++ exception handling. This is done by default.


/J[-]

Make char variables unsigned.


/Jm

Enable multi-byte character encodings for source text, comments, and strings.


/R[-]

Require prototypes.


/T+keyword

Specify source language, using the following keywords:

C  
treat source as C unless its extension is .cp or .cpp. This is done by default.  
P  
treat source as C++ always  
Pe  
generate warnings for use of C++ features outside Embedded C++ subset (implies dialect cplus)  
O  
treat source as Objective-C  
c  
substituted with /TC  
p  
substituted with /TP  
pe  
substituted with /TPe  
o  
substituted with /To  


/trigraphs

Enable recognition of trigraphs


/ZA[-]

Turns on strict ANSI checking


/ZAr

Check code for ARM (Annotated C++ Reference Manual) conformance.


/Za

Disable language extensions.


/Ze

Enable extensions: redefining macros, allowing XXX::yyy syntax when declaring method yyy of class XXX, allowing extra commas, ignoring casts to the same type, treating function types with equivalent parameter lists but different return types as equal, allowing pointer-to-integer conversions, relaxed pointer conversions, and various syntactical differences.


/Zk[-]

Allow nonstandard keywords. This is done by default.


/Zw[-]

Enable wchar_t as a built-in C++ type. This is done by default.


Warning Options

This section contains information about command-line options for controlling error and warning message generation.


/W keyword[,...]

Tailors warning output, using the following keywords. The default is that all warnings are turned on.

0  
turn off all warnings  
1  
unused variables and arguments  
2  
/W1 + empty declarations  
3  
/W2 + extra commas  
4  
/W3 + hidden virtual functions  
5  
/W4 + non-inlined functions  
6  
/W5 + extended error checking  
7  
/W6 + large arguments passed to non-prototyped functions  
8  
/W7 + mixed use of struct/class  
9  
/W8 + illegal pragmas  
C[-]  
command-line warnings  
X  
treat warnings as errors  


x86 Compiler Options

The following x86 compiler options are available.


/GG

Use basic 80x86 instruction set; this is done by default.


/GM

Generate MMX instructions.


/G3D

Generate AMD® K6®-3D floating-point extensions; implies /GK6


/G3Dc

Use 3D-Now! MMX calling convention; implies /G3D


/G3

Target generic x86; define _M_IX86 to 300.


/G4

Target generic x86; define _M_IX86 to 400.


/GB

Target generic x86; define _M_IX86 to 500.


/G5

Target Pentium®.


/G6

Target Pentium Pro®.


/GP2

Target Pentium II®.


/GK6

Target AMD K6.


/O+keyword[,...]

Note that all options besides

-opt off|on|all|space|speed|level=...

are for backwards compatibility; other optimization options may be superseded by the use of -opt level=xxx.

To control optimization, you may combine options as in -O4,p

0|d  
disable optimizations; same as /opt level=0  
1  
same as /opt level=1  
2|g  
global optimizations; same as /opt level=2  
3  
same as /opt level=3  
4  
same as /opt level=4  
i  
enable inlining of intrinsic functions  
b0|b1|b2|b3|b4|b5|b6|b7|b8  
set level of inline expansion; 0=off  
ba  
auto-inline small functions (without 'inline' explicitly specified)  
D  
use deferred codegen; allows better inlining  
s  
same as /opt space  
t  
same as /opt speed  
x  
maximum optimizations, same as /O4,p,i,b8 /G6  


/OPT:keyword[,...]

Specify optimization options:

off|none  
suppress all optimizations; this is done by default  
on  
same as /opt level=2  
all|full  
same as /opt speed,level=4  
[no]space  
optimize for space  
[no]speed  
optimize for speed  
l[evel]=num  
set optimization level:   level 0: global register allocation only for temporary values   level 1: adds dead code elimination   level 2: adds common sub-expression elimination and copy propagation   level 3: adds loop transformations, strength reduction, and loop-invariant code motion   level 4: adds repeated common sub-expression elimination and loop-invariant code motion; for 'num', range 0 - 4; default is 0  
[no]cse  
common sub-expression elimination  
[no]commonsubs  
common sub-expression elimination  
[no]deadcode  
removal of dead code  
[no]deadstore  
removal of dead assignments  
[no]lifetimes  
computation of variable lifetimes  
[no]loop
[invariants]
 
removal of loop invariants  
[no]prop
[agation]
 
propagation of constant and copy assignments  
[no]strength  
strength reduction; reducing multiplication by an index variable into addition  
[no]dead  
same as -opt [no]deadcode and [no]deadstore  
[no]schedule  
schedule instructions; see also the command-line option -proc[essor] keyword  
[no]peep[hole]  
peephole optimization  
[no]functions  
function epilogue/prologue  
display  
display list of active optimizations  
dump  
display list of active optimizations  
[no]dead  
same as /opt [no]deadcode and [no]deadstore  
[no]peep[hole]  
peephole optimization  
[no]color[ing]  
register coloring  
[no]intrinsics  
inlining of intrinsic functions  
[no]debug  
disable some optimizations for saner debugging  
[no]schedule  
perform instruction scheduling  
[no]vectorize
[loops]
 
vectorize loops with MMX SIMD instructions; implies /proc pII and /inst mmx  


/Zp+keyword[,...]

Specify structure and array alignment options:

1|byte|
packed  
byte alignment  
2  
short alignment  
4  
long alignment; default  
8  
double-word (floating double) alignment  
16  
quadword alignment  
array
[members]  
align array members  


x86 Linker Options

The following x86 linker options are available.


/BASE:address

Set loading address for image; default is 0x400000


/COMMANDFILE:file

Use command file to process exports, etc.; for file, maximum length 63 chars; default is none.


/DEF

Use given linker definitions file; note: extension must be .DEF


/ENTRY:symbol

Set main entry point for application or shared library; for symbol, maximum length 63 chars; default is none.


/EXPORT:keyword

Specify export options:

none  
do not export any symbols  
all  
export all symbols, except for temporaries  
pragma|dllexport  
export only symbols marked with #pragmaexport or __declspec(dllexport). This is the default.  
sym=name  
export a specific symbol, which could conceivably conflict with the /export option. Note that /export sym=name1,name2 is the same as /export sym=name1 and /export name2.
...
[=flags]
 
export given symbols, optionally with flags in the form /export exportname="[\= internalname][@<enumeration#>] [DATA] [PRIVATE][NONAME]. To export a symbol whose name is also an /export option, use /exportsym=name.

 


/EXPORTFILE:file

Specify export file, which must be namedfile.def.

If existing, file contains list of symbols to export (separated by new lines). If not existing, linker writes all exportable symbols to file.

This overrides /export none|all|pragma but complements the /export <name>[,...] option.


/HEAP:reserve[,commit]

Specify maximum size of heap in kilobytes to reserve; default is 1024; if a parameter specified, size of heap to commit. The default is 4.


/NOENTRY

Do not use an entry point.


/STACK:reserve[,commit]

Specify maximum size of stack in kilobytes to reserve; default is 1024; if parameter specified, stack space to commit. The default is 4.


/SUBSYSTEM:keyword

Specify subsystem keyword:

windows  
Windows GUI  
console  
Windows CUI  
wince  
WindowsCE GUI  
native  
native; entry point is _main  
unknown|
auto  
unknown; choose subsystem based on available standard entry points. This is the default.  


/SUBSYSID:major,minor

Specify subsystem ID; default is 4,0.


/USERID:major,minor

Specify user ID; default is 0,0.


Win32 x86 Linker

The following Win32 x86 linker options are available.


/APP

Emit an application binary file.


/BASE:address

Set loading address for image; default is 0x40000000.


/COMMANDFILE:file

Use command file to process exports, etc.; for file, maximum length 63 chars; default is none.


/DEF

Use given linker definitions file, note that the extension must be .DEF.


/DEFAULTLIB:file[;...]

Search library paths for library in form lib<file>.<ext> where <ext> is .LIB or .DLL. This search path is added before system libraries (see/NODEFAULTS).


/DIS[ASM]

Disassemble object code.


/DLL

Emit a DLL.


/ENTRY:symbol

Set main entry point for application or shared library. For symbol, maximum length 63 chars; default is none.


/EXPORT:keyword

Specify export options with these keywords:

none  
do not export any symbols  
all  
export all symbols, except for temporaries  
pragma|
dllexport
 
export only symbols marked with #pragma exportor__declspec(dllexport). This is the default.  
sym=name  
export a specific symbol which may possibly conflict with an /export option. Note that /export sym=name1,name2 is the same as /export sym=name1 and /export name2.  
...
[=flags]
 
export given symbols, optionally with flags in the form /export exportname="[\= internalname] [@<enumeration#>] [DATA] [PRIVATE] [NONAME] to export a symbol whose name is also an /export option, use /export sym=<name>.  


/EXPORTFILE:file

Specify export file, which must be named<file>.def. If existing, file contains list of symbols to export (separated by new lines); if not existing, linker writes all exportable symbols to file. This overrides the option /export none|all|pragma but complements the option /export <name>[,...].


/HEAP:reserve[,commit]

Specify maximum size of heap in kilobytes to reserve; default is 1024; if parameter specified, size of heap to commit; default is 4.


/LIB

Generate a static library.


/LIBPATH:path[;...]

Add library search paths. The default is to search current working directory and then system directories (see '/X'); search paths have global scope over the command line and are searched in the order given.


/MAP[:filename]

Generate link map file; default name is generated by adding .MAP to <outfile>; if parameter specified, output to filename.


/NODEFAULTS

Do not use system library files or system paths; by default the environment variable %MWLibraries% contains system paths to search and the environment variable %MWLibraryFiles% contains a list of system libraries to link; both lists contain items separated by ';'


/NOENTRY

Do not use an entry point.


/OUT:filename

Specify output filename.


/OUTSYM:filename

Output SYM file information to filename (recommended extension .xSYM); default name is <outfile>.?SYM


/STACK:reserve[,commit]

Specify maximum size of stack in kilobytes to reserve; default is 1024; if parameter specified, stack space to commit; default is4.


/WARN:keyword[,...]

Set warning options, with possible keywords to include:

0  
turn off all warnings  
1|2|3|4|5|6|7|8  
all warnings except for command-line usage  
1|2|3|4|5|6|7|8  
all warnings; default  
9  
treat warnings as errors  


/SUBSYSTEM:keyword

Specify subsystem using these keywords:

windows  
Windows GUI  
console  
Windows CUI  
wince  
WindowsCE GUI  
native  
native; entry point is _main  
unknown|
auto
 
unknown; choose subsystem based on available standard entry points. This is the default.  


/SUBSYSID:major,minor

Specify subsystem ID; default is 4,0.


/USERID:major,minor

Specify user ID; default is 0,0.


x86 Compiler Debugging Options

The following x86 compiler debugger options are available.


/DEBUG

Generate debugging information.


/DEBUGTYPE:keyword[,...]

Specify debugging keyword options are:

off  
do not generate debugging information. This is the default.  
on  
turn on debugging information.  
coff  
substituted with /DEBUGTYPE:cv  
cv[-]  
store debug info in CodeView 5.0 format, this is the default.  
cw[-]  
store debug info in CodeWarrior symbolic (.SYM) format  


/SYM

Specify debugging keyword options are:

off  
do not generate debugging information. This is the default.  
on  
turn on debugging information.  
coff  
substituted with /DEBUGTYPE:cv  
cv[-]  
store debug info in CodeView 5.0 format, this is the default.  
cw[-]  
store debug info in CodeWarrior symbolic (.SYM) format  


/Yd

Generate debugging information.


/Zd

Generate debugging information.


/Zi

Generate debugging information.


x86 Linker Debugger Options

The following x86 linker debugger options are available.


/DEBUG

Generate debugging information.


/DEBUGTYPE:keyword[,...]

Specify debugging keyword options are:

off  
do not generate debugging information. This is the default.  
on  
turn on debugging information.  
coff  
substituted with /DEBUGTYPE:cv  
cv[-]  
store debug info in CodeView 5.0 format, this is the default.  
cw[-]  
store debug info in CodeWarrior symbolic (.SYM) format  


/SYM

Specify debugging keyword options are:

off  
do not generate debugging information. This is the default.  
on  
turn on debugging information.  
coff  
substituted with /DEBUGTYPE:cv  
cv[-]  
store debug info in CodeView 5.0 format, this is the default.  
cw[-]  
store debug info in CodeWarrior symbolic (.SYM) format  


x86 Assembler Debugger Options

The following x86 assembler debugger options are available.


-g

Generate debugging information, same as -sym full.


-sym keyword[,...]

Specify debugging options:

on  
turn on debugging information, store filenames in object  
off  
do not generate debugging information. This is the default.  
[no]
codeview
 
store debug info in CodeView 5.0 format (default)  
[no]cv[5]  
store debug info in CodeView 5.0 format  
[no]cw
[sym]
 
store debug info in CodeWarrior symbolic (.SYM) format  
[no]sym  
store debug info in CodeWarrior symbolic (.SYM) format  

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000