Compilation Phase Options

Options for compilation phase.

-E

Directs the compiler to execute only the preprocessor phase of the compiler. Directs the output to stdout and inserts appropriate #line linenumber preprocessing directives. Takes precedence over the -h feonly, -S, and -c options.

Equivalent to -P, except -E directs output to stdout and inserts appropriate #line linenumber preprocessing directives. When both the -E and -P options are specified, the last one specified takes precedence.

-P

The -P option directs the compiler to execute only the preprocessor phase of the compiler for each source file specified. The preprocessed output for each source file is written to a file with a name that corresponds to the name of the source file and has a .i suffix substituted for the suffix of the source file.

Similar to the -E option. When both options are specified, the last one specified takes precedence.

-h feonly

Limits the compiler to syntax checking. The optimizer and code generator are not executed. This option takes precedence over -S and -c.

-S

Compiles the named source files and leaves their assembly language output in the corresponding files suffixed with a .s. If this option is used with -G or -g, debugging information is not generated. This option takes precedence over -c.

-c

Create a relocatable object file for each named source file but does not link the object files. The relocatable object file name corresponds to the name of the source file. The .o suffix is substituted for the suffix of the source file.

-#, -##, -###

The -# option produces output indicating each phase of the compilation as it is executed. Each succeeding output line overwrites the previous line.

The -## option produces output indicating each phase of the compilation as it is executed.

The -### option is the same as -##, except the compilation phases are not executed.

-W phase, "args"

Passes args directly to a phase of the compiling system. phase indicates a compiling system phase as shown:

PhaseCompiling System PhaseCommand
0 (zero)CompilerCC,cc
aAssemberas
cCUDA linkernvlink
llinkerld
xPTX assemberptxas
args to be passed to compiler system phases can be entered in either of two styles:
  • args enclosed in double quotes. Spaces appear within args.
  • args not enclosed in double quotes. No spaces appear within args. Commas can appear wherever spaces normally appear; an option and its argument can be either separated by a comma or not separated.
If a comma is part of an argument, it must be preceded by the \ character.

For example, any of the following command lines would send -e name to the linker.

%cc -Wl,"-e name" file.c
%cc -Wl,-e,name file.c
% cc -Wl,-ename file.c

Because the preprocessor is built into the compiler, -Wp and -W0 are equivalent.

The -Wl,-rpath ldir option changes the runtime library search algorithm to look for files in directory ldir at link time. To request more than one library directory, specify multiple -rpath options. At link time, all ldir arguments are added to the executable.

A library may be found at link time with a -L option, but may not be found at run time if a corresponding -Wl,-rpath option was not supplied. Also, note that the compiler driver does not pass the -rpath option to the linker. Explicitly specify -Wl,-rpath when using -L.

The dynamic linker will search all ldir paths first for shared dynamic libraries at runtime, with one exception. The Linux environment variable LD_LIBRARY_PATH precedes all other search paths for shared dynamically linked libraries. The use of LD_LIBRARY_PATH is discouraged! Setting LD_LIBRARY_PATH changes the shared dynamically linked library search paths for all executable files in the environment.

The -Wx, args option can be used to pass command line arguments to the PTX assembler for OpenACC applications.

The -Wc, args option can be used to pass command line arguments to the CUDA linker for OpenACC applications.

-Y phase, dirname

Specifies a new directory, dirname, from which the designated phase should be executed. phase indicates a compiling system phase as shown:

PhaseCompiling System PhaseCommand
0 (zero)CompilerCC , cc
aAssembleras
lLinkerld
Because there is no separate preprocessor, -Yp and -Y0 are equivalent.