-W

Category

Compiler customization

@PROCESS

None.

Purpose

Passes the listed options to a component that is executed during compilation.

The primary purpose of this option is to construct sequences of compiler options to pass to one of the optimizing preprocessors. It can also be used to fine-tune the link-edit step by passing parameters to the ld command.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-------.  .-----------.   
        V       |  V           |   
>>- -W----+-a-+-+----,--option-+-------------------------------><
          +-b-+                    
          +-c-+                    
          +-d-+                    
          +-E-+                    
          +-F-+                    
          +-h-+                    
          +-I-+                    
          +-L-+                    
          +-l-+                    
          '-z-'                    

Parameters

option
Any option that is valid for the component to which it is being passed. Spaces must not appear before the option.

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

Parameter Description Component name
a The assembler as
b The low-level optimizer xlfcode
c The compiler front end xlfentry
d The disassembler dis
E The CreateExportList utility CreateExportList
F The C preprocessor cpp
h The array language optimizer xlfhot
I (uppercase i) The high-level optimizer, compile step ipa
L The high-level optimizer, link step ipa
l (lowercase L) The linker ld
z The binder bolt

Usage

In the string following the -W option, use a comma as the separator for each option, and do not include any spaces. 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.

Examples

To compile the file file.f and pass the linker option -berok to the linker, enter the following command:
xlf -Wl,-berok file.f
To compile the file uses_many_symbols.f and the assembly file produces_warnings.s so that produces_warnings.s is assembled with the assembler option -x (issue warnings and produce cross-reference), and the object files are linked with the option -s (write list of object files and strip final executable file), issue the following command:.
xlf -Wa,-x -Wl,-s produces_warnings.s uses_many_symbols.f 
In the following example, the \, embeds a literal comma in the -WF string and causes three arguments, rather than four, to be supplied to the C preprocessor.
  $ xlf -qfree=f90  '-WF,-Dint1=1,-Dint2=2,-Dlist=3\,4'  a.F
  $ cat a.F
  print *, int1
  print *, int2
  print *, list
  end
The output from the program will be:
$ ./a.out
 1
 2
 3 4

Related information