------- Comment #2 from mh+gcc at glandium dot org 2008-05-11 09:18 ------- Usually, when you're using visibility hidden, that means you want to avoid exporting a lot of cruft symbols from a shared library... that the std:: namespace is always visibility default is an annoyance. Especially considering the set of exported symbols change with optimization, since some of these might end up inlined:
$ g++-4.3 -O3 -shared -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -o foo.so foo.cpp $ objdump -T -C foo.so | grep std 0000000000000780 w DF .text 00000000000002fe Base void std::__introsort_loop<int*, long>(int*, int*, long) $ g++-4.3 -O2 -shared -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -o foo.so foo.cpp $ objdump -T -C foo.so | grep std 0000000000000a40 w DF .text 00000000000000a6 Base void std::__insertion_sort<int*>(int*, int*) 00000000000008d0 w DF .text 0000000000000161 Base void std::__introsort_loop<int*, long>(int*, int*, long) 00000000000007e0 w DF .text 00000000000000eb Base void std::__adjust_heap<int*, long, int>(int*, long, long, int) $ g++-4.3 -O1 -shared -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -o foo.so foo.cpp $ objdump -T -C foo.so | grep std 0000000000000c65 w DF .text 0000000000000063 Base void std::make_heap<int*>(int*, int*) 0000000000000ee0 w DF .text 0000000000000051 Base void std::__final_insertion_sort<int*>(int*, int*) 0000000000000b52 w DF .text 0000000000000024 Base void std::__unguarded_linear_insert<int*, int>(int*, int) 0000000000000b76 w DF .text 0000000000000053 Base void std::__push_heap<int*, long, int>(int*, long, long, int) 0000000000000b10 w DF .text 0000000000000042 Base int* std::__unguarded_partition<int*, int>(int*, int*, int) 0000000000000d21 w DF .text 0000000000000053 Base void std::sort_heap<int*>(int*, int*) 0000000000000cc8 w DF .text 0000000000000059 Base void std::__heap_select<int*>(int*, int*, int*) 0000000000000e72 w DF .text 000000000000006a Base void std::__insertion_sort<int*>(int*, int*) 0000000000000d80 w DF .text 00000000000000f2 Base void std::__introsort_loop<int*, long>(int*, int*, long) 0000000000000bc9 w DF .text 000000000000009c Base void std::__adjust_heap<int*, long, int>(int*, long, long, int) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36022