Compatibility with GNU

XL C/C++ supports a subset of the GNU compiler command options to facilitate porting applications developed with gcc and g++ compilers.

This support is available when the gxlc or gxlc++ invocation command is used together with select GNU compiler options. Where possible, the compiler maps GNU options to their XL C/C++ compiler option counterparts before invoking the compiler.

These invocation commands use a plain text configuration file to control GNU-to-XL C/C++ option mappings and defaults. You can customize this configuration file to better meet the needs of any unique compilation requirements you may have. See "Reusing GNU C/C++ compiler options with gxlc and gxlc++" for more information.

XL C/C++ uses GNU C and GNU C++ header files together with the GNU C and C++ runtime libraries to produce code that is binary-compatible with that produced by the GNU Compiler Collection (GCC). Portions of an application can be built with XL C/C++ and combined with portions built with GCC to produce an application that behaves as if it had been built solely with GCC.

To achieve binary compatibility with GCC-compiled code, a program compiled with XL C/C++ includes the same headers as those used by a GNU compiler residing on the same system. To ensure that the proper versions of headers and runtime libraries are present on the system, the prerequisite GCC compiler must be installed before installing XL C/C++.

Some additional noteworthy points about this relationship are:
  • IBM® built-in functions coexist with GNU C built-ins.
  • Compilation of C and C++ programs uses the GNU C and GNU C++ header files.
  • Compilation uses the GNU assembler for assembler input files.
  • Compiled C code is linked to the GNU C runtime libraries.
  • Compiled C++ code is linked to the GNU C and GNU C++ runtime libraries.
  • Debugging uses the GNU debugger, gdb