-W(-X)

Purpose

Passes one or more options to a component that is executed during compilation.

Syntax

Read syntax diagramSkip visual syntax diagram-X assemblerpreprocessorlinker1option
Notes:
  • 1 You must insert at least one space before option.
Read syntax diagramSkip visual syntax diagram -W abcCEfgLlmop ,option

Parameters

option
Any option that is valid for the component to which it is being passed.

For -X, for details about the options for linking and assembling, see the GNU Compiler Collection online documentation at http://gcc.gnu.org/onlinedocs/ .

The following table shows the correspondence between -X and -W parameters and the component names:

Parameter of -W Parameter of -X Description Component name
a assembler The assembler as
b llc The low-level optimizer xlCcode
c   The compiler front end xlcentry, xlCentry
C++ only C   The C++ compiler front end xlCentry
c, C   The C and C++ compiler front end xlCentry
E   The CreateExportList utility CreateExportList
C++ only f   The c++filt utility c++filt
g lto The LTO linker plugin libLTO.so
L linker The linker when LTO is enabled ld
l (lowercase L) linker The linker when LTO is disabled ld
C++ only m   The linkage helper munch
o opt The high-level optimizer, compile step ibm-opt
p   The preprocessor xlCentry

Usage

In the string following the -W option, use a comma as the separator for each option, and do not include any spaces. For the -X option, one space is needed before the option. If you need to include a character that is special to the shell in the option string, precede the character with a backslash. For example, if you use the -W option in the configuration file, you can use the escape sequence backslash comma (\,) to represent a comma in the parameter string.

You do not need the -W option to pass most options to the linker ld; unrecognized command-line options, except -q options, are passed to it automatically. Only linker options with the same letters as compiler options, such as -v or -S, strictly require -W.

Predefined macros

None.

Examples

To compile the file file.c and pass the linker option -berok to the linker, enter the following command:
ibm-clang -Wl,-berok file.c
To compile the file uses_many_symbols.c and the assembly file produces_warnings.s so that produces_warnings.s is assembled with the assembler option , and the object files are linked with the option -s (write list of object files and strip final executable file), issue the following command:
ibm-clang -Xassembler -alh produces_warnings.s -Xlinker -s uses_many_symbols.c 
ibm-clang -Wa,-alh produces_warnings.s -Wl,-s uses_many_symbols.c

Related information