public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mh+gcc at glandium dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/36022]  New: stl templates exported as weak symbols though visibility hidden is used
Date: Wed, 23 Apr 2008 06:28:00 -0000	[thread overview]
Message-ID: <bug-36022-16100@http.gcc.gnu.org/bugzilla/> (raw)

With the following foo.cpp sample:
#include <algorithm>

__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*, int*)
0000000000001b18  w   DF .text  0000000000000057  Base        void
std::sort<int*>(int*, int*)
000000000000147f  w   DF .text  000000000000000e  Base       
std::__niter_base<int*, false>::__b(int*)
000000000000190b  w   DF .text  0000000000000021  Base        std::__lg(long)
0000000000001324  w   DF .text  0000000000000049  Base        void
std::__unguarded_linear_insert<int*, int>(int*, int)
000000000000141f  w   DF .text  0000000000000060  Base        int*
std::__unguarded_partition<int*, int>(int*, int*, int)
0000000000001674  w   DF .text  0000000000000088  Base        void
std::make_heap<int*>(int*, int*)
0000000000001400  w   DF .text  000000000000001f  Base        void
std::iter_swap<int*, int*>(int*, int*)
00000000000013b5  w   DF .text  000000000000002c  Base        void
std::swap<int>(int&, int&)
00000000000016fc  w   DF .text  0000000000000054  Base        void
std::__pop_heap<int*>(int*, int*, int*)
00000000000019bc  w   DF .text  000000000000004f  Base        int*
std::__copy_move_backward_a2<false, int*, int*>(int*, int*, int*)
0000000000001a4b  w   DF .text  0000000000000079  Base        void
std::__insertion_sort<int*>(int*, int*)
0000000000001a0b  w   DF .text  0000000000000040  Base        int*
std::copy_backward<int*, int*>(int*, int*, int*)
0000000000001750  w   DF .text  000000000000005d  Base        void
std::__heap_select<int*>(int*, int*, int*)
0000000000001284  w   DF .text  00000000000000a0  Base        int const&
std::__median<int>(int const&, int const&, int const&)
00000000000017ad  w   DF .text  000000000000002b  Base        void
std::pop_heap<int*>(int*, int*)
000000000000152e  w   DF .text  0000000000000146  Base        void
std::__adjust_heap<int*, long, int>(int*, long, long, int)
00000000000013a7  w   DF .text  000000000000000e  Base       
std::__miter_base<int*, false>::__b(int*)
000000000000180f  w   DF .text  0000000000000034  Base        void
std::partial_sort<int*>(int*, int*, int*)
00000000000017d8  w   DF .text  0000000000000037  Base        void
std::sort_heap<int*>(int*, int*)
0000000000001991  w   DF .text  000000000000002b  Base        int*
std::__copy_move_backward_a<false, int*, int*>(int*, int*, int*)
0000000000001ac4  w   DF .text  0000000000000054  Base        void
std::__final_insertion_sort<int*>(int*, int*)
0000000000001843  w   DF .text  00000000000000c8  Base        void
std::__introsort_loop<int*, long>(int*, int*, long)
000000000000192c  w   DF .text  0000000000000065  Base        int*
std::__copy_move_backward<false, true,
std::random_access_iterator_tag>::__copy_move_b<int>(int const*, int const*,
int*)
00000000000013e1  w   DF .text  000000000000001f  Base        void
std::__iter_swap<true>::iter_swap<int*, int*>(int*, int*)
000000000000148d  w   DF .text  00000000000000a1  Base        void
std::__push_heap<int*, long, int>(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


             reply	other threads:[~2008-04-23  6:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23  6:28 mh+gcc at glandium dot org [this message]
2008-05-05  5:27 ` [Bug libstdc++/36022] " pinskia at gcc dot gnu dot org
2008-05-11  9:19 ` mh+gcc at glandium dot org
2009-01-30 20:56 ` bkoz at gcc dot gnu dot org
2009-02-04  2:51 ` bkoz at gcc dot gnu dot org
2010-01-09 22:56 ` paolo dot carlini at oracle dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-36022-16100@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).