Generates an assembler language file (.s) for each source file. The resulting .s files can be assembled to produce object .o files or an executable file (a.out).


Read syntax diagramSkip visual syntax diagram>>- -S---------------------------------------------------------><


You can invoke the assembler with the xlc++ command. For example,

xlc++ myprogram.s

will invoke the assembler, and if successful, the loader to create an executable file, a.out.

If you specify -S with -E or -P, -E or -P takes precedence. Order of precedence holds regardless of the order in which they were specified on the command line.

You can use the -o option to specify the name of the file produced only if no more than one source file is supplied. For example, the following is not valid:

xlc++ myprogram1.C myprogram2.C -o -S


The generated assembler files do not include all the data that is included in a .o file by the -g or -qipa options.


  1. To compile myprogram.C to produce an assembler language file myprogram.s, enter:
    xlc++ myprogram.C -S
  2. To assemble this program to produce an object file myprogram.o, enter:
    xlc++ myprogram.s -c
  3. To compile myprogram.C to produce an assembler language file asmprogram.s, enter:
    xlc++ myprogram.C -S -o asmprogram.s

Related information