Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Stephen_B_3
Beginner
93 Views

Extra .text.* symbols on Linux? [Intel Compiler 12.1.3]

Hi all-

Using the Intel compiler (composer_xe_2011_sp1.9.293, icpc --version returns 12.1.3 20120212) on CentOS 5.10, I'm seeing extra global (exported) text symbols for each template instantiation in my shared library.  I can reproduce this behavior with the following simple example:

int internal_func(void) { return 0; }

template<typename T> T foo(T bar) { return bar; }
template int foo<int>(int bar);  // instantiate the template

__attribute__((visibility("default"))) int api_func(void) { return internal_func(); }

Compile and strip the sample:

$ icpc -fvisibility=hidden -fPIC -shared -o tmp.so test.cxx 
$ strip -x tmp.so
$ nm tmp.so
00000000000005d0 T .text._Z3fooIiET_S0_
                 w _Jv_RegisterClasses
00000000000005e0 T _Z8api_funcv
0000000000200938 A __bss_start
                 w __cxa_finalize@@GLIBC_2.2.5
                 w __gmon_start__
                 U __gxx_personality_v0@@CXXABI_1.3
0000000000200938 A _edata
0000000000200948 A _end
0000000000000638 T _fini
00000000000004c8 T _init
$

The symbol in question is the first one, .text._Z3fooIiET_S0_.  Notice that the actual template instantiation, _Z3fooliET_S0_, was stripped as expected (it's visibility is hidden based on the compiler command line options).  Does anyone know why this extra, exported symbol exists?  Can I manually strip it without impacting the behavior of my library?

Thanks in advance,

Stephen

0 Kudos
3 Replies
Kittur_G_Intel
Employee
93 Views

Stephen, yes you're correct it happens with that version of 12.1 you're using (2.1.3 20120212) but is fixed in later versions thereof (as below).  BTW, the latest version of the compiler that's out is 15.0 and I suggest you might as well upgrade to that version (a lot of bug fixes and feature enhancements have gone into that release)

%icc --version
%icc (ICC) 12.1.6 20120928
%icpc -fvisibility=hidden -fPIC -shared -o tmp.so test.cpp
%strip -x tmp.so
%nm tmp.so
                 w _Jv_RegisterClasses
00000000000005b0 T _Z8api_funcv
0000000000200908 A __bss_start
                 w __cxa_finalize@@GLIBC_2.2.5
                 w __gmon_start__
                 U __gxx_personality_v0@@CXXABI_1.3
0000000000200908 A _edata
0000000000200918 A _end
0000000000000608 T _fini
0000000000000498 T _init

_Kittur

 

 

 

Stephen_B_3
Beginner
93 Views

Kittur-

Thanks for the update.  We know were a few versions behind, but upgrading at this point of the release cycle usually isn't a good idea.  We'll look into the point release to fix this particular problem though.

Thanks,

Stephen

Kittur_G_Intel
Employee
93 Views

Understood Stephen. BTW, the next point version doesn't show this problem.  

_Kittur 

Reply