From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25500 invoked by alias); 23 Apr 2008 06:28:13 -0000 Received: (qmail 25344 invoked by uid 48); 23 Apr 2008 06:27:37 -0000 Date: Wed, 23 Apr 2008 06:28:00 -0000 Subject: [Bug c++/36022] New: stl templates exported as weak symbols though visibility hidden is used X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mh+gcc at glandium dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg01615.txt.bz2 With the following foo.cpp sample: #include __attribute__((visibility("default"))) void foo() { int array[] = { 23, 5, -10, 0, 0, 321, 1, 2, 99, 30 }; int elements = sizeof(array) / sizeof(array[0]); std::sort(array, array + elements); } Building with the following command line: g++-4.3 -shared -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -o foo.so foo.cpp Leads to internals being exposed, which is unexpected: objdump -T -C test2.so | grep std 000000000000136d w DF .text 000000000000003a Base void std::__unguarded_insertion_sort(int*, int*) 0000000000001b18 w DF .text 0000000000000057 Base void std::sort(int*, int*) 000000000000147f w DF .text 000000000000000e Base std::__niter_base::__b(int*) 000000000000190b w DF .text 0000000000000021 Base std::__lg(long) 0000000000001324 w DF .text 0000000000000049 Base void std::__unguarded_linear_insert(int*, int) 000000000000141f w DF .text 0000000000000060 Base int* std::__unguarded_partition(int*, int*, int) 0000000000001674 w DF .text 0000000000000088 Base void std::make_heap(int*, int*) 0000000000001400 w DF .text 000000000000001f Base void std::iter_swap(int*, int*) 00000000000013b5 w DF .text 000000000000002c Base void std::swap(int&, int&) 00000000000016fc w DF .text 0000000000000054 Base void std::__pop_heap(int*, int*, int*) 00000000000019bc w DF .text 000000000000004f Base int* std::__copy_move_backward_a2(int*, int*, int*) 0000000000001a4b w DF .text 0000000000000079 Base void std::__insertion_sort(int*, int*) 0000000000001a0b w DF .text 0000000000000040 Base int* std::copy_backward(int*, int*, int*) 0000000000001750 w DF .text 000000000000005d Base void std::__heap_select(int*, int*, int*) 0000000000001284 w DF .text 00000000000000a0 Base int const& std::__median(int const&, int const&, int const&) 00000000000017ad w DF .text 000000000000002b Base void std::pop_heap(int*, int*) 000000000000152e w DF .text 0000000000000146 Base void std::__adjust_heap(int*, long, long, int) 00000000000013a7 w DF .text 000000000000000e Base std::__miter_base::__b(int*) 000000000000180f w DF .text 0000000000000034 Base void std::partial_sort(int*, int*, int*) 00000000000017d8 w DF .text 0000000000000037 Base void std::sort_heap(int*, int*) 0000000000001991 w DF .text 000000000000002b Base int* std::__copy_move_backward_a(int*, int*, int*) 0000000000001ac4 w DF .text 0000000000000054 Base void std::__final_insertion_sort(int*, int*) 0000000000001843 w DF .text 00000000000000c8 Base void std::__introsort_loop(int*, int*, long) 000000000000192c w DF .text 0000000000000065 Base int* std::__copy_move_backward::__copy_move_b(int const*, int const*, int*) 00000000000013e1 w DF .text 000000000000001f Base void std::__iter_swap::iter_swap(int*, int*) 000000000000148d w DF .text 00000000000000a1 Base void std::__push_heap(int*, long, long, int) FYI: g++-4.3 -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure linux gnu Thread model: posix gcc version 4.3.1 20080401 (prerelease) (Debian 4.3.0-3) (it also happens with g++-4.2 from debian (4.2.3)) -- Summary: stl templates exported as weak symbols though visibility hidden is used Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mh+gcc at glandium dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36022