- -iprefix prefix
- Specify prefix as the prefix for subsequent -iwithprefix options. If the prefix represents a directory, you should include the final /.
- -iwithprefix dir
- -iwithprefixbefore dir
- Append dir to the prefix specified previously with -iprefix, and add the resulting directory to the include search path. -iwithprefixbefore puts it in the same place -I would; -iwithprefix puts it where -idirafter would.
- -isysroot dir
- This option is like the --sysroot option, but applies only to header files. See the --sysroot option for more information.
- -imultilib dir
- Use dir as a subdirectory of the directory containing target-specific C++ headers.
- -isystem dir
- Search dir for header files, after all directories specified by -I but before the standard system directories. Mark it as a system directory, so that it gets the same special treatment as is applied to the standard system directories. If dir begins with "=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot.
- -iquote dir
- Search dir only for header files requested with "#include "file""; they are not searched for "#include <file>", before all directories specified by -I and before the standard system directories. If dir begins with "=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot.
- -fdirectives-only
-
When preprocessing, handle directives, but do not expand macros.
The option's behavior depends on the -E and -fpreprocessed options.
With -E, preprocessing is limited to the handling of directives such as "#define", "#ifdef", and "#error". Other preprocessor operations, such as macro expansion and trigraph conversion are not performed. In addition, the -dD option is implicitly enabled.
With -fpreprocessed, predefinition of command line and most builtin macros is disabled. Macros such as "__LINE__", which are contextually dependent, are handled normally. This enables compilation of files previously preprocessed with "-E -fdirectives-only".
With both -E and -fpreprocessed, the rules for -fpreprocessed take precedence. This enables full preprocessing of files previously preprocessed with "-E -fdirectives-only".
- -fdollars-in-identifiers
- Accept $ in identifiers.
- -fextended-identifiers
- Accept universal character names in identifiers. This option is experimental; in a future version of GCC, it will be enabled by default for C99 and C++.
- -fpreprocessed
-
Indicate to the preprocessor that the input file has already been
preprocessed. This suppresses things like macro expansion, trigraph
conversion, escaped newline splicing, and processing of most directives.
The preprocessor still recognizes and removes comments, so that you can
pass a file preprocessed with -C to the compiler without
problems. In this mode the integrated preprocessor is little more than
a tokenizer for the front ends.
-fpreprocessed is implicit if the input file has one of the extensions .i, .ii or .mi. These are the extensions that GCC uses for preprocessed files created by -save-temps.
- -ftabstop=width
- Set the distance between tab stops. This helps the preprocessor report correct column numbers in warnings or errors, even if tabs appear on the line. If the value is less than 1 or greater than 100, the option is ignored. The default is 8.
- -fexec-charset=charset
- Set the execution character set, used for string and character constants. The default is UTF-8. charset can be any encoding supported by the system's "iconv" library routine.
- -fwide-exec-charset=charset
- Set the wide execution character set, used for wide string and character constants. The default is UTF-32 or UTF-16, whichever corresponds to the width of "wchar_t". As with -fexec-charset, charset can be any encoding supported by the system's "iconv" library routine; however, you will have problems with encodings that do not fit exactly in "wchar_t".
- -finput-charset=charset
- Set the input character set, used for translation from the character set of the input file to the source character set used by GCC. If the locale does not specify, or GCC cannot get this information from the locale, the default is UTF-8. This can be overridden by either the locale or this command line option. Currently the command line option takes precedence if there's a conflict. charset can be any encoding supported by the system's "iconv" library routine.
- -fworking-directory
- Enable generation of linemarkers in the preprocessor output that will let the compiler know the current working directory at the time of preprocessing. When this option is enabled, the preprocessor will emit, after the initial linemarker, a second linemarker with the current working directory followed by two slashes. GCC will use this directory, when it's present in the preprocessed input, as the directory emitted as the current working directory in some debugging information formats. This option is implicitly enabled if debugging information is enabled, but this can be inhibited with the negated form -fno-working-directory. If the -P flag is present in the command line, this option has no effect, since no "#line" directives are emitted whatsoever.
- -fno-show-column
- Do not print column numbers in diagnostics. This may be necessary if diagnostics are being scanned by a program that does not understand the column numbers, such as dejagnu.
- -A predicate=answer
- Make an assertion with the predicate predicate and answer answer. This form is preferred to the older form -A predicate(answer), which is still supported, because it does not use shell special characters.
- -A -predicate=answer
- Cancel an assertion with the predicate predicate and answer answer.
- -dCHARS
-
CHARS is a sequence of one or more of the following characters,
and must not be preceded by a space. Other characters are interpreted
by the compiler proper, or reserved for future versions of GCC, and so
are silently ignored. If you specify characters whose behavior
conflicts, the result is undefined.
-
- M
-
Instead of the normal output, generate a list of #define
directives for all the macros defined during the execution of the
preprocessor, including predefined macros. This gives you a way of
finding out what is predefined in your version of the preprocessor.
Assuming you have no file foo.h, the command
touch foo.h; cpp -dM foo.h
will show all the predefined macros.
If you use -dM without the -E option, -dM is interpreted as a synonym for -fdump-rtl-mach.
- D
- Like M except in two respects: it does not include the predefined macros, and it outputs both the #define directives and the result of preprocessing. Both kinds of output go to the standard output file.
- N
- Like D, but emit only the macro names, not their expansions.
- I
- Output #include directives in addition to the result of preprocessing.
- U
- Like D except that only macros that are expanded, or whose definedness is tested in preprocessor directives, are output; the output is delayed until the use or test of the macro; and #undef directives are also output for macros tested but undefined at the time.
-
- -P
- Inhibit generation of linemarkers in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code, and will be sent to a program which might be confused by the linemarkers.
- -C
-
Do not discard comments. All comments are passed through to the output
file, except for comments in processed directives, which are deleted
along with the directive.
You should be prepared for side effects when using -C; it causes the preprocessor to treat comments as tokens in their own right. For example, comments appearing at the start of what would be a directive line have the effect of turning that line into an ordinary source line, since the first token on the line is no longer a #.
- -CC
-
Do not discard comments, including during macro expansion. This is
like -C, except that comments contained within macros are
also passed through to the output file where the macro is expanded.
In addition to the side-effects of the -C option, the -CC option causes all C++-style comments inside a macro to be converted to C-style comments. This is to prevent later use of that macro from inadvertently commenting out the remainder of the source line.
The -CC option is generally used to support lint comments.
- -traditional-cpp
- Try to imitate the behavior of old-fashioned C preprocessors, as opposed to ISO C preprocessors.
- -trigraphs
-
Process trigraph sequences.
These are three-character sequences, all starting with ??, that
are defined by ISO C to stand for single characters. For example,
??/ stands for \, so '??/n' is a character
constant for a newline. By default, GCC ignores trigraphs, but in
standard-conforming modes it converts them. See the -std and
-ansi options.
The nine trigraphs and their replacements are
Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??- Replacement: [ ] { } # \ ^ | ~
- -remap
- Enable special code to work around file systems which only permit very short file names, such as MS-DOS.
- --help
- --target-help
- Print text describing all the command line options instead of preprocessing anything.
- -v
- Verbose mode. Print out GNU CPP's version number at the beginning of execution, and report the final form of the include path.
- -H
- Print the name of each header file used, in addition to other normal activities. Each name is indented to show how deep in the #include stack it is. Precompiled header files are also printed, even if they are found to be invalid; an invalid precompiled header file is printed with ...x and a valid one with ...! .
- -version
- --version
- Print out GNU CPP's version number. With one dash, proceed to preprocess as normal. With two dashes, exit immediately.
Passing Options to the Assembler
You can pass options to the assembler.- -Wa,option
- Pass option as an option to the assembler. If option contains commas, it is split into multiple options at the commas.
- -Xassembler option
-
Pass option as an option to the assembler. You can use this to
supply system-specific assembler options which GCC does not know how to
recognize.
If you want to pass an option that takes an argument, you must use -Xassembler twice, once for the option and once for the argument.
Options for Linking
These options come into play when the compiler links object files into an executable output file. They are meaningless if the compiler is not doing a link step.- object-file-name
- A file name that does not end in a special recognized suffix is considered to name an object file or library. (Object files are distinguished from libraries by the linker according to the file contents.) If linking is done, these object files are used as input to the linker.
- -c
- -S
- -E
- If any of these options is used, then the linker is not run, and object file names should not be used as arguments.
- -llibrary
- -l library
-
Search the library named library when linking. (The second
alternative with the library as a separate argument is only for
POSIX compliance and is not recommended.)
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches library z after file foo.o but before bar.o. If bar.o refers to functions in z, those functions may not be loaded.
The linker searches a standard list of directories for the library, which is actually a file named liblibrary.a. The linker then uses this file as if it had been specified precisely by name.
The directories searched include several standard system directories plus any that you specify with -L.
Normally the files found this way are library files---archive files whose members are object files. The linker handles an archive file by scanning through it for members which define symbols that have so far been referenced but not defined. But if the file that is found is an ordinary object file, it is linked in the usual fashion. The only difference between using an -l option and specifying a file name is that -l surrounds library with lib and .a and searches several directories.
- -lobjc
- You need this special case of the -l option in order to link an Objective-C or Objective-C++ program.
- -nostartfiles
- Do not use the standard system startup files when linking. The standard system libraries are used normally, unless -nostdlib or -nodefaultlibs is used.
- -nodefaultlibs
- Do not use the standard system libraries when linking. Only the libraries you specify will be passed to the linker. The standard startup files are used normally, unless -nostartfiles is used. The compiler may generate calls to "memcmp", "memset", "memcpy" and "memmove". These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified.
- -nostdlib
-
Do not use the standard system startup files or libraries when linking.
No startup files and only the libraries you specify will be passed to
the linker. The compiler may generate calls to "memcmp", "memset",
"memcpy" and "memmove".
These entries are usually resolved by entries in
libc. These entry points should be supplied through some other
mechanism when this option is specified.
One of the standard libraries bypassed by -nostdlib and -nodefaultlibs is libgcc.a, a library of internal subroutines that GCC uses to overcome shortcomings of particular machines, or special needs for some languages.
In most cases, you need libgcc.a even when you want to avoid other standard libraries. In other words, when you specify -nostdlib or -nodefaultlibs you should usually specify -lgcc as well. This ensures that you have no unresolved references to internal GCC library subroutines. (For example, __main, used to ensure C++ constructors will be called.)
- -pie
- Produce a position independent executable on targets which support it. For predictable results, you must also specify the same set of options that were used to generate code (-fpie, -fPIE, or model suboptions) when you specify this option.
- -rdynamic
- Pass the flag -export-dynamic to the ELF linker, on targets that support it. This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. This option is needed for some uses of "dlopen" or to allow obtaining backtraces from within a program.
- -s
- Remove all symbol table and relocation information from the executable.
- -static
- On systems that support dynamic linking, this prevents linking with the shared libraries. On other systems, this option has no effect.
- -shared
- Produce a shared object which can then be linked with other objects to form an executable. Not all systems support this option. For predictable results, you must also specify the same set of options that were used to generate code (-fpic, -fPIC, or model suboptions) when you specify this option.[1]
- -shared-libgcc
- -static-libgcc
-
On systems that provide libgcc as a shared library, these options
force the use of either the shared or static version respectively.
If no shared version of libgcc was built when the compiler was
configured, these options have no effect.
There are several situations in which an application should use the shared libgcc instead of the static version. The most common of these is when the application wishes to throw and catch exceptions across different shared libraries. In that case, each of the libraries as well as the application itself should use the shared libgcc.
Therefore, the G++ and GCJ drivers automatically add -shared-libgcc whenever you build a shared library or a main executable, because C++ and Java programs typically use exceptions, so this is the right thing to do.
If, instead, you use the GCC driver to create shared libraries, you may find that they will not always be linked with the shared libgcc. If GCC finds, at its configuration time, that you have a non-GNU linker or a GNU linker that does not support option --eh-frame-hdr, it will link the shared version of libgcc into shared libraries by default. Otherwise, it will take advantage of the linker and optimize away the linking with the shared version of libgcc, linking with the static version of libgcc by default. This allows exceptions to propagate through such shared libraries, without incurring relocation costs at library load time.
However, if a library or main executable is supposed to throw or catch exceptions, you must link it using the G++ or GCJ driver, as appropriate for the languages used in the program, or using the option -shared-libgcc, such that it is linked with the shared libgcc.
- -symbolic
- Bind references to global symbols when building a shared object. Warn about any unresolved references (unless overridden by the link editor option -Xlinker -z -Xlinker defs). Only a few systems support this option.
- -T script
- Use script as the linker script. This option is supported by most systems using the GNU linker. On some targets, such as bare-board targets without an operating system, the -T option may be required when linking to avoid references to undefined symbols.
- -Xlinker option
-
Pass option as an option to the linker. You can use this to
supply system-specific linker options which GCC does not know how to
recognize.
If you want to pass an option that takes a separate argument, you must use -Xlinker twice, once for the option and once for the argument. For example, to pass -assert definitions, you must write -Xlinker -assert -Xlinker definitions. It does not work to write -Xlinker ``-assert definitions'', because this passes the entire string as a single argument, which is not what the linker expects.
When using the GNU linker, it is usually more convenient to pass arguments to linker options using the option=value syntax than as separate arguments. For example, you can specify -Xlinker -Map=output.map rather than -Xlinker -Map -Xlinker output.map. Other linkers may not support this syntax for command-line options.
- -Wl,option
- Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, -Wl,-Map,output.map passes -Map output.map to the linker. When using the GNU linker, you can also get the same effect with -Wl,-Map=output.map.
- -u symbol
- Pretend the symbol symbol is undefined, to force linking of library modules to define it. You can use -u multiple times with different symbols to force loading of additional library modules.
Options for Directory Search
These options specify directories to search for header files, for libraries and for parts of the compiler:- -Idir
-
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.
If a standard system include directory, or a directory specified with -isystem, is also specified with -I, the -I option will be ignored. The directory will still be searched but as a system directory at its normal position in the system include chain. This is to ensure that GCC's procedure to fix buggy system headers and the ordering for the include_next directive are not inadvertently changed. If you really need to change the search order for system directories, use the -nostdinc and/or -isystem options.
- -iquotedir
- Add the directory dir to the head of the list of directories to be searched for header files only for the case of #include "file"; they are not searched for #include <file>, otherwise just like -I.
- -Ldir
- Add directory dir to the list of directories to be searched for -l.
- -Bprefix
-
This option specifies where to find the executables, libraries,
include files, and data files of the compiler itself.
The compiler driver program runs one or more of the subprograms cpp, cc1, as and ld. It tries prefix as a prefix for each program it tries to run, both with and without machine/version/.
For each subprogram to be run, the compiler driver first tries the -B prefix, if any. If that name is not found, or if -B was not specified, the driver tries two standard prefixes, which are /usr/lib/gcc/ and /usr/local/lib/gcc/. If neither of those results in a file name that is found, the unmodified program name is searched for using the directories specified in your PATH environment variable.
The compiler will check to see if the path provided by the -B refers to a directory, and if necessary it will add a directory separator character at the end of the path.
-B prefixes that effectively specify directory names also apply to libraries in the linker, because the compiler translates these options into -L options for the linker. They also apply to includes files in the preprocessor, because the compiler translates these options into -isystem options for the preprocessor. In this case, the compiler appends include to the prefix.
The run-time support file libgcc.a can also be searched for using the -B prefix, if needed. If it is not found there, the two standard prefixes above are tried, and that is all. The file is left out of the link if it is not found by those means.
Another way to specify a prefix much like the -B prefix is to use the environment variable GCC_EXEC_PREFIX.
As a special kludge, if the path provided by -B is [dir/]stageN/, where N is a number in the range 0 to 9, then it will be replaced by [dir/]include. This is to help with boot-strapping the compiler.
- -specs=file
- Process file after the compiler reads in the standard specs file, in order to override the defaults that the gcc driver program uses when determining what switches to pass to cc1, cc1plus, as, ld, etc. More than one -specs=file can be specified on the command line, and they are processed in order, from left to right.
- --sysroot=dir
-
Use dir as the logical root directory for headers and libraries.
For example, if the compiler would normally search for headers in
/usr/include and libraries in /usr/lib, it will instead
search dir/usr/include and dir/usr/lib.
If you use both this option and the -isysroot option, then the --sysroot option will apply to libraries, but the -isysroot option will apply to header files.
The GNU linker (beginning with version 2.16) has the necessary support for this option. If your linker does not support this option, the header file aspect of --sysroot will still work, but the library aspect will not.
- -I-
-
This option has been deprecated. Please use -iquote instead for
-I directories before the -I- and remove the -I-.
Any directories you specify with -I options before the -I-
option are searched only for the case of #include "file";
they are not searched for #include <file>.
If additional directories are specified with -I options after the -I-, these directories are searched for all #include directives. (Ordinarily all -I directories are used this way.)
In addition, the -I- option inhibits the use of the current directory (where the current input file came from) as the first search directory for #include "file". There is no way to override this effect of -I-. With -I. you can specify searching the directory which was current when the compiler was invoked. That is not exactly the same as what the preprocessor does by default, but it is often satisfactory.
-I- does not inhibit the use of the standard system directories for header files. Thus, -I- and -nostdinc are independent.
Specifying Target Machine and Compiler Version
The usual way to run GCC is to run the executable called gcc, or <machine>-gcc when cross-compiling, or <machine>-gcc-<version> to run a version other than the one that was installed last. Sometimes this is inconvenient, so GCC provides options that will switch to another cross-compiler or version.- -b machine
-
The argument machine specifies the target machine for compilation.
The value to use for machine is the same as was specified as the machine type when configuring GCC as a cross-compiler. For example, if a cross-compiler was configured with configure arm-elf, meaning to compile for an arm processor with elf binaries, then you would specify -b arm-elf to run that cross compiler. Because there are other options beginning with -b, the configuration must contain a hyphen, or -b alone should be one argument followed by the configuration in the next argument.
- -V version
- The argument version specifies which version of GCC to run. This is useful when multiple versions are installed. For example, version might be 4.0, meaning to run GCC version 4.0.
The -V and -b options work by running the <machine>-gcc-<version> executable, so there's no real reason to use them if you can just run that directly.
Hardware Models and Configurations
Earlier we discussed the standard option -b which chooses among different installed compilers for completely different target machines, such as VAX vs. 68000 vs. 80386.In addition, each of these target machine types can have its own special options, starting with -m, to choose among various hardware models or configurations---for example, 68010 vs 68020, floating coprocessor or none. A single installed version of the compiler can compile for any model or configuration, according to the options specified.
Some configurations of the compiler also support additional special options, usually for compatibility with other compilers on the same platform.
ARC Options
These options are defined for ARC implementations:- -EL
- Compile code for little endian mode. This is the default.
- -EB
- Compile code for big endian mode.
- -mmangle-cpu
- Prepend the name of the cpu to all public symbol names. In multiple-processor systems, there are many ARC variants with different instruction and register set characteristics. This flag prevents code compiled for one cpu to be linked with code compiled for another. No facility exists for handling variants that are ``almost identical''. This is an all or nothing option.
- -mcpu=cpu
- Compile code for ARC variant cpu. Which variants are supported depend on the configuration. All variants support -mcpu=base, this is the default.
- -mtext=text-section
- -mdata=data-section
- -mrodata=readonly-data-section
- Put functions, data, and readonly data in text-section, data-section, and readonly-data-section respectively by default. This can be overridden with the "section" attribute.
- -mfix-cortex-m3-ldrd
- Some Cortex-M3 cores can cause data corruption when "ldrd" instructions with overlapping destination and base registers are used. This option avoids generating these instructions. This option is enabled by default when -mcpu=cortex-m3 is specified.
ARM Options
These -m options are defined for Advanced RISC Machines (ARM) architectures:- -mabi=name
- Generate code for the specified ABI. Permissible values are: apcs-gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
- -mapcs-frame
- Generate a stack frame that is compliant with the ARM Procedure Call Standard for all functions, even if this is not strictly necessary for correct execution of the code. Specifying -fomit-frame-pointer with this option will cause the stack frames not to be generated for leaf functions. The default is -mno-apcs-frame.
- -mapcs
- This is a synonym for -mapcs-frame.
- -mthumb-interwork
- Generate code which supports calling between the ARM and Thumb instruction sets. Without this option the two instruction sets cannot be reliably used inside one program. The default is -mno-thumb-interwork, since slightly larger code is generated when -mthumb-interwork is specified.
- -mno-sched-prolog
- Prevent the reordering of instructions in the function prolog, or the merging of those instruction with the instructions in the function's body. This means that all functions will start with a recognizable set of instructions (or in fact one of a choice from a small set of different function prologues), and this information can be used to locate the start if functions inside an executable piece of code. The default is -msched-prolog.
- -mfloat-abi=name
-
Specifies which floating-point ABI to use. Permissible values
are: soft, softfp and hard.
Specifying soft causes GCC to generate output containing library calls for floating-point operations. softfp allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions. hard allows generation of floating-point instructions and uses FPU-specific calling conventions.
Using -mfloat-abi=hard with VFP coprocessors is not supported. Use -mfloat-abi=softfp with the appropriate -mfpu option to allow the compiler to generate code that makes use of the hardware floating-point capabilities for these CPUs.
The default depends on the specific target configuration. Note that the hard-float and soft-float ABIs are not link-compatible; you must compile your entire program with the same ABI, and link with a compatible set of libraries.
- -mhard-float
- Equivalent to -mfloat-abi=hard.
- -msoft-float
- Equivalent to -mfloat-abi=soft.
- -mlittle-endian
- Generate code for a processor running in little-endian mode. This is the default for all standard configurations.
- -mbig-endian
- Generate code for a processor running in big-endian mode; the default is to compile code for a little-endian processor.
- -mwords-little-endian
- This option only applies when generating code for big-endian processors. Generate code for a little-endian word order but a big-endian byte order. That is, a byte order of the form 32107654. Note: this option should only be used if you require compatibility with code for big-endian ARM processors generated by versions of the compiler prior to 2.8.
- -mcpu=name
- This specifies the name of the target ARM processor. GCC uses this name to determine what kind of instructions it can emit when generating assembly code. Permissible names are: arm2, arm250, arm3, arm6, arm60, arm600, arm610, arm620, arm7, arm7m, arm7d, arm7dm, arm7di, arm7dmi, arm70, arm700, arm700i, arm710, arm710c, arm7100, arm720, arm7500, arm7500fe, arm7tdmi, arm7tdmi-s, arm710t, arm720t, arm740t, strongarm, strongarm110, strongarm1100, strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s, arm1176jz-s, arm1176jzf-s, cortex-a8, cortex-a9, cortex-r4, cortex-r4f, cortex-m3, cortex-m1, xscale, iwmmxt, iwmmxt2, ep9312.
- -mtune=name
- This option is very similar to the -mcpu= option, except that instead of specifying the actual target processor type, and hence restricting which instructions can be used, it specifies that GCC should tune the performance of the code as if the target were of the type specified in this option, but still choosing the instructions that it will generate based on the cpu specified by a -mcpu= option. For some ARM implementations better performance can be obtained by using this option.
- -march=name
- This specifies the name of the target ARM architecture. GCC uses this name to determine what kind of instructions it can emit when generating assembly code. This option can be used in conjunction with or instead of the -mcpu= option. Permissible names are: armv2, armv2a, armv3, armv3m, armv4, armv4t, armv5, armv5t, armv5e, armv5te, armv6, armv6j, armv6t2, armv6z, armv6zk, armv6-m, armv7, armv7-a, armv7-r, armv7-m, iwmmxt, iwmmxt2, ep9312.
- -mfpu=name
- -mfpe=number
- -mfp=number
-
This specifies what floating point hardware (or hardware emulation) is
available on the target. Permissible names are: fpa, fpe2,
fpe3, maverick, vfp, vfpv3, vfpv3-d16 and
neon. -mfp and -mfpe
are synonyms for -mfpu=fpenumber, for compatibility
with older versions of GCC.
If -msoft-float is specified this specifies the format of floating point values.
- -mstructure-size-boundary=n
-
The size of all structures and unions will be rounded up to a multiple
of the number of bits set by this option. Permissible values are 8, 32
and 64. The default value varies for different toolchains. For the COFF
targeted toolchain the default value is 8. A value of 64 is only allowed
if the underlying ABI supports it.
Specifying the larger number can produce faster, more efficient code, but can also increase the size of the program. Different values are potentially incompatible. Code compiled with one value cannot necessarily expect to work with code or libraries compiled with another value, if they exchange information using structures or unions.
- -mabort-on-noreturn
- Generate a call to the function "abort" at the end of a "noreturn" function. It will be executed if the function tries to return.
- -mlong-calls
- -mno-long-calls
-
Tells the compiler to perform function calls by first loading the
address of the function into a register and then performing a subroutine
call on this register. This switch is needed if the target function
will lie outside of the 64 megabyte addressing range of the offset based
version of subroutine call instruction.
Even if this switch is enabled, not all function calls will be turned into long calls. The heuristic is that static functions, functions which have the short-call attribute, functions that are inside the scope of a #pragma no_long_calls directive and functions whose definitions have already been compiled within the current compilation unit, will not be turned into long calls. The exception to this rule is that weak function definitions, functions with the long-call attribute or the section attribute, and functions that are within the scope of a #pragma long_calls directive, will always be turned into long calls.
This feature is not enabled by default. Specifying -mno-long-calls will restore the default behavior, as will placing the function calls within the scope of a #pragma long_calls_off directive. Note these switches have no effect on how the compiler generates code to handle function calls via function pointers.
- -msingle-pic-base
- Treat the register used for PIC addressing as read-only, rather than loading it in the prologue for each function. The run-time system is responsible for initializing this register with an appropriate value before execution begins.
- -mpic-register=reg
- Specify the register to be used for PIC addressing. The default is R10 unless stack-checking is enabled, when R9 is used.
- -mcirrus-fix-invalid-insns
- Insert NOPs into the instruction stream to in order to work around problems with invalid Maverick instruction combinations. This option is only valid if the -mcpu=ep9312 option has been used to enable generation of instructions for the Cirrus Maverick floating point co-processor. This option is not enabled by default, since the problem is only present in older Maverick implementations. The default can be re-enabled by use of the -mno-cirrus-fix-invalid-insns switch.
- -mpoke-function-name
-
Write the name of each function into the text section, directly
preceding the function prologue. The generated code is similar to this:
t0 .ascii "arm_poke_function_name", 0 .align t1 .word 0xff000000 + (t1 - t0) arm_poke_function_name mov ip, sp stmfd sp!, {fp, ip, lr, pc} sub fp, ip, #4
When performing a stack backtrace, code can inspect the value of "pc" stored at "fp + 0". If the trace function then looks at location "pc - 12" and the top 8 bits are set, then we know that there is a function name embedded immediately preceding this location and has length "((pc[-3]) & 0xff000000)".
- -mthumb
- Generate code for the Thumb instruction set. The default is to use the 32-bit ARM instruction set. This option automatically enables either 16-bit Thumb-1 or mixed 16/32-bit Thumb-2 instructions based on the -mcpu=name and -march=name options.
- -mtpcs-frame
- Generate a stack frame that is compliant with the Thumb Procedure Call Standard for all non-leaf functions. (A leaf function is one that does not call any other functions.) The default is -mno-tpcs-frame.
- -mtpcs-leaf-frame
- Generate a stack frame that is compliant with the Thumb Procedure Call Standard for all leaf functions. (A leaf function is one that does not call any other functions.) The default is -mno-apcs-leaf-frame.
- -mcallee-super-interworking
- Gives all externally visible functions in the file being compiled an ARM instruction set header which switches to Thumb mode before executing the rest of the function. This allows these functions to be called from non-interworking code.
- -mcaller-super-interworking
- Allows calls via function pointers (including virtual functions) to execute correctly regardless of whether the target code has been compiled for interworking or not. There is a small overhead in the cost of executing a function pointer if this option is enabled.
- -mtp=name
- Specify the access model for the thread local storage pointer. The valid models are soft, which generates calls to "__aeabi_read_tp", cp15, which fetches the thread pointer from "cp15" directly (supported in the arm6k architecture), and auto, which uses the best available method for the selected processor. The default setting is auto.
- -mword-relocations
- Only generate absolute relocations on word sized values (i.e. R_ARM_ABS32). This is enabled by default on targets (uClinux, SymbianOS) where the runtime loader imposes this restriction, and when -fpic or -fPIC is specified.
AVR Options
These options are defined for AVR implementations:- -mmcu=mcu
-
Specify ATMEL AVR instruction set or MCU type.
Instruction set avr1 is for the minimal AVR core, not supported by the C compiler, only for assembler programs (MCU types: at90s1200, attiny10, attiny11, attiny12, attiny15, attiny28).
Instruction set avr2 (default) is for the classic AVR core with up to 8K program memory space (MCU types: at90s2313, at90s2323, attiny22, at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, at90c8534, at90s8535).
Instruction set avr3 is for the classic AVR core with up to 128K program memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
Instruction set avr4 is for the enhanced AVR core with up to 8K program memory space (MCU types: atmega8, atmega83, atmega85).
Instruction set avr5 is for the enhanced AVR core with up to 128K program memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, atmega64, atmega128, at43usb355, at94k).
- -msize
- Output instruction sizes to the asm file.
- -mno-interrupts
- Generated code is not compatible with hardware interrupts. Code size will be smaller.
- -mcall-prologues
- Functions prologues/epilogues expanded as call to appropriate subroutines. Code size will be smaller.
- -mno-tablejump
- Do not generate tablejump insns which sometimes increase code size. The option is now deprecated in favor of the equivalent -fno-jump-tables
- -mtiny-stack
- Change only the low 8 bits of the stack pointer.
- -mint8
- Assume int to be 8 bit integer. This affects the sizes of all types: A char will be 1 byte, an int will be 1 byte, an long will be 2 bytes and long long will be 4 bytes. Please note that this option does not comply to the C standards, but it will provide you with smaller code size.
Blackfin Options
- -mcpu=cpu[-sirevision]
-
Specifies the name of the target Blackfin processor. Currently, cpu
can be one of bf512, bf514, bf516, bf518,
bf522, bf523, bf524, bf525, bf526,
bf527, bf531, bf532, bf533,
bf534, bf536, bf537, bf538, bf539,
bf542, bf544, bf547, bf548, bf549,
bf561.
The optional sirevision specifies the silicon revision of the target
Blackfin processor. Any workarounds available for the targeted silicon revision
will be enabled. If sirevision is none, no workarounds are enabled.
If sirevision is any, all workarounds for the targeted processor
will be enabled. The "__SILICON_REVISION__" macro is defined to two
hexadecimal digits representing the major and minor numbers in the silicon
revision. If sirevision is none, the "__SILICON_REVISION__"
is not defined. If sirevision is any, the
"__SILICON_REVISION__" is defined to be 0xffff.
If this optional sirevision is not used, GCC assumes the latest known
silicon revision of the targeted Blackfin processor.
Support for bf561 is incomplete. For bf561, Only the processor macro is defined. Without this option, bf532 is used as the processor by default. The corresponding predefined processor macros for cpu is to be defined. And for bfin-elf toolchain, this causes the hardware BSP provided by libgloss to be linked in if -msim is not given.
- -msim
- Specifies that the program will be run on the simulator. This causes the simulator BSP provided by libgloss to be linked in. This option has effect only for bfin-elf toolchain. Certain other options, such as -mid-shared-library and -mfdpic, imply -msim.
- -momit-leaf-frame-pointer
- Don't keep the frame pointer in a register for leaf functions. This avoids the instructions to save, set up and restore frame pointers and makes an extra register available in leaf functions. The option -fomit-frame-pointer removes the frame pointer for all functions which might make debugging harder.
- -mspecld-anomaly
- When enabled, the compiler will ensure that the generated code does not contain speculative loads after jump instructions. If this option is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
- -mno-specld-anomaly
- Don't generate extra code to prevent speculative loads from occurring.
- -mcsync-anomaly
- When enabled, the compiler will ensure that the generated code does not contain CSYNC or SSYNC instructions too soon after conditional branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS" is defined.
- -mno-csync-anomaly
- Don't generate extra code to prevent CSYNC or SSYNC instructions from occurring too soon after a conditional branch.
- -mlow-64k
- When enabled, the compiler is free to take advantage of the knowledge that the entire program fits into the low 64k of memory.
- -mno-low-64k
- Assume that the program is arbitrarily large. This is the default.
- -mstack-check-l1
- Do stack checking using information placed into L1 scratchpad memory by the uClinux kernel.
- -mid-shared-library
- Generate code that supports shared libraries via the library ID method. This allows for execute in place and shared libraries in an environment without virtual memory management. This option implies -fPIC. With a bfin-elf target, this option implies -msim.
- -mno-id-shared-library
- Generate code that doesn't assume ID based shared libraries are being used. This is the default.
- -mleaf-id-shared-library
- Generate code that supports shared libraries via the library ID method, but assumes that this library or executable won't link against any other ID shared libraries. That allows the compiler to use faster code for jumps and calls.
- -mno-leaf-id-shared-library
- Do not assume that the code being compiled won't link against any ID shared libraries. Slower code will be generated for jump and call insns.
- -mshared-library-id=n
- Specified the identification number of the ID based shared library being compiled. Specifying a value of 0 will generate more compact code, specifying other values will force the allocation of that number to the current library but is no more space or time efficient than omitting this option.
- -msep-data
- Generate code that allows the data segment to be located in a different area of memory from the text segment. This allows for execute in place in an environment without virtual memory management by eliminating relocations against the text section.
- -mno-sep-data
- Generate code that assumes that the data segment follows the text segment. This is the default.
- -mlong-calls
- -mno-long-calls
-
Tells the compiler to perform function calls by first loading the
address of the function into a register and then performing a subroutine
call on this register. This switch is needed if the target function
will lie outside of the 24 bit addressing range of the offset based
version of subroutine call instruction.
This feature is not enabled by default. Specifying -mno-long-calls will restore the default behavior. Note these switches have no effect on how the compiler generates code to handle function calls via function pointers.
- -mfast-fp
- Link with the fast floating-point library. This library relaxes some of the IEEE floating-point standard's rules for checking inputs against Not-a-Number (NAN), in the interest of performance.
- -minline-plt
- Enable inlining of PLT entries in function calls to functions that are not known to bind locally. It has no effect without -mfdpic.
- -mmulticore
- Build standalone application for multicore Blackfin processor. Proper start files and link scripts will be used to support multicore. This option defines "__BFIN_MULTICORE". It can only be used with -mcpu=bf561[-sirevision]. It can be used with -mcorea or -mcoreb. If it's used without -mcorea or -mcoreb, single application/dual core programming model is used. In this model, the main function of Core B should be named as coreb_main. If it's used with -mcorea or -mcoreb, one application per core programming model is used. If this option is not used, single core application programming model is used.
- -mcorea
- Build standalone application for Core A of BF561 when using one application per core programming model. Proper start files and link scripts will be used to support Core A. This option defines "__BFIN_COREA". It must be used with -mmulticore.
- -mcoreb
- Build standalone application for Core B of BF561 when using one application per core programming model. Proper start files and link scripts will be used to support Core B. This option defines "__BFIN_COREB". When this option is used, coreb_main should be used instead of main. It must be used with -mmulticore.
- -msdram
- Build standalone application for SDRAM. Proper start files and link scripts will be used to put the application into SDRAM. Loader should initialize SDRAM before loading the application into SDRAM. This option defines "__BFIN_SDRAM".
- -micplb
- Assume that ICPLBs are enabled at runtime. This has an effect on certain anomaly workarounds. For Linux targets, the default is to assume ICPLBs are enabled; for standalone applications the default is off.
CRIS Options
These options are defined specifically for the CRIS ports.- -march=architecture-type
- -mcpu=architecture-type
- Generate code for the specified architecture. The choices for architecture-type are v3, v8 and v10 for respectively ETRAX 4, ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-linux-gnu, where the default is v10.
- -mtune=architecture-type
- Tune to architecture-type everything applicable about the generated code, except for the ABI and the set of available instructions. The choices for architecture-type are the same as for -march=architecture-type.
- -mmax-stack-frame=n
- Warn when the stack frame of a function exceeds n bytes.
- -metrax4
- -metrax100
- The options -metrax4 and -metrax100 are synonyms for -march=v3 and -march=v8 respectively.
- -mmul-bug-workaround
- -mno-mul-bug-workaround
- Work around a bug in the "muls" and "mulu" instructions for CPU models where it applies. This option is active by default.
- -mpdebug
- Enable CRIS-specific verbose debug-related information in the assembly code. This option also has the effect to turn off the #NO_APP formatted-code indicator to the assembler at the beginning of the assembly file.
- -mcc-init
- Do not use condition-code results from previous instruction; always emit compare and test instructions before use of condition codes.
- -mno-side-effects
- Do not emit instructions with side-effects in addressing modes other than post-increment.
- -mstack-align
- -mno-stack-align
- -mdata-align
- -mno-data-align
- -mconst-align
- -mno-const-align
- These options (no-options) arranges (eliminate arrangements) for the stack-frame, individual data and constants to be aligned for the maximum single data access size for the chosen CPU model. The default is to arrange for 32-bit alignment. ABI details such as structure layout are not affected by these options.
- -m32-bit
- -m16-bit
- -m8-bit
- Similar to the stack- data- and const-align options above, these options arrange for stack-frame, writable data and constants to all be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit alignment.
- -mno-prologue-epilogue
- -mprologue-epilogue
- With -mno-prologue-epilogue, the normal function prologue and epilogue that sets up the stack-frame are omitted and no return instructions or return sequences are generated in the code. Use this option only together with visual inspection of the compiled code: no warnings or errors are generated when call-saved registers must be saved, or storage for local variable needs to be allocated.
- -mno-gotplt
- -mgotplt
- With -fpic and -fPIC, don't generate (do generate) instruction sequences that load addresses for functions from the PLT part of the GOT rather than (traditional on other architectures) calls to the PLT. The default is -mgotplt.
- -melf
- Legacy no-op option only recognized with the cris-axis-elf and cris-axis-linux-gnu targets.
- -mlinux
- Legacy no-op option only recognized with the cris-axis-linux-gnu target.
- -sim
- This option, recognized for the cris-axis-elf arranges to link with input-output functions from a simulator library. Code, initialized data and zero-initialized data are allocated consecutively.
- -sim2
- Like -sim, but pass linker options to locate initialized data at 0x40000000 and zero-initialized data at 0x80000000.
CRX Options
These options are defined specifically for the CRX ports.- -mmac
- Enable the use of multiply-accumulate instructions. Disabled by default.
- -mpush-args
- Push instructions will be used to pass outgoing arguments when functions are called. Enabled by default.
Darwin Options
These options are defined for all architectures running the Darwin operating system.FSF GCC on Darwin does not create ``fat'' object files; it will create an object file for the single architecture that it was built to target. Apple's GCC on Darwin does create ``fat'' files if multiple -arch options are used; it does so by running the compiler or linker multiple times and joining the results together with lipo.
The subtype of the file created (like ppc7400 or ppc970 or i686) is determined by the flags that specify the ISA that GCC is targetting, like -mcpu or -march. The -force_cpusubtype_ALL option can be used to override this.
The Darwin tools vary in their behavior when presented with an ISA mismatch. The assembler, as, will only permit instructions to be used that are valid for the subtype of the file it is generating, so you cannot put 64-bit instructions in an ppc750 object file. The linker for shared libraries, /usr/bin/libtool, will fail and print an error if asked to create a shared library with a less restrictive subtype than its input files (for instance, trying to put a ppc970 object file in a ppc7400 library). The linker for executables, ld, will quietly give the executable the most restrictive subtype of any of its input files.
- -Fdir
-
Add the framework directory dir to the head of the list of
directories to be searched for header files. These directories are
interleaved with those specified by -I options and are
scanned in a left-to-right order.
A framework directory is a directory with frameworks in it. A framework is a directory with a ``Headers'' and/or ``PrivateHeaders'' directory contained directly in it that ends in ``.framework''. The name of a framework is the name of this directory excluding the ``.framework''. Headers associated with the framework are found in one of those two directories, with ``Headers'' being searched first. A subframework is a framework directory that is in a framework's ``Frameworks'' directory. Includes of subframework headers can only appear in a header of a framework that contains the subframework, or in a sibling subframework header. Two subframeworks are siblings if they occur in the same framework. A subframework should not have the same name as a framework, a warning will be issued if this is violated. Currently a subframework cannot have subframeworks, in the future, the mechanism may be extended to support this. The standard frameworks can be found in ``/System/Library/Frameworks'' and ``/Library/Frameworks''. An example include looks like "#include <Framework/header.h>", where Framework denotes the name of the framework and header.h is found in the ``PrivateHeaders'' or ``Headers'' directory.
- -iframeworkdir
- Like -F except the directory is a treated as a system directory. The main difference between this -iframework and -F is that with -iframework the compiler does not warn about constructs contained within header files found via dir. This option is valid only for the C family of languages.
- -gused
- Emit debugging information for symbols that are used. For STABS debugging format, this enables -feliminate-unused-debug-symbols. This is by default ON.
- -gfull
- Emit debugging information for all symbols and types.
- -mmacosx-version-min=version
-
The earliest version of MacOS X that this executable will run on
is version. Typical values of version include 10.1,
10.2, and 10.3.9.
If the compiler was built to use the system's headers by default, then the default for this option is the system version on which the compiler is running, otherwise the default is to make choices which are compatible with as many systems and code bases as possible.
- -mkernel
- Enable kernel development mode. The -mkernel option sets -static, -fno-common, -fno-cxa-atexit, -fno-exceptions, -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti where applicable. This mode also sets -mno-altivec, -msoft-float, -fno-builtin and -mlong-branch for PowerPC targets.
- -mone-byte-bool
-
Override the defaults for bool so that sizeof(bool)==1.
By default sizeof(bool) is 4 when compiling for
Darwin/PowerPC and 1 when compiling for Darwin/x86, so this
option has no effect on x86.
Warning: The -mone-byte-bool switch causes GCC to generate code that is not binary compatible with code generated without that switch. Using this switch may require recompiling all other modules in a program, including system libraries. Use this switch to conform to a non-default data model.
- -mfix-and-continue
- -ffix-and-continue
- -findirect-data
- Generate code suitable for fast turn around development. Needed to enable gdb to dynamically load ".o" files into already running programs. -findirect-data and -ffix-and-continue are provided for backwards compatibility.
- -all_load
- Loads all members of static archive libraries. See man ld(1) for more information.
- -arch_errors_fatal
- Cause the errors having to do with files that have the wrong architecture to be fatal.
- -bind_at_load
- Causes the output file to be marked such that the dynamic linker will bind all undefined references when the file is loaded or launched.
- -bundle
- Produce a Mach-o bundle format file. See man ld(1) for more information.
- -bundle_loader executable
- This option specifies the executable that will be loading the build output file being linked. See man ld(1) for more information.
- -dynamiclib
- When passed this option, GCC will produce a dynamic library instead of an executable when linking, using the Darwin libtool command.
- -force_cpusubtype_ALL
- This causes GCC's output file to have the ALL subtype, instead of one controlled by the -mcpu or -march option.
- -allowable_client client_name
- -client_name
- -compatibility_version
- -current_version
- -dead_strip
- -dependency-file
- -dylib_file
- -dylinker_install_name
- -dynamic
- -exported_symbols_list
- -filelist
- -flat_namespace
- -force_flat_namespace
- -headerpad_max_install_names
- -image_base
- -init
- -install_name
- -keep_private_externs
- -multi_module
- -multiply_defined
- -multiply_defined_unused
- -noall_load
- -no_dead_strip_inits_and_terms
- -nofixprebinding
- -nomultidefs
- -noprebind
- -noseglinkedit
- -pagezero_size
- -prebind
- -prebind_all_twolevel_modules
- -private_bundle
- -read_only_relocs
- -sectalign
- -sectobjectsymbols
- -whyload
- -seg1addr
- -sectcreate
- -sectobjectsymbols
- -sectorder
- -segaddr
- -segs_read_only_addr
- -segs_read_write_addr
- -seg_addr_table
- -seg_addr_table_filename
- -seglinkedit
- -segprot
- -segs_read_only_addr
- -segs_read_write_addr
- -single_module
- -static
- -sub_library
- -sub_umbrella
- -twolevel_namespace
- -umbrella
- -undefined
- -unexported_symbols_list
- -weak_reference_mismatches
- -whatsloaded
- These options are passed to the Darwin linker. The Darwin linker man page describes them in detail.
DEC Alpha Options
These -m options are defined for the DEC Alpha implementations:- -mno-soft-float
- -msoft-float
-
Use (do not use) the hardware floating-point instructions for
floating-point operations. When -msoft-float is specified,
functions in libgcc.a will be used to perform floating-point
operations. Unless they are replaced by routines that emulate the
floating-point operations, or compiled in such a way as to call such
emulations routines, these routines will issue floating-point
operations. If you are compiling for an Alpha without floating-point
operations, you must ensure that the library is built so as not to call
them.
Note that Alpha implementations without floating-point operations are required to have floating-point registers.
- -mfp-reg
- -mno-fp-regs
-
Generate code that uses (does not use) the floating-point register set.
-mno-fp-regs implies -msoft-float. If the floating-point
register set is not used, floating point operands are passed in integer
registers as if they were integers and floating-point results are passed
in $0 instead of $f0. This is a non-standard calling sequence,
so any function with a floating-point argument or return value called by code
compiled with -mno-fp-regs must also be compiled with that
option.
A typical use of this option is building a kernel that does not use, and hence need not save and restore, any floating-point registers.
- -mieee
- The Alpha architecture implements floating-point hardware optimized for maximum performance. It is mostly compliant with the IEEE floating point standard. However, for full compliance, software assistance is required. This option generates code fully IEEE compliant code except that the inexact-flag is not maintained (see below). If this option is turned on, the preprocessor macro "_IEEE_FP" is defined during compilation. The resulting code is less efficient but is able to correctly support denormalized numbers and exceptional IEEE values such as not-a-number and plus/minus infinity. Other Alpha compilers call this option -ieee_with_no_inexact.
- -mieee-with-inexact
- This is like -mieee except the generated code also maintains the IEEE inexact-flag. Turning on this option causes the generated code to implement fully-compliant IEEE math. In addition to "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro. On some Alpha implementations the resulting code may execute significantly slower than the code generated by default. Since there is very little code that depends on the inexact-flag, you should normally not specify this option. Other Alpha compilers call this option -ieee_with_inexact.
- -mfp-trap-mode=trap-mode
-
This option controls what floating-point related traps are enabled.
Other Alpha compilers call this option -fptm trap-mode.
The trap mode can be set to one of four values:
-
- n
- This is the default (normal) setting. The only traps that are enabled are the ones that cannot be disabled in software (e.g., division by zero trap).
- u
- In addition to the traps enabled by n, underflow traps are enabled as well.
- su
- Like u, but the instructions are marked to be safe for software completion (see Alpha architecture manual for details).
- sui
- Like su, but inexact traps are enabled as well.
-
- -mfp-rounding-mode=rounding-mode
-
Selects the IEEE rounding mode. Other Alpha compilers call this option
-fprm rounding-mode. The rounding-mode can be one
of:
-
- n
- Normal IEEE rounding mode. Floating point numbers are rounded towards the nearest machine number or towards the even machine number in case of a tie.
- m
- Round towards minus infinity.
- c
- Chopped rounding mode. Floating point numbers are rounded towards zero.
- d
- Dynamic rounding mode. A field in the floating point control register (fpcr, see Alpha architecture reference manual) controls the rounding mode in effect. The C library initializes this register for rounding towards plus infinity. Thus, unless your program modifies the fpcr, d corresponds to round towards plus infinity.
-
- -mtrap-precision=trap-precision
-
In the Alpha architecture, floating point traps are imprecise. This
means without software assistance it is impossible to recover from a
floating trap and program execution normally needs to be terminated.
GCC can generate code that can assist operating system trap handlers
in determining the exact location that caused a floating point trap.
Depending on the requirements of an application, different levels of
precisions can be selected:
-
- p
- Program precision. This option is the default and means a trap handler can only identify which program caused a floating point exception.
- f
- Function precision. The trap handler can determine the function that caused a floating point exception.
- i
- Instruction precision. The trap handler can determine the exact instruction that caused a floating point exception.
-
Other Alpha compilers provide the equivalent options called -scope_safe and -resumption_safe.
-
- -mieee-conformant
- This option marks the generated code as IEEE conformant. You must not use this option unless you also specify -mtrap-precision=i and either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is to emit the line .eflag 48 in the function prologue of the generated assembly file. Under DEC Unix, this has the effect that IEEE-conformant math library routines will be linked in.
- -mbuild-constants
-
Normally GCC examines a 32- or 64-bit integer constant to
see if it can construct it from smaller constants in two or three
instructions. If it cannot, it will output the constant as a literal and
generate code to load it from the data segment at runtime.
Use this option to require GCC to construct all integer constants using code, even if it takes more instructions (the maximum is six).
You would typically use this option to build a shared library dynamic loader. Itself a shared library, it must relocate itself in memory before it can find the variables and constants in its own data segment.
- -malpha-as
- -mgas
- Select whether to generate code to be assembled by the vendor-supplied assembler (-malpha-as) or by the GNU assembler -mgas.
- -mbwx
- -mno-bwx
- -mcix
- -mno-cix
- -mfix
- -mno-fix
- -mmax
- -mno-max
- Indicate whether GCC should generate code to use the optional BWX, CIX, FIX and MAX instruction sets. The default is to use the instruction sets supported by the CPU type specified via -mcpu= option or that of the CPU on which GCC was built if none was specified.
- -mfloat-vax
- -mfloat-ieee
- Generate code that uses (does not use) VAX F and G floating point arithmetic instead of IEEE single and double precision.
- -mexplicit-relocs
- -mno-explicit-relocs
- Older Alpha assemblers provided no way to generate symbol relocations except via assembler macros. Use of these macros does not allow optimal instruction scheduling. GNU binutils as of version 2.12 supports a new syntax that allows the compiler to explicitly mark which relocations should apply to which instructions. This option is mostly useful for debugging, as GCC detects the capabilities of the assembler when it is built and sets the default accordingly.
- -msmall-data
- -mlarge-data
-
When -mexplicit-relocs is in effect, static data is
accessed via gp-relative relocations. When -msmall-data
is used, objects 8 bytes long or smaller are placed in a small data area
(the ".sdata" and ".sbss" sections) and are accessed via
16-bit relocations off of the $gp register. This limits the
size of the small data area to 64KB, but allows the variables to be
directly accessed via a single instruction.
The default is -mlarge-data. With this option the data area is limited to just below 2GB. Programs that require more than 2GB of data must use "malloc" or "mmap" to allocate the data in the heap instead of in the program's data segment.
When generating code for shared libraries, -fpic implies -msmall-data and -fPIC implies -mlarge-data.
- -msmall-text
- -mlarge-text
-
When -msmall-text is used, the compiler assumes that the
code of the entire program (or shared library) fits in 4MB, and is
thus reachable with a branch instruction. When -msmall-data
is used, the compiler can assume that all local symbols share the
same $gp value, and thus reduce the number of instructions
required for a function call from 4 to 1.
The default is -mlarge-text.
- -mcpu=cpu_type
-
Set the instruction set and instruction scheduling parameters for
machine type cpu_type. You can specify either the EV
style name or the corresponding chip number. GCC supports scheduling
parameters for the EV4, EV5 and EV6 family of processors and will
choose the default values for the instruction set from the processor
you specify. If you do not specify a processor type, GCC will default
to the processor on which the compiler was built.
Supported values for cpu_type are
-
- ev4
- ev45
- 21064
- Schedules as an EV4 and has no instruction set extensions.
- ev5
- 21164
- Schedules as an EV5 and has no instruction set extensions.
- ev56
- 21164a
- Schedules as an EV5 and supports the BWX extension.
- pca56
- 21164pc
- 21164PC
- Schedules as an EV5 and supports the BWX and MAX extensions.
- ev6
- 21264
- Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
- ev67
- 21264a
- Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
-
Native Linux/GNU toolchains also support the value native, which selects the best architecture option for the host processor. -mcpu=native has no effect if GCC does not recognize the processor.
-
- -mtune=cpu_type
-
Set only the instruction scheduling parameters for machine type
cpu_type. The instruction set is not changed.
Native Linux/GNU toolchains also support the value native, which selects the best architecture option for the host processor. -mtune=native has no effect if GCC does not recognize the processor.
- -mmemory-latency=time
-
Sets the latency the scheduler should assume for typical memory
references as seen by the application. This number is highly
dependent on the memory access patterns used by the application
and the size of the external cache on the machine.
Valid options for time are
DEC Alpha/VMS Options
These -m options are defined for the DEC Alpha/VMS implementations:- -mvms-return-codes
- Return VMS condition codes from main. The default is to return POSIX style condition (e.g. error) codes.
FR30 Options
These options are defined specifically for the FR30 port.- -msmall-model
- Use the small address space model. This can produce smaller code, but it does assume that all symbolic values and addresses will fit into a 20-bit range.
- -mno-lsim
- Assume that run-time support has been provided and so there is no need to include the simulator library (libsim.a) on the linker command line.
FRV Options
- -mgpr-32
- Only use the first 32 general purpose registers.
- -mgpr-64
- Use all 64 general purpose registers.
- -mfpr-32
- Use only the first 32 floating point registers.
- -mfpr-64
- Use all 64 floating point registers
- -mhard-float
- Use hardware instructions for floating point operations.
- -msoft-float
- Use library routines for floating point operations.
- -malloc-cc
- Dynamically allocate condition code registers.
- -mfixed-cc
- Do not try to dynamically allocate condition code registers, only use "icc0" and "fcc0".
- -mdword
- Change ABI to use double word insns.
- -mno-dword
- Do not use double word instructions.
- -mdouble
- Use floating point double instructions.
- -mno-double
- Do not use floating point double instructions.
- -mmedia
- Use media instructions.
- -mno-media
- Do not use media instructions.
- -mmuladd
- Use multiply and add/subtract instructions.
- -mno-muladd
- Do not use multiply and add/subtract instructions.
- -mfdpic
- Select the FDPIC ABI, that uses function descriptors to represent pointers to functions. Without any PIC/PIE-related options, it implies -fPIE. With -fpic or -fpie, it assumes GOT entries and small data are within a 12-bit range from the GOT base address; with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a bfin-elf target, this option implies -msim.
- -minline-plt
- Enable inlining of PLT entries in function calls to functions that are not known to bind locally. It has no effect without -mfdpic. It's enabled by default if optimizing for speed and compiling for shared libraries (i.e., -fPIC or -fpic), or when an optimization option such as -O3 or above is present in the command line.
- -mTLS
- Assume a large TLS segment when generating thread-local code.
- -mtls
- Do not assume a large TLS segment when generating thread-local code.
- -mgprel-ro
- Enable the use of "GPREL" relocations in the FDPIC ABI for data that is known to be in read-only sections. It's enabled by default, except for -fpic or -fpie: even though it may help make the global offset table smaller, it trades 1 instruction for 4. With -fPIC or -fPIE, it trades 3 instructions for 4, one of which may be shared by multiple symbols, and it avoids the need for a GOT entry for the referenced symbol, so it's more likely to be a win. If it is not, -mno-gprel-ro can be used to disable it.
- -multilib-library-pic
- Link with the (library, not FD) pic libraries. It's implied by -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You should never have to use it explicitly.
- -mlinked-fp
- Follow the EABI requirement of always creating a frame pointer whenever a stack frame is allocated. This option is enabled by default and can be disabled with -mno-linked-fp.
- -mlong-calls
- Use indirect addressing to call functions outside the current compilation unit. This allows the functions to be placed anywhere within the 32-bit address space.
- -malign-labels
- Try to align labels to an 8-byte boundary by inserting nops into the previous packet. This option only has an effect when VLIW packing is enabled. It doesn't create new packets; it merely adds nops to existing ones.
- -mlibrary-pic
- Generate position-independent EABI code.
- -macc-4
- Use only the first four media accumulator registers.
- -macc-8
- Use all eight media accumulator registers.
- -mpack
- Pack VLIW instructions.
- -mno-pack
- Do not pack VLIW instructions.
- -mno-eflags
- Do not mark ABI switches in e_flags.
- -mcond-move
-
Enable the use of conditional-move instructions (default).
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mno-cond-move
-
Disable the use of conditional-move instructions.
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mscc
-
Enable the use of conditional set instructions (default).
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mno-scc
-
Disable the use of conditional set instructions.
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mcond-exec
-
Enable the use of conditional execution (default).
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mno-cond-exec
-
Disable the use of conditional execution.
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mvliw-branch
-
Run a pass to pack branches into VLIW instructions (default).
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mno-vliw-branch
-
Do not run a pass to pack branches into VLIW instructions.
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mmulti-cond-exec
-
Enable optimization of "&&" and "||" in conditional execution
(default).
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mno-multi-cond-exec
-
Disable optimization of "&&" and "||" in conditional execution.
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mnested-cond-exec
-
Enable nested conditional execution optimizations (default).
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -mno-nested-cond-exec
-
Disable nested conditional execution optimizations.
This switch is mainly for debugging the compiler and will likely be removed in a future version.
- -moptimize-membar
- This switch removes redundant "membar" instructions from the compiler generated code. It is enabled by default.
- -mno-optimize-membar
- This switch disables the automatic removal of redundant "membar" instructions from the generated code.
- -mtomcat-stats
- Cause gas to print out tomcat statistics.
- -mcpu=cpu
- Select the processor type for which to generate code. Possible values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300 and simple.
GNU/Linux Options
These -m options are defined for GNU/Linux targets:- -mglibc
- Use the GNU C library instead of uClibc. This is the default except on *-*-linux-*uclibc* targets.
- -muclibc
- Use uClibc instead of the GNU C library. This is the default on *-*-linux-*uclibc* targets.
H8/300 Options
These -m options are defined for the H8/300 implementations:- -mrelax
- Shorten some address references at link time, when possible; uses the linker option -relax.
- -mh
- Generate code for the H8/300H.
- -ms
- Generate code for the H8S.
- -mn
- Generate code for the H8S and H8/300H in the normal mode. This switch must be used either with -mh or -ms.
- -ms2600
- Generate code for the H8S/2600. This switch must be used with -ms.
- -mint32
- Make "int" data 32 bits by default.
- -malign-300
- On the H8/300H and H8S, use the same alignment rules as for the H8/300. The default for the H8/300H and H8S is to align longs and floats on 4 byte boundaries. -malign-300 causes them to be aligned on 2 byte boundaries. This option has no effect on the H8/300.
HPPA Options
These -m options are defined for the HPPA family of computers:- -march=architecture-type
- Generate code for the specified architecture. The choices for architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX system to determine the proper architecture option for your machine. Code compiled for lower numbered architectures will run on higher numbered architectures, but not the other way around.
- -mpa-risc-1-0
- -mpa-risc-1-1
- -mpa-risc-2-0
- Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
- -mbig-switch
- Generate code suitable for big switch tables. Use this option only if the assembler/linker complain about out of range branches within a switch table.
- -mjump-in-delay
- Fill delay slots of function calls with unconditional jump instructions by modifying the return pointer for the function call to be the target of the conditional jump.
- -mdisable-fpregs
- Prevent floating point registers from being used in any manner. This is necessary for compiling kernels which perform lazy context switching of floating point registers. If you use this option and attempt to perform floating point operations, the compiler will abort.
- -mdisable-indexing
- Prevent the compiler from using indexing address modes. This avoids some rather obscure problems when compiling MIG generated code under MACH.
- -mno-space-regs
-
Generate code that assumes the target has no space registers. This allows
GCC to generate faster indirect calls and use unscaled index address modes.
Such code is suitable for level 0 PA systems and kernels.
- -mfast-indirect-calls
-
Generate code that assumes calls never cross space boundaries. This
allows GCC to emit code which performs faster indirect calls.
This option will not work in the presence of shared libraries or nested functions.
- -mfixed-range=register-range
- Generate code treating the given register range as fixed registers. A fixed register is one that the register allocator can not use. This is useful when compiling kernel code. A register range is specified as two registers separated by a dash. Multiple register ranges can be specified separated by a comma.
- -mlong-load-store
- Generate 3-instruction load and store sequences as sometimes required by the HP-UX 10 linker. This is equivalent to the +k option to the HP compilers.
- -mportable-runtime
- Use the portable calling conventions proposed by HP for ELF systems.
- -mgas
- Enable the use of assembler directives only GAS understands.
- -mschedule=cpu-type
- Schedule code according to the constraints for the machine type cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200, 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system to determine the proper scheduling option for your machine. The default scheduling is 8000.
- -mlinker-opt
- Enable the optimization pass in the HP-UX linker. Note this makes symbolic debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 linkers in which they give bogus error messages when linking some programs.
- -msoft-float
-
Generate output containing library calls for floating point.
Warning: the requisite libraries are not available for all HPPA
targets. Normally the facilities of the machine's usual C compiler are
used, but this cannot be done directly in cross-compilation. You must make
your own arrangements to provide suitable library functions for
cross-compilation.
-msoft-float changes the calling convention in the output file; therefore, it is only useful if you compile all of a program with this option. In particular, you need to compile libgcc.a, the library that comes with GCC, with -msoft-float in order for this to work.
- -msio
- Generate the predefine, "_SIO", for server IO. The default is -mwsio. This generates the predefines, "__hp9000s700", "__hp9000s700__" and "_WSIO", for workstation IO. These options are available under HP-UX and HI-UX.
- -mgnu-ld
- Use GNU ld specific options. This passes -shared to ld when building a shared library. It is the default when GCC is configured, explicitly or implicitly, with the GNU linker. This option does not have any affect on which ld is called, it only changes what parameters are passed to that ld. The ld that is called is determined by the --with-ld configure option, GCC's program search path, and finally by the user's PATH. The linker used by GCC can be printed using which `gcc -print-prog-name=ld`. This option is only available on the 64 bit HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
- -mhp-ld
- Use HP ld specific options. This passes -b to ld when building a shared library and passes +Accept TypeMismatch to ld on all links. It is the default when GCC is configured, explicitly or implicitly, with the HP linker. This option does not have any affect on which ld is called, it only changes what parameters are passed to that ld. The ld that is called is determined by the --with-ld configure option, GCC's program search path, and finally by the user's PATH. The linker used by GCC can be printed using which `gcc -print-prog-name=ld`. This option is only available on the 64 bit HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
- -mlong-calls
-
Generate code that uses long call sequences. This ensures that a call
is always able to reach linker generated stubs. The default is to generate
long calls only when the distance from the call site to the beginning
of the function or translation unit, as the case may be, exceeds a
predefined limit set by the branch type being used. The limits for
normal calls are 7,600,000 and 240,000 bytes, respectively for the
PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
240,000 bytes.
Distances are measured from the beginning of functions when using the -ffunction-sections option, or when using the -mgas and -mno-portable-runtime options together under HP-UX with the SOM linker.
It is normally not desirable to use this option as it will degrade performance. However, it may be useful in large applications, particularly when partial linking is used to build the application.
The types of long calls used depends on the capabilities of the assembler and linker, and the type of code being generated. The impact on systems that support long absolute calls, and long pic symbol-difference or pc-relative calls should be relatively small. However, an indirect call is used on 32-bit ELF systems in pic code and it is quite long.
- -munix=unix-std
-
Generate compiler predefines and select a startfile for the specified
UNIX standard. The choices for unix-std are 93, 95
and 98. 93 is supported on all HP-UX versions. 95
is available on HP-UX 10.10 and later. 98 is available on HP-UX
11.11 and later. The default values are 93 for HP-UX 10.00,
95 for HP-UX 10.10 though to 11.00, and 98 for HP-UX 11.11
and later.
-munix=93 provides the same predefines as GCC 3.3 and 3.4. -munix=95 provides additional predefines for "XOPEN_UNIX" and "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98 provides additional predefines for "_XOPEN_UNIX", "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
It is important to note that this option changes the interfaces for various library routines. It also affects the operational behavior of the C library. Thus, extreme care is needed in using this option.
Library code that is intended to operate with more than one UNIX standard must test, set and restore the variable __xpg4_extended_mask as appropriate. Most GNU software doesn't provide this capability.
- -nolibdld
- Suppress the generation of link options to search libdld.sl when the -static option is specified on HP-UX 10 and later.
- -static
-
The HP-UX implementation of setlocale in libc has a dependency on
libdld.sl. There isn't an archive version of libdld.sl. Thus,
when the -static option is specified, special link options
are needed to resolve this dependency.
On HP-UX 10 and later, the GCC driver adds the necessary options to link with libdld.sl when the -static option is specified. This causes the resulting binary to be dynamic. On the 64-bit port, the linkers generate dynamic binaries by default in any case. The -nolibdld option can be used to prevent the GCC driver from adding these link options.
- -threads
- Add support for multithreading with the dce thread library under HP-UX. This option sets flags for both the preprocessor and linker.
Intel 386 and AMD x86-64 Options
These -m options are defined for the i386 and x86-64 family of computers:- -mtune=cpu-type
-
Tune to cpu-type everything applicable about the generated code, except
for the ABI and the set of available instructions. The choices for
cpu-type are:
-
- generic
-
Produce code optimized for the most common IA32/AMD64/EM64T processors.
If you know the CPU on which your code will run, then you should use
the corresponding -mtune option instead of
-mtune=generic. But, if you do not know exactly what CPU users
of your application will have, then you should use this option.
As new processors are deployed in the marketplace, the behavior of this option will change. Therefore, if you upgrade to a newer version of GCC, the code generated option will change to reflect the processors that were most common when that version of GCC was released.
There is no -march=generic option because -march indicates the instruction set the compiler can use, and there is no generic instruction set applicable to all processors. In contrast, -mtune indicates the processor (or, in this case, collection of processors) for which the code is optimized.
- native
- This selects the CPU to tune for at compilation time by determining the processor type of the compiling machine. Using -mtune=native will produce code optimized for the local machine under the constraints of the selected instruction set. Using -march=native will enable all instruction subsets supported by the local machine (hence the result might not run on different machines).
- i386
- Original Intel's i386 CPU.
- i486
- Intel's i486 CPU. (No scheduling is implemented for this chip.)
- i586, pentium
- Intel Pentium CPU with no MMX support.
- pentium-mmx
- Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
- pentiumpro
- Intel PentiumPro CPU.
- i686
- Same as "generic", but when used as "march" option, PentiumPro instruction set will be used, so the code will run on all i686 family chips.
- pentium2
- Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
- pentium3, pentium3m
- Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set support.
- pentium-m
- Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
- pentium4, pentium4m
- Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
- prescott
- Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
- nocona
- Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE, SSE2 and SSE3 instruction set support.
- core2
- Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support.
- k6
- AMD K6 CPU with MMX instruction set support.
- k6-2, k6-3
- Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
- athlon, athlon-tbird
- AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions support.
- athlon-4, athlon-xp, athlon-mp
- Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE instruction set support.
- k8, opteron, athlon64, athlon-fx
- AMD K8 core based CPUs with x86-64 instruction set support. (This supersets MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
- k8-sse3, opteron-sse3, athlon64-sse3
- Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
- amdfam10, barcelona
- AMD Family 10h core based CPUs with x86-64 instruction set support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit instruction set extensions.)
- winchip-c6
- IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction set support.
- winchip2
- IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW! instruction set support.
- c3
- Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is implemented for this chip.)
- c3-2
- Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is implemented for this chip.)
- geode
- Embedded AMD CPU with MMX and 3dNOW! instruction set support.
-
While picking a specific cpu-type will schedule things appropriately for that particular chip, the compiler will not generate any code that does not run on the i386 without the -march=cpu-type option being used.
-
- -march=cpu-type
- Generate instructions for the machine type cpu-type. The choices for cpu-type are the same as for -mtune. Moreover, specifying -march=cpu-type implies -mtune=cpu-type.
- -mcpu=cpu-type
- A deprecated synonym for -mtune.
- -mfpmath=unit
-
Generate floating point arithmetics for selected unit unit. The choices
for unit are:
-
- 387
-
Use the standard 387 floating point coprocessor present majority of chips and
emulated otherwise. Code compiled with this option will run almost everywhere.
The temporary results are computed in 80bit precision instead of precision
specified by the type resulting in slightly different results compared to most
of other chips. See -ffloat-store for more detailed description.
This is the default choice for i386 compiler.
- sse
-
Use scalar floating point instructions present in the SSE instruction set.
This instruction set is supported by Pentium3 and newer chips, in the AMD line
by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
instruction set supports only single precision arithmetics, thus the double and
extended precision arithmetics is still done using 387. Later version, present
only in Pentium4 and the future AMD x86-64 chips supports double precision
arithmetics too.
For the i386 compiler, you need to use -march=cpu-type, -msse or -msse2 switches to enable SSE extensions and make this option effective. For the x86-64 compiler, these extensions are enabled by default.
The resulting code should be considerably faster in the majority of cases and avoid the numerical instability problems of 387 code, but may break some existing code that expects temporaries to be 80bit.
This is the default choice for the x86-64 compiler.
- sse,387
- sse+387
- both
- Attempt to utilize both instruction sets at once. This effectively double the amount of available registers and on chips with separate execution units for 387 and SSE the execution resources too. Use this option with care, as it is still experimental, because the GCC register allocator does not model separate functional units well resulting in instable performance.
-
- -masm=dialect
- Output asm instructions using selected dialect. Supported choices are intel or att (the default one). Darwin does not support intel.
- -mieee-fp
- -mno-ieee-fp
- Control whether or not the compiler uses IEEE floating point comparisons. These handle correctly the case where the result of a comparison is unordered.
- -msoft-float
-
Generate output containing library calls for floating point.
Warning: the requisite libraries are not part of GCC.
Normally the facilities of the machine's usual C compiler are used, but
this can't be done directly in cross-compilation. You must make your
own arrangements to provide suitable library functions for
cross-compilation.
On machines where a function returns floating point results in the 80387 register stack, some floating point opcodes may be emitted even if -msoft-float is used.
- -mno-fp-ret-in-387
-
Do not use the FPU registers for return values of functions.
The usual calling convention has functions return values of types "float" and "double" in an FPU register, even if there is no FPU. The idea is that the operating system should emulate an FPU.
The option -mno-fp-ret-in-387 causes such values to be returned in ordinary CPU registers instead.
- -mno-fancy-math-387
- Some 387 emulators do not support the "sin", "cos" and "sqrt" instructions for the 387. Specify this option to avoid generating those instructions. This option is the default on FreeBSD, OpenBSD and NetBSD. This option is overridden when -march indicates that the target cpu will always have an FPU and so the instruction will not need emulation. As of revision 2.6.1, these instructions are not generated unless you also use the -funsafe-math-optimizations switch.
- -malign-double
- -mno-align-double
-
Control whether GCC aligns "double", "long double", and
"long long" variables on a two word boundary or a one word
boundary. Aligning "double" variables on a two word boundary will
produce code that runs somewhat faster on a Pentium at the
expense of more memory.
On x86-64, -malign-double is enabled by default.
Warning: if you use the -malign-double switch, structures containing the above types will be aligned differently than the published application binary interface specifications for the 386 and will not be binary compatible with structures in code compiled without that switch.
- -m96bit-long-double
- -m128bit-long-double
-
These switches control the size of "long double" type. The i386
application binary interface specifies the size to be 96 bits,
so -m96bit-long-double is the default in 32 bit mode.
Modern architectures (Pentium and newer) would prefer "long double" to be aligned to an 8 or 16 byte boundary. In arrays or structures conforming to the ABI, this would not be possible. So specifying a -m128bit-long-double will align "long double" to a 16 byte boundary by padding the "long double" with an additional 32 bit zero.
In the x86-64 compiler, -m128bit-long-double is the default choice as its ABI specifies that "long double" is to be aligned on 16 byte boundary.
Notice that neither of these options enable any extra precision over the x87 standard of 80 bits for a "long double".
Warning: if you override the default value for your target ABI, the structures and arrays containing "long double" variables will change their size as well as function calling convention for function taking "long double" will be modified. Hence they will not be binary compatible with arrays or structures in code compiled without that switch.
- -mlarge-data-threshold=number
- When -mcmodel=medium is specified, the data greater than threshold are placed in large data section. This value must be the same across all object linked into the binary and defaults to 65535.
- -mrtd
-
Use a different function-calling convention, in which functions that
take a fixed number of arguments return with the "ret" num
instruction, which pops their arguments while returning. This saves one
instruction in the caller since there is no need to pop the arguments
there.
You can specify that an individual function is called with this calling sequence with the function attribute stdcall. You can also override the -mrtd option by using the function attribute cdecl.
Warning: this calling convention is incompatible with the one normally used on Unix, so you cannot use it if you need to call libraries compiled with the Unix compiler.
Also, you must provide function prototypes for all functions that take variable numbers of arguments (including "printf"); otherwise incorrect code will be generated for calls to those functions.
In addition, seriously incorrect code will result if you call a function with too many arguments. (Normally, extra arguments are harmlessly ignored.)
- -mregparm=num
-
Control how many registers are used to pass integer arguments. By
default, no registers are used to pass arguments, and at most 3
registers can be used. You can control this behavior for a specific
function by using the function attribute regparm.
Warning: if you use this switch, and num is nonzero, then you must build all modules with the same value, including any libraries. This includes the system libraries and startup modules.
- -msseregparm
-
Use SSE register passing conventions for float and double arguments
and return values. You can control this behavior for a specific
function by using the function attribute sseregparm.
Warning: if you use this switch then you must build all modules with the same value, including any libraries. This includes the system libraries and startup modules.
- -mpc32
- -mpc64
- -mpc80
-
Set 80387 floating-point precision to 32, 64 or 80 bits. When -mpc32
is specified, the significands of results of floating-point operations are
rounded to 24 bits (single precision); -mpc64 rounds the
significands of results of floating-point operations to 53 bits (double
precision) and -mpc80 rounds the significands of results of
floating-point operations to 64 bits (extended double precision), which is
the default. When this option is used, floating-point operations in higher
precisions are not available to the programmer without setting the FPU
control word explicitly.
Setting the rounding of floating-point operations to less than the default 80 bits can speed some programs by 2% or more. Note that some mathematical libraries assume that extended precision (80 bit) floating-point operations are enabled by default; routines in such libraries could suffer significant loss of accuracy, typically through so-called ``catastrophic cancellation'', when this option is used to set the precision to less than extended precision.
- -mstackrealign
- Realign the stack at entry. On the Intel x86, the -mstackrealign option will generate an alternate prologue and epilogue that realigns the runtime stack if necessary. This supports mixing legacy codes that keep a 4-byte aligned stack with modern codes that keep a 16-byte stack for SSE compatibility. See also the attribute "force_align_arg_pointer", applicable to individual functions.
- -mpreferred-stack-boundary=num
- Attempt to keep the stack boundary aligned to a 2 raised to num byte boundary. If -mpreferred-stack-boundary is not specified, the default is 4 (16 bytes or 128 bits).
- -mincoming-stack-boundary=num
-
Assume the incoming stack is aligned to a 2 raised to num byte
boundary. If -mincoming-stack-boundary is not specified,
the one specified by -mpreferred-stack-boundary will be used.
On Pentium and PentiumPro, "double" and "long double" values should be aligned to an 8 byte boundary (see -malign-double) or suffer significant run time performance penalties. On Pentium III, the Streaming SIMD Extension (SSE) data type "__m128" may not work properly if it is not 16 byte aligned.
To ensure proper alignment of this values on the stack, the stack boundary must be as aligned as that required by any value stored on the stack. Further, every function must be generated such that it keeps the stack aligned. Thus calling a function compiled with a higher preferred stack boundary from a function compiled with a lower preferred stack boundary will most likely misalign the stack. It is recommended that libraries that use callbacks always use the default setting.
This extra alignment does consume extra stack space, and generally increases code size. Code that is sensitive to stack space usage, such as embedded systems and operating system kernels, may want to reduce the preferred alignment to -mpreferred-stack-boundary=2.
- -mmmx
- -mno-mmx
- -msse
- -mno-sse
- -msse2
- -mno-sse2
- -msse3
- -mno-sse3
- -mssse3
- -mno-ssse3
- -msse4.1
- -mno-sse4.1
- -msse4.2
- -mno-sse4.2
- -msse4
- -mno-sse4
- -mavx
- -mno-avx
- -maes
- -mno-aes
- -mpclmul
- -mno-pclmul
- -mfsgsbase
- -mno-fsgsbase
- -mrdrnd
- -mno-rdrnd
- -mf16c
- -mno-f16c
- -msse4a
- -mno-sse4a
- -mfma4
- -mno-fma4
- -mxop
- -mno-xop
- -mlwp
- -mno-lwp
- -m3dnow
- -mno-3dnow
- -mpopcnt
- -mno-popcnt
- -mabm
- -mno-abm
- -mbmi
- -mno-bmi
- -mtbm
- -mno-tbm
-
These switches enable or disable the use of instructions in the MMX,
SSE, SSE2, SSE3, SSSE3, SSE4.1, AVX, AES, PCLMUL, FSGSBASE, RDRND,
F16C, SSE4A, FMA4, XOP, LWP, ABM, BMI, or 3DNow! extended instruction sets.
These extensions are also available as built-in functions: see
X86 Built-in Functions, for details of the functions enabled and
disabled by these switches.
To have SSE/SSE2 instructions generated automatically from floating-point code (as opposed to 387 instructions), see -mfpmath=sse.
GCC depresses SSEx instructions when -mavx is used. Instead, it generates new AVX instructions or AVX equivalence for all SSEx instructions when needed.
These options will enable GCC to use these extended instructions in generated code, even without -mfpmath=sse. Applications which perform runtime CPU detection must compile separate files for each supported architecture, using the appropriate flags. In particular, the file containing the CPU detection code should be compiled without these options.
- -mfused-madd
- -mno-fused-madd
- Do (don't) generate code that uses the fused multiply/add or multiply/subtract instructions. The default is to use these instructions.
- -mcld
- This option instructs GCC to emit a "cld" instruction in the prologue of functions that use string instructions. String instructions depend on the DF flag to select between autoincrement or autodecrement mode. While the ABI specifies the DF flag to be cleared on function entry, some operating systems violate this specification by not clearing the DF flag in their exception dispatchers. The exception handler can be invoked with the DF flag set which leads to wrong direction mode, when string instructions are used. This option can be enabled by default on 32-bit x86 targets by configuring GCC with the --enable-cld configure option. Generation of "cld" instructions can be suppressed with the -mno-cld compiler option in this case.
- -mcx16
- This option will enable GCC to use CMPXCHG16B instruction in generated code. CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword) data types. This is useful for high resolution counters that could be updated by multiple processors (or cores). This instruction is generated as part of atomic built-in functions: see Atomic Builtins for details.
- -msahf
- This option will enable GCC to use SAHF instruction in generated 64-bit code. Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported by AMD64 until introduction of Pentium 4 G1 step in December 2005. LAHF and SAHF are load and store instructions, respectively, for certain status flags. In 64-bit mode, SAHF instruction is used to optimize "fmod", "drem" or "remainder" built-in functions: see Other Builtins for details.
- -mmovbe
- This option will enable GCC to use movbe instruction to implement "__builtin_bswap32" and "__builtin_bswap64".
- -mcrc32
- This option will enable built-in functions, "__builtin_ia32_crc32qi", "__builtin_ia32_crc32hi". "__builtin_ia32_crc32si" and "__builtin_ia32_crc32di" to generate the crc32 machine instruction.
- -mrecip
- This option will enable GCC to use RCPSS and RSQRTSS instructions (and their vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step to increase precision instead of DIVSS and SQRTSS (and their vectorized variants) for single precision floating point arguments. These instructions are generated only when -funsafe-math-optimizations is enabled together with -finite-math-only and -fno-trapping-math. Note that while the throughput of the sequence is higher than the throughput of the non-reciprocal instruction, the precision of the sequence can be decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
- -mveclibabi=type
- Specifies the ABI type to use for vectorizing intrinsics using an external library. Supported types are "svml" for the Intel short vector math library and "acml" for the AMD math core library style of interfacing. GCC will currently emit calls to "vmldExp2", "vmldLn2", "vmldLog102", "vmldLog102", "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2", "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2", "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4", "vmlsLn4", "vmlsLog104", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4", "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4", "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4" and "vmlsAcos4" for corresponding function type when -mveclibabi=svml is used and "__vrd2_sin", "__vrd2_cos", "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10", "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf", "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for corresponding function type when -mveclibabi=acml is used. Both -ftree-vectorize and -funsafe-math-optimizations have to be enabled. A SVML or ACML ABI compatible library will have to be specified at link time.
- -mpush-args
- -mno-push-args
- Use PUSH operations to store outgoing parameters. This method is shorter and usually equally fast as method using SUB/MOV operations and is enabled by default. In some cases disabling it may improve performance because of improved scheduling and reduced dependencies.
- -maccumulate-outgoing-args
- If enabled, the maximum amount of space required for outgoing arguments will be computed in the function prologue. This is faster on most modern CPUs because of reduced dependencies, improved scheduling and reduced stack usage when preferred stack boundary is not equal to 2. The drawback is a notable increase in code size. This switch implies -mno-push-args.
- -mthreads
- Support thread-safe exception handling on Mingw32. Code that relies on thread-safe exception handling must compile and link all code with the -mthreads option. When compiling, -mthreads defines -D_MT; when linking, it links in a special thread helper library -lmingwthrd which cleans up per thread exception handling data.
- -mno-align-stringops
- Do not align destination of inlined string operations. This switch reduces code size and improves performance in case the destination is already aligned, but GCC doesn't know about it.
- -minline-all-stringops
- By default GCC inlines string operations only when destination is known to be aligned at least to 4 byte boundary. This enables more inlining, increase code size, but may improve performance of code that depends on fast memcpy, strlen and memset for short lengths.
- -minline-stringops-dynamically
- For string operation of unknown size, inline runtime checks so for small blocks inline code is used, while for large blocks library call is used.
- -mstringop-strategy=alg
- Overwrite internal decision heuristic about particular algorithm to inline string operation with. The allowed values are "rep_byte", "rep_4byte", "rep_8byte" for expanding using i386 "rep" prefix of specified size, "byte_loop", "loop", "unrolled_loop" for expanding inline loop, "libcall" for always expanding library call.
- -momit-leaf-frame-pointer
- Don't keep the frame pointer in a register for leaf functions. This avoids the instructions to save, set up and restore frame pointers and makes an extra register available in leaf functions. The option -fomit-frame-pointer removes the frame pointer for all functions which might make debugging harder.
- -mtls-direct-seg-refs
- -mno-tls-direct-seg-refs
-
Controls whether TLS variables may be accessed with offsets from the
TLS segment register (%gs for 32-bit, %fs for 64-bit),
or whether the thread base pointer must be added. Whether or not this
is legal depends on the operating system, and whether it maps the
segment to cover the entire TLS area.
For systems that use GNU libc, the default is on.
- -msse2avx
- -mno-sse2avx
- Specify that the assembler should encode SSE instructions with VEX prefix. The option -mavx turns this on by default.
These -m switches are supported in addition to the above on AMD x86-64 processors in 64-bit environments.
- -m32
- -m64
- Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD's x86-64 architecture. For darwin only the -m64 option turns off the -fno-pic and -mdynamic-no-pic options.
- -mno-red-zone
- Do not use a so called red zone for x86-64 code. The red zone is mandated by the x86-64 ABI, it is a 128-byte area beyond the location of the stack pointer that will not be modified by signal or interrupt handlers and therefore can be used for temporary data without adjusting the stack pointer. The flag -mno-red-zone disables this red zone.
- -mcmodel=small
- Generate code for the small code model: the program and its symbols must be linked in the lower 2 GB of the address space. Pointers are 64 bits. Programs can be statically or dynamically linked. This is the default code model.
- -mcmodel=kernel
- Generate code for the kernel code model. The kernel runs in the negative 2 GB of the address space. This model has to be used for Linux kernel code.
- -mcmodel=medium
- Generate code for the medium model: The program is linked in the lower 2 GB of the address space. Small symbols are also placed there. Symbols with sizes larger than -mlarge-data-threshold are put into large data or bss sections and can be located above 2GB. Programs can be statically or dynamically linked.
- -mcmodel=large
- Generate code for the large model: This model makes no assumptions about addresses and sizes of sections.
i386 and x86-64 Windows Options
These additional options are available for Windows targets:- -mconsole
- This option is available for Cygwin and MinGW targets. It specifies that a console application is to be generated, by instructing the linker to set the PE header subsystem type required for console applications. This is the default behaviour for Cygwin and MinGW targets.
- -mcygwin
- This option is available for Cygwin targets. It specifies that the Cygwin internal interface is to be used for predefined preprocessor macros, C runtime libraries and related linker paths and options. For Cygwin targets this is the default behaviour. This option is deprecated and will be removed in a future release.
- -mno-cygwin
- This option is available for Cygwin targets. It specifies that the MinGW internal interface is to be used instead of Cygwin's, by setting MinGW-related predefined macros and linker paths and default library options. This option is deprecated and will be removed in a future release.
- -mdll
- This option is available for Cygwin and MinGW targets. It specifies that a DLL - a dynamic link library - is to be generated, enabling the selection of the required runtime startup object and entry point.
- -mnop-fun-dllimport
- This option is available for Cygwin and MinGW targets. It specifies that the dllimport attribute should be ignored.
- -mthread
- This option is available for MinGW targets. It specifies that MinGW-specific thread support is to be used.
- -mwin32
- This option is available for Cygwin and MinGW targets. It specifies that the typical Windows pre-defined macros are to be set in the pre-processor, but does not influence the choice of runtime library/startup code.
- -mwindows
- This option is available for Cygwin and MinGW targets. It specifies that a GUI application is to be generated by instructing the linker to set the PE header subsystem type appropriately.
See also under i386 and x86-64 Options for standard options.
IA-64 Options
These are the -m options defined for the Intel IA-64 architecture.- -mbig-endian
- Generate code for a big endian target. This is the default for HP-UX.
- -mlittle-endian
- Generate code for a little endian target. This is the default for AIX5 and GNU/Linux.
- -mgnu-as
- -mno-gnu-as
- Generate (or don't) code for the GNU assembler. This is the default.
- -mgnu-ld
- -mno-gnu-ld
- Generate (or don't) code for the GNU linker. This is the default.
- -mno-pic
- Generate code that does not use a global pointer register. The result is not position independent code, and violates the IA-64 ABI.
- -mvolatile-asm-stop
- -mno-volatile-asm-stop
- Generate (or don't) a stop bit immediately before and after volatile asm statements.
- -mregister-names
- -mno-register-names
- Generate (or don't) in, loc, and out register names for the stacked registers. This may make assembler output more readable.
- -mno-sdata
- -msdata
- Disable (or enable) optimizations that use the small data section. This may be useful for working around optimizer bugs.
- -mconstant-gp
- Generate code that uses a single constant global pointer value. This is useful when compiling kernel code.
- -mauto-pic
- Generate code that is self-relocatable. This implies -mconstant-gp. This is useful when compiling firmware code.
- -minline-float-divide-min-latency
- Generate code for inline divides of floating point values using the minimum latency algorithm.
- -minline-float-divide-max-throughput
- Generate code for inline divides of floating point values using the maximum throughput algorithm.
- -minline-int-divide-min-latency
- Generate code for inline divides of integer values using the minimum latency algorithm.
- -minline-int-divide-max-throughput
- Generate code for inline divides of integer values using the maximum throughput algorithm.
- -minline-sqrt-min-latency
- Generate code for inline square roots using the minimum latency algorithm.
- -minline-sqrt-max-throughput
- Generate code for inline square roots using the maximum throughput algorithm.
- -mno-dwarf2-asm
- -mdwarf2-asm
- Don't (or do) generate assembler code for the DWARF2 line number debugging info. This may be useful when not using the GNU assembler.
- -mearly-stop-bits
- -mno-early-stop-bits
- Allow stop bits to be placed earlier than immediately preceding the instruction that triggered the stop bit. This can improve instruction scheduling, but does not always do so.
- -mfixed-range=register-range
- Generate code treating the given register range as fixed registers. A fixed register is one that the register allocator can not use. This is useful when compiling kernel code. A register range is specified as two registers separated by a dash. Multiple register ranges can be specified separated by a comma.
- -mtls-size=tls-size
- Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 64.
- -mtune=cpu-type
- Tune the instruction scheduling for a particular CPU, Valid values are itanium, itanium1, merced, itanium2, and mckinley.
- -mt
- -pthread
- Add support for multithreading using the POSIX threads library. This option sets flags for both the preprocessor and linker. It does not affect the thread safety of object code produced by the compiler or that of libraries supplied with it. These are HP-UX specific flags.
- -milp32
- -mlp64
- 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. These are HP-UX specific flags.
- -mno-sched-br-data-spec
- -msched-br-data-spec
- (Dis/En)able data speculative scheduling before reload. This will result in generation of the ld.a instructions and the corresponding check instructions (ld.c / chk.a). The default is 'disable'.
- -msched-ar-data-spec
- -mno-sched-ar-data-spec
- (En/Dis)able data speculative scheduling after reload. This will result in generation of the ld.a instructions and the corresponding check instructions (ld.c / chk.a). The default is 'enable'.
- -mno-sched-control-spec
- -msched-control-spec
- (Dis/En)able control speculative scheduling. This feature is available only during region scheduling (i.e. before reload). This will result in generation of the ld.s instructions and the corresponding check instructions chk.s . The default is 'disable'.
- -msched-br-in-data-spec
- -mno-sched-br-in-data-spec
- (En/Dis)able speculative scheduling of the instructions that are dependent on the data speculative loads before reload. This is effective only with -msched-br-data-spec enabled. The default is 'enable'.
- -msched-ar-in-data-spec
- -mno-sched-ar-in-data-spec
- (En/Dis)able speculative scheduling of the instructions that are dependent on the data speculative loads after reload. This is effective only with -msched-ar-data-spec enabled. The default is 'enable'.
- -msched-in-control-spec
- -mno-sched-in-control-spec
- (En/Dis)able speculative scheduling of the instructions that are dependent on the control speculative loads. This is effective only with -msched-control-spec enabled. The default is 'enable'.
- -msched-ldc
- -mno-sched-ldc
- (En/Dis)able use of simple data speculation checks ld.c . If disabled, only chk.a instructions will be emitted to check data speculative loads. The default is 'enable'.
- -mno-sched-control-ldc
- -msched-control-ldc
- (Dis/En)able use of ld.c instructions to check control speculative loads. If enabled, in case of control speculative load with no speculatively scheduled dependent instructions this load will be emitted as ld.sa and ld.c will be used to check it. The default is 'disable'.
- -mno-sched-spec-verbose
- -msched-spec-verbose
- (Dis/En)able printing of the information about speculative motions.
- -mno-sched-prefer-non-data-spec-insns
- -msched-prefer-non-data-spec-insns
- If enabled, data speculative instructions will be chosen for schedule only if there are no other choices at the moment. This will make the use of the data speculation much more conservative. The default is 'disable'.
- -mno-sched-prefer-non-control-spec-insns
- -msched-prefer-non-control-spec-insns
- If enabled, control speculative instructions will be chosen for schedule only if there are no other choices at the moment. This will make the use of the control speculation much more conservative. The default is 'disable'.
- -mno-sched-count-spec-in-critical-path
- -msched-count-spec-in-critical-path
- If enabled, speculative dependencies will be considered during computation of the instructions priorities. This will make the use of the speculation a bit more conservative. The default is 'disable'.
M32C Options
- -mcpu=name
- Select the CPU for which code is generated. name may be one of r8c for the R8C/Tiny series, m16c for the M16C (up to /60) series, m32cm for the M16C/80 series, or m32c for the M32C/80 series.
- -msim
- Specifies that the program will be run on the simulator. This causes an alternate runtime library to be linked in which supports, for example, file I/O. You must not use this option when generating programs that will run on real hardware; you must provide your own runtime library for whatever I/O functions are needed.
- -memregs=number
- Specifies the number of memory-based pseudo-registers GCC will use during code generation. These pseudo-registers will be used like real registers, so there is a tradeoff between GCC's ability to fit the code into available registers, and the performance penalty of using memory instead of registers. Note that all modules in a program must be compiled with the same value for this option. Because of that, you must not use this option with the default runtime libraries gcc builds.
M32R/D Options
These -m options are defined for Renesas M32R/D architectures:- -m32r2
- Generate code for the M32R/2.
- -m32rx
- Generate code for the M32R/X.
- -m32r
- Generate code for the M32R. This is the default.
- -mmodel=small
-
Assume all objects live in the lower 16MB of memory (so that their addresses
can be loaded with the "ld24" instruction), and assume all subroutines
are reachable with the "bl" instruction.
This is the default.
The addressability of a particular object can be set with the "model" attribute.
- -mmodel=medium
- Assume objects may be anywhere in the 32-bit address space (the compiler will generate "seth/add3" instructions to load their addresses), and assume all subroutines are reachable with the "bl" instruction.
- -mmodel=large
- Assume objects may be anywhere in the 32-bit address space (the compiler will generate "seth/add3" instructions to load their addresses), and assume subroutines may not be reachable with the "bl" instruction (the compiler will generate the much slower "seth/add3/jl" instruction sequence).
- -msdata=none
-
Disable use of the small data area. Variables will be put into
one of .data, bss, or .rodata (unless the
"section" attribute has been specified).
This is the default.
The small data area consists of sections .sdata and .sbss. Objects may be explicitly put in the small data area with the "section" attribute using one of these sections.
- -msdata=sdata
- Put small global and static data in the small data area, but do not generate special code to reference them.
- -msdata=use
- Put small global and static data in the small data area, and generate special instructions to reference them.
- -G num
-
Put global and static objects less than or equal to num bytes
into the small data or bss sections instead of the normal data or bss
sections. The default value of num is 8.
The -msdata option must be set to one of sdata or use
for this option to have any effect.
All modules should be compiled with the same -G num value. Compiling with different values of num may or may not work; if it doesn't the linker will give an error message---incorrect code will not be generated.
- -mdebug
- Makes the M32R specific code in the compiler display some statistics that might help in debugging programs.
- -malign-loops
- Align all loops to a 32-byte boundary.
- -mno-align-loops
- Do not enforce a 32-byte alignment for loops. This is the default.
- -missue-rate=number
- Issue number instructions per cycle. number can only be 1 or 2.
- -mbranch-cost=number
- number can only be 1 or 2. If it is 1 then branches will be preferred over conditional code, if it is 2, then the opposite will apply.
- -mflush-trap=number
- Specifies the trap number to use to flush the cache. The default is 12. Valid numbers are between 0 and 15 inclusive.
- -mno-flush-trap
- Specifies that the cache cannot be flushed by using a trap.
- -mflush-func=name
- Specifies the name of the operating system function to call to flush the cache. The default is _flush_cache, but a function call will only be used if a trap is not available.
- -mno-flush-func
- Indicates that there is no OS function for flushing the cache.
M680x0 Options
These are the -m options defined for M680x0 and ColdFire processors. The default settings depend on which architecture was selected when the compiler was configured; the defaults for the most common choices are given below.- -march=arch
-
Generate code for a specific M680x0 or ColdFire instruction set
architecture. Permissible values of arch for M680x0
architectures are: 68000, 68010, 68020,
68030, 68040, 68060 and cpu32. ColdFire
architectures are selected according to Freescale's ISA classification
and the permissible values are: isaa, isaaplus,
isab and isac.
gcc defines a macro __mcfarch__ whenever it is generating code for a ColdFire target. The arch in this macro is one of the -march arguments given above.
When used together, -march and -mtune select code that runs on a family of similar processors but that is optimized for a particular microarchitecture.
- -mcpu=cpu
-
Generate code for a specific M680x0 or ColdFire processor.
The M680x0 cpus are: 68000, 68010, 68020,
68030, 68040, 68060, 68302, 68332
and cpu32. The ColdFire cpus are given by the table
below, which also classifies the CPUs into families:
-
- Family : -mcpu arguments
- 51qe : 51qe
- 5206 : 5202 5204 5206
- 5206e : 5206e
- 5208 : 5207 5208
- 5211a : 5210a 5211a
- 5213 : 5211 5212 5213
- 5216 : 5214 5216
- 52235 : 52230 52231 52232 52233 52234 52235
- 5225 : 5224 5225
- 5235 : 5232 5233 5234 5235 523x
- 5249 : 5249
- 5250 : 5250
- 5271 : 5270 5271
- 5272 : 5272
- 5275 : 5274 5275
- 5282 : 5280 5281 5282 528x
- 5307 : 5307
- 5329 : 5327 5328 5329 532x
- 5373 : 5372 5373 537x
- 5407 : 5407
- 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484 5485
-
-mcpu=cpu overrides -march=arch if arch is compatible with cpu. Other combinations of -mcpu and -march are rejected.
gcc defines the macro __mcf_cpu_cpu when ColdFire target cpu is selected. It also defines __mcf_family_family, where the value of family is given by the table above.
-
- -mtune=tune
-
Tune the code for a particular microarchitecture, within the
constraints set by -march and -mcpu.
The M680x0 microarchitectures are: 68000, 68010,
68020, 68030, 68040, 68060
and cpu32. The ColdFire microarchitectures
are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
You can also use -mtune=68020-40 for code that needs to run relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60 is similar but includes 68060 targets as well. These two options select the same tuning decisions as -m68020-40 and -m68020-60 respectively.
gcc defines the macros __mcarch and __mcarch__ when tuning for 680x0 architecture arch. It also defines mcarch unless either -ansi or a non-GNU -std option is used. If gcc is tuning for a range of architectures, as selected by -mtune=68020-40 or -mtune=68020-60, it defines the macros for every architecture in the range.
gcc also defines the macro __muarch__ when tuning for ColdFire microarchitecture uarch, where uarch is one of the arguments given above.
- -m68000
- -mc68000
-
Generate output for a 68000. This is the default
when the compiler is configured for 68000-based systems.
It is equivalent to -march=68000.
Use this option for microcontrollers with a 68000 or EC000 core, including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
- -m68010
- Generate output for a 68010. This is the default when the compiler is configured for 68010-based systems. It is equivalent to -march=68010.
- -m68020
- -mc68020
- Generate output for a 68020. This is the default when the compiler is configured for 68020-based systems. It is equivalent to -march=68020.
- -m68030
- Generate output for a 68030. This is the default when the compiler is configured for 68030-based systems. It is equivalent to -march=68030.
- -m68040
-
Generate output for a 68040. This is the default when the compiler is
configured for 68040-based systems. It is equivalent to
-march=68040.
This option inhibits the use of 68881/68882 instructions that have to be emulated by software on the 68040. Use this option if your 68040 does not have code to emulate those instructions.
- -m68060
-
Generate output for a 68060. This is the default when the compiler is
configured for 68060-based systems. It is equivalent to
-march=68060.
This option inhibits the use of 68020 and 68881/68882 instructions that have to be emulated by software on the 68060. Use this option if your 68060 does not have code to emulate those instructions.
- -mcpu32
-
Generate output for a CPU32. This is the default
when the compiler is configured for CPU32-based systems.
It is equivalent to -march=cpu32.
Use this option for microcontrollers with a CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 68336, 68340, 68341, 68349 and 68360.
- -m5200
-
Generate output for a 520X ColdFire CPU. This is the default
when the compiler is configured for 520X-based systems.
It is equivalent to -mcpu=5206, and is now deprecated
in favor of that option.
Use this option for microcontroller with a 5200 core, including the MCF5202, MCF5203, MCF5204 and MCF5206.
- -m5206e
- Generate output for a 5206e ColdFire CPU. The option is now deprecated in favor of the equivalent -mcpu=5206e.
- -m528x
- Generate output for a member of the ColdFire 528X family. The option is now deprecated in favor of the equivalent -mcpu=528x.
- -m5307
- Generate output for a ColdFire 5307 CPU. The option is now deprecated in favor of the equivalent -mcpu=5307.
- -m5407
- Generate output for a ColdFire 5407 CPU. The option is now deprecated in favor of the equivalent -mcpu=5407.
- -mcfv4e
- Generate output for a ColdFire V4e family CPU (e.g. 547x/548x). This includes use of hardware floating point instructions. The option is equivalent to -mcpu=547x, and is now deprecated in favor of that option.
- -m68020-40
-
Generate output for a 68040, without using any of the new instructions.
This results in code which can run relatively efficiently on either a
68020/68881 or a 68030 or a 68040. The generated code does use the
68881 instructions that are emulated on the 68040.
The option is equivalent to -march=68020 -mtune=68020-40.
- -m68020-60
-
Generate output for a 68060, without using any of the new instructions.
This results in code which can run relatively efficiently on either a
68020/68881 or a 68030 or a 68040. The generated code does use the
68881 instructions that are emulated on the 68060.
The option is equivalent to -march=68020 -mtune=68020-60.
- -mhard-float
- -m68881
- Generate floating-point instructions. This is the default for 68020 and above, and for ColdFire devices that have an FPU. It defines the macro __HAVE_68881__ on M680x0 targets and __mcffpu__ on ColdFire targets.