Go to main content
Oracle® Developer Studio 12.5: C User's Guide

Exit Print View

Updated: June 2017
 
 

3.2.2 Compatibility with GCC Atomics Library libatomic

If your application or library uses atomics and it needs to interoperate with executables and libraries which use the GCC version of libatomic, then you must link your Oracle Developer Studio program with the GCC version of libatomic. You must be careful to have only one version of the atomics runtime library in your program.

To link your Oracle Developer Studio C and C++ programs with the GCC version of libatomic, use the complier option –xatomic=gcc.

If you are linking and running on an older system that does not have the GCC version of libatomic in /usr/lib, then you do not have to worry about incompatible atomic support. In that circumstance, you can use libstatomic in combination with GCC binaries on that system, because no other atomics library will be in use.

The Oracle Developer Studio compiler works best with the libstatomic library, but is compatible with GCC's libatomic version 1.1, with the known issues listed below:

  • GCC 4.8 includes libatomic 1.0.0. - This version of libatomic supports C11 and C++11 atomics, if you avoid using floating point atomics in C 11 programs. The GCC 4.8 compiler itself does not support C11 until a later release.

  • GCC 4.9 and 5.1 include libatomic 1.1. - This version includes the floating-point atomics for C11, and the GCC compilers with these versions support the C11 atomics keyword.


    Note -  Your C11 program might take the address of an atomic function, which is legal only for non-generic functions. This will not work correctly with libatomic 1.0.0 or with libatomic 1.1, because the library assumes all the atomic functions will always be inlined by the compiler and don't need code in the library. You can see the list of these functions in the atomic man pages. You should use libstatomic if you need to get function pointers for these.

Oracle Linux 7.x and Oracle Solaris 11.3 include GCC 4.8 with libatomic 1.0.0.