Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7834 Discussions

Linux GCC 5.2.0 ICC 16.0.3 binutils 2.25 - Dual ABI

Konrad_L_1
Beginner
384 Views

Hi,

I'm currently starting using icc instead of the gcc.
On my Debian 8 is a gcc-4.7 as system compiler installed.
Additionally I added gcc-5.2.0 from soruce, which works pretty nice.

I need to know, if icc compiles the source file using the new ABI for std::string.

I have a libA, which compiles.
I have a libB, which depends an libA and compiles too.
If I compile the main() part, which links against the libA. I got an error:

undefined reference to `class::text[abi:cxx11]()'

 

I cannot set _GLIBCXX_USE_CXX11_ABI 0 , I need the cxx11 std::string handling.

More info:
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

https://software.intel.com/en-us/forums/intel-c-compiler/topic/591174

Thx
Konrad

0 Kudos
2 Replies
Judith_W_Intel
Employee
384 Views

 

Yes the most recent 16.0 update and the 17.0 beta Intel compilers have implemented this feature as described here:

2/17/16 
GNU compatibility: Expanded abi_tag attribute compatibility

Support for the GNU abi_tag attribute (originally introduced by EDGcpfe/15897)
has been expanded.  In particular, mangled names for functions and variables
now (when ABI_COMPATIBILITY_VERSION >= 411) will contain "implicit" abi_tags
(as well as any applicable explicit abi_tags).  The documentation for the
determination of "implicit" abi_tags consists of this single sentence: "When a
type involving an ABI tag is used as the type of a variable or return type of a
function where that tag is not already present in the signature of the
function, the tag is automatically applied to the variable or function."
Also, the abi_tag attribute is now accepted on variables and enum types.
Additionally, when a string is not specified in an abi_tag attribute that
appertains to an inline namespace, the inline namespace name is now used for
the abi_tag string.  For example (with --gnu_version 50000 --c++11):

  inline namespace N __attribute((abi_tag)) {
    struct A {};
  }
  A a;    // mangled as: _Z1aB1N (IA-64) or __ab1Na (Cfront)
  A f() { // mangled as: _Z1fB1Nv (IA-64) or __ab1Nf__Fv (Cfront)
    return A();
  }

If you have an example where you think the Intel compiler is doing the wrong mangling (i.e. it doesn't match the GNU reference compiler) please post it here or file it with Intel premier support.

thanks

Judy

0 Kudos
TimP
Black Belt
384 Views

Is your question about how to have icc use the g++ 5.2 headers and libstdc++ ?

Other methods have been suggested, but one of the more reliable ones is to set PATH and LD_LIBRARY_PATH so that the newer g++ is the one you see by g++ -v.

0 Kudos
Reply