Each of the gxlc and gxlc++ utilities accepts GNU C or C++ compiler options
and translates them into comparable XL C/C++ options. Both utilities
use the XL C/C++ options to create an xlc or xlC
invocation command, which they then use to invoke XL C/C++. These
utilities are provided to facilitate the reuse of make files created for
applications previously developed with GNU C and C++. However, to fully
exploit the capabilities of XL C/C++, it is recommended that you use the XL
C/C++ invocation commands and their associated options.
The actions of gxlc and gxlc++ are controlled by the configuration file
gxlc.cfg. The GNU C and C++ options that have an XL C
or XL C++ counterpart are shown in this file. Not every GNU option has
a corresponding XL C/C++ option. gxlc and gxlc++ return warnings for
input options that were not translated.
The gxlc and gxlc++ option mappings are modifiable. For information
on adding to or editing the gxlc and gxlc++ configuration file, see Configuring the option mapping.
Example
To use the gcc -ansi option to compile the C version of the
Hello World program, you can use:
gxlc -ansi hello.c
which translates into:
xlc -F:c89 hello.c
This command is then used to invoke the XL C compiler.
gxlc and gxlc++ return codes
Like other invocation commands, gxlc and gxlc++ return output, such as
listings, diagnostic messages related to the compilation, warnings related to
unsuccessful translation of GNU options, and return codes. If gxlc or
gxlc++ cannot successfully call the compiler, it sets the return code to one
of the following values:
- 40
- A gcc or g++ option error or unrecoverable error has been detected.
- 255
- An error has been detected while the process was running.
Related References
The following diagram shows the gxlc and gxlc++ syntax:
>>-+-gxlc---+--+------+--+-----------------------------+--+--------------------+--filename-><
'-gxlc++-' +- -v--+ '- -Wx,--xlc_or_xlc++_options-' '-gcc_or_g++_options-'
'- -vv-'
where:
- filename
- Is the name of the file to be compiled.
- -v
- Allows you to verify the command that will be used to invoke XL
C/C++. gxlc or gxlc++ displays the XL C/C++ invocation command that it
has created, before using it to invoke the compiler.
- -vv
- Allows you to run a simulation. gxlc or gxlc++ displays the XL
C/C++ invocation command that it has created, but does not invoke the
compiler.
- -Wx,xlc_or_xlc++_options
- Sends the given XL C/C++ options directly to the xlc or
xlc++ invocation command. gxlc or gxlc++ adds the given
options to the XL C/C++ invocation it is creating, without attempting to
translate them. Use this option with known XL C/C++ options to improve
the performance of the utility. Multiple
xlc_or_xlc++_options use a comma delimiter.
- gcc_or_g++_options
- Are the gcc or g++ options that are to be translated to
xlc or xlc++ options. The utility emits a warning
for any option it cannot translate. The gcc and g++ options that are
currently recognized by gxlc and gxlc++ are listed in the configuration file
gxlc.cfg. Multiple gcc_or_g++_options are delimited by the space
character.
Related References
The following table lists the GNU C and C++ options that are accepted and
translated by gxlc and gxlc++. All other GNU options that are specified
as input to one of these utilities are ignored or generate an error. If
the negative form of a GNU option exists, then the negative form is also
recognized and translated by gxlc and gxlc++.
Mapped options: GNU C and C++ to XL C/C++
|
GNU C and C++ option
| XL C/C++ option
|
-###
| -#
|
-ansi
| -F:c89
|
-B
| -B
|
-C
| -C
|
-c
| -c
|
-Dmacro[=defn]
| -Dmacro[=defn]
|
-E
| -E
|
-e
| -e
|
-fdollars-in-identifiers
| -qdollar
|
-fdump-class-hierarchy
| -qdump_class_hierarchy
|
-fexceptions
| -qeh
|
-ffor-scope
| -qlanglvl=ansifor
|
-fno-for-scope
| -qlanglvl=noansifor
|
-ffunction-sections
| -qfuncsect
|
-finline
| -qinline
|
-finline-functions
| -qinline
- Note:
- The -qinline=limit=n is not a valid suboption in XL
C/C++. The -finline-limit=n GNU C and C++ suboption cannot
be mapped to this XL C/C++suboption.
|
-fkeep-inline-functions
| -qkeepinlines
|
-fno-gnu-keywords
| -qnokeyword=typeof
|
-fno-operator-names
| -qnokeyword=and -qnokeyword=bitand -qnokeyword=bitor -qnokeyword=compl
-qnokeyword=not -qnokeyword=or -qnokeyword=xor
|
-fpascal-strings
| -qmacpstr
|
-fPIC
| -qpic=large
|
-fpic
| -qpic=small
|
-frtti
| -qrtti
|
-fshort-enums
| -qenum=small
|
-fsigned-bitfields
| -qbitfields=signed
|
-fsigned-char
| -qchars=signed
|
-fstrict-aliasing
| -qalias=ansi
|
-fsyntax-only
| -qsyntaxonly
|
-funroll-all-loops
| -qunroll=yes
|
-funroll-loops
| -qunroll=yes
|
-funsigned-bitfields
| -qbitfields=unsigned
|
-funsigned-char
| -qchars=unsigned
|
-fwritable-strings
| -qnoro
|
-g
| -g
|
-g3
| -g
|
-gdwarf
| -g
|
-ggdb
| -g
|
-Idir
| -Idir
|
-Ldir
| -Ldir
|
-llibrary
| -llibrary
|
-M
| -M
|
-MD
| -M
|
-mcpu=power
| -qarch=pwr
|
-mcpu=powerpc
| -qarch=ppc
|
-mcpu=powerpc64
| -qarch=ppc64
|
-mno-fused-madd
| -qfloat=nomaf
|
-mfused-madd
| -qfloat=maf
|
-mlong-double-64
| -qnolonglong
|
-mlong-double-128
| -qlonglong
|
-mpower
| -qarch=pwr
|
-mpowerpc
| -qarch=ppc
|
-mpowerpc64
| -qarch=ppc64
|
-mtune=power
| -qtune=pwr
|
-mtune=powerpc
| -qtune=ppc
|
-mtune=powerpc64
| -qtune=ppc64
|
-nodefaultlibs
| -qnolib
|
-nostartfiles
| -qnocrt
|
-nostdinc
| -qnostdinc
|
-nostdlib
| -qnolib -qnocrt
|
-O
| -O
|
-O0
| -qnoopt
|
-O1
| -O
|
-O2
| -O2
|
-O3
| -O3
|
-Os
| -O2 -qcompact
|
-o
| -o
|
-p
| -p
|
-pg
| -pg
|
-r
| -r
|
-S
| -S
|
-s
| -s
|
-std=c89
| -F:c89
|
-std=iso9899:1990
| -F:c89
|
-std=iso9899:199409
| -F:c89
|
-std=c99
| -F:c99
|
-std=c9x
| -F:c99
|
-std=iso9899:1999
| -F:c99
|
-std=iso9899:199x
| -F:c99
|
-std=gnu89
| -qlanglvl=extc89
|
-std=gnu99
| -qlanglvl=extc99
|
-std=gnu9x
| -qlanglvl=extc99
|
-std=c++98
| -qlanglvl=strict98
|
-std=gnu++98
| -qlanglvl=extended
|
-time
| -qphsinfo
|
-trigraphs
| -qtrigraph
|
-Umacro
| -Umacro
|
-u
| -u
|
-Wformat
| -qformat
|
-Wuninitialized
| -qinfo=ini
|
-Wunreachable-code
| -qinfo=eff
|
-Wa,option
| -Wa,option
|
-Wl,option
| -Wl,option
|
-Wp,option
| -Wp,option
|
-w
| -w
|
-x assembler
| -qsourcetype=assembler
|
-x c
| -qsourcetype=c
|
-x c++
| -qsourcetype=c++
|
-x none
| -qsourcetype=default
|
-Z
| -Z
|
All other GNU options are ignored and issue an informational
message.
Related References
The gxlc and gxlc++ utilities use the configuration file
gxlc.cfg to translate GNU C and C++ options to XL C/C++
options. Each entry in gxlc.cfg describes how the
utility should map a GNU C or C++ option to an XL C/C++ option and how to
process it.
An entry consists of a string of flags for the processing
instructions, a string for the GNU C option, and a string for the XL C/C++
option. The three fields must be separated by whitespace. If an
entry contains only the first two fields and the XL C/C++ option string is
omitted, the GNU C option in the second field will be recognized by gxlc and
silently ignored.
The # character is used to insert comments in
the configuration file. A comment can be placed on its own line, or at
the end of an entry.
The following syntax is used for an entry in
gxlc.cfg:
abcd "gcc_or_g++_option" "xlc_or_xlc++_option"
where:
- a
- Lets you disable the option by adding no- as a
prefix. The value is either y for yes, or n for
no. For example, if the flag is set to y, then
finline can be disabled as fno-inline, and the entry
is:
ynn* "-finline" "-qinline"
If given -fno-inline, then gxlc will translate it to
-qnoinline.
- b
- Informs the utility that the XL C/C++ option has an associated
value. The value is either y for yes, or n for
no. For example, if option -fmyvalue=n maps to
-qmyvalue=n, then the flag is set to y, and
the entry is:
nyn* "-fmyvalue" "-qmyvalue"
gxlc and gxlc++ will then expect a value for these options.
- c
- Controls the processing of the options. The value can be:
- n, which tells the utility to process the option listed in the
gcc-option field
- i, which tells the utility to ignore the option listed in the
gcc-option field. gxlc and gxlc++ will generate a message that this has
been done, and continue processing the given options.
- e, which tells the utility to halt processing if the option
listed in the gcc-option field is encountered. gxlc and gxlc++ will
also generate an error message.
For example, the gcc option -I- is not supported and must be
ignored by gxlc and gxlc++. In this case, the flag is set to
i, and the entry is:
nni* "-I-"
If gxlc and gxlc++ encounters this option as input, it will not process it
and will generate a warning.
- d
- Lets gxlc and gxlc++ include or ignore an option based on the type of
compiler. The value can be:
- c, which tells gxlc and gxlc++ to translate the option only for
C.
- x, which tells gxlc and gxlc++ to translate the option only for
C++.
- *, which tells gxlc and gxlc++ to translate the option for C
and C++.
For example, -fwritable-strings is supported by both compilers,
and maps to -qnoro. The entry is:
nnn* "-fwritable-strings" "-qnoro"
- "gcc_or_g++_option"
- Is a string representing a gcc or g++ option supported by GNU C, Version
3.3. This field is required and must appear in double quotation
marks.
- "xlc_or_xlc++_option"
- Is a string representing an XL C/C++ option. This field is
optional, and, if present, must appear in double quotation marks. If
left blank, gxlc and gxlc++ ignores the gcc_or_g++_option in that
entry.
It is possible to create an entry that will map a range of options.
This is accomplished by using the asterisk (*) as a
wildcard. For example, the gcc -D option requires a
user-defined name and can take an optional value. It is possible to
have the following series of options:
-DCOUNT1=100
-DCOUNT2=200
-DCOUNT3=300
-DCOUNT4=400
Instead of creating an entry for each version of this option, the single
entry is:
nnn* "-D*" "-D*"
where the asterisk will be replaced by any string following the
-D option.
Conversely, you can use the asterisk to exclude a range of options.
For example, if you want gxlc or gxlc++ to ignore all the -std
options, then the entry would be:
nni* "-std*"
When the asterisk is used in an option definition, option flags
a and b are not applicable to
these entries.
The character % is used with a GNU C or GNU
C++ option to signify that the option has associated parameters. This
is used to insure that gxlc or gxlc++ will ignore the parameters associated
with an option that is ignored. For example, the -include
option is not supported and uses a parameter. Both must be ignored by
the application. In this case, the entry is:
nni* "-include %"
Related References
