I think you need to review a couple of cases when some functions, declared as non-exported, are included in
a binary file of the shared library. I would consider cases:
1. If some 'FunctionA' is declared as inline, has implementation in a header file, and called at least
once in your codes onlythenithas to be included in a binary file ( this is expected result )
2.If some 'FunctionB' is declared as inline, has implementation in a header file, and not called at all in
any codes then it doesn't have to be included in a binary file ( this is expected result ).If it is included
then it looks like there is a problem with a C/C++ compiler.
The Boost is a huge template library andasimpleC++ templates-based test-case that uses atest shared
library, with some set offunctions declared differently,could helpto understand the problem.
32053 2012-03-29 09:57 t_gcc_ia32.so
30388 2012-03-29 09:56 t_icc_ia32.so
43273 2012-03-29 09:51 t_gcc_x64.so
15513 2012-03-29 09:50 t_icc_x64.so
cmd used is from your posting with "-fPIC": icpc -fPIC -shared t.cpp -fvisibility=hidden -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -Wl,--gc-sections -o t.so
So I might have missed something. Please let me know if the above is the what you have. We'd like to improve the code size issue if possible.
With the "grep" cmd, I did see the big difference in the symbols being exported.
Let me file a bug to the compiler about this issue, but I'm not sure how likely it can be addressed in the current release though.