General Options - 2021.2 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2021-12-15
Version
2021.2 English
-E
Preprocess only; do not compile, assemble and link. The preprocessed output displays on the standard out device.
-S
Compile only; do not assemble and link. Generates a .s file.
-c
Compile and assemble only; do not link. Generates a .o file.
-g
This option adds DWARF2-based debugging information to the output file. The debugging information is required by the GNU debugger, mb-gdb or arm-none-eabi-gdb. The debugger provides debugging at the source and the assembly level. This option adds debugging information only when the input is a C/C++ source file.
-gstabs
Use this option for adding STABS-based debugging information on assembly (.S) files and assembly file symbols at the source level. This is an assembler option that is provided directly to the GNU assembler, mb-as or arm-none-eabi-as. If an assembly file is compiled using the compiler mb-gcc or arm-none-eabi-gcc, prefix the option with -Wa.
-On
The GNU compiler provides optimizations at different levels. The optimization levels in the following table apply only to the C and C++ source files.
Table 1. Optimizations for Values of n
n Optimization
0 No optimization.
1 Medium optimization.
2 Full optimization
3 Full optimization. Attempt automatic inlining of small subprograms.
S Optimize for size.
Note: Optimization levels 1 and above cause code re-arrangement. While debugging your code, use of no optimization level is recommended. When an optimized program is debugged through GDB, the displayed results might seem inconsistent.
-v
This option executes the compiler and all the tools underneath the compiler in verbose mode. This option gives complete description of the options passed to all the tools. This description is helpful in discovering the default options for each tool.
-save-temps
The GNU compiler provides a mechanism to save the intermediate files generated during the compilation process. The compiler stores the following files:
  • Preprocessor output -input_file_name.i for C code and input_file_name.ii for C++ code
  • Compiler (cc1) output in assembly format - input_file_name.s
  • Assembler output in ELF format - input_file_name.s

The compiler saves the default output of the entire compilation as a.out.

-o filename
The compiler stores the default output of the compilation process in an ELF file named a.out. You can change the default name using -o output_file_name. The output file is created in ELF format.
-Wp,<option>, -Wa,<option>, and -Wl,<option>
The compiler, mb-gcc or arm-none-eabi-gcc, is a wrapper around other executables such as the preprocessor, compiler (cc1), assembler, and the linker. You can run these components of the compiler individually or through the top level compiler.

There are certain options that are required by tools, but might not be necessary for the top-level compiler. To run these commands, use the options listed in the following table.

Table 2. Tool-Specific Options Passed to the Top-Level GCC Compiler
Option Tool Example
-Wp,<option> Preprocessor
mb-gcc -Wp,-D -Wp, MYDEFINE ...

Signal the pre-processor to define the symbol MYDEFINE with the -D MYDEFINE option.

-Wa,<option> Assembler
mb-as -Wa, ...

Signal the assembler to target the MicroBlaze processor.

-Wl,<option> Linker
mb-gcc -Wl,-M ...

Signal the linker to produce a map file with the -M option.

-help
Use this option with any GNU compiler to get more information about the available options. You can also consult the GCC manual.
-B directory
Add directory to the C runtime library search paths.
-L directory
Add directory to the library search path.
-I directory
Add directory to header search path.
-l library
Search library for undefined symbols.
Note: The compiler prefixes “lib” to the library name indicated in this command line switch.