Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

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

$
0
0

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


Viewing all articles
Browse latest Browse all 1616

Trending Articles