public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50270] New: Some symbols are exported even when -fvisibility=hidden is used
@ 2011-09-01 19:54 almeidaraf at gmail dot com
  2011-09-01 19:57 ` [Bug c++/50270] " almeidaraf at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: almeidaraf at gmail dot com @ 2011-09-01 19:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50270

             Bug #: 50270
           Summary: Some symbols are exported even when
                    -fvisibility=hidden is used
    Classification: Unclassified
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: almeidaraf@gmail.com


Created attachment 25169
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25169
Output of gcc -E -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -Wall
-Wextra -shared foo.c

When I compile foo.cc with the following command:

    $gcc -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -Wall -Wextra
-shared foo.cc -olibfoo.so

There are still quite a few exported symbols. For instance:
   
_ZNSt6vectorI3FooSaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0_

which should not be exported. This is what objdump -T displays:

    00000000000023b2  w   DF .text  00000000000002d2  Base       
_ZNSt6vectorI3FooSaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0_

In readelf -s it comes out in .dynsym as:

    62: 00000000000023b2   722 FUNC    WEAK   DEFAULT   12
_ZNSt6vectorI3FooSaIS0_EE

To my understanding my shared library shouldn't be exporting any symbols.

$gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
--disable-werror --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)

$lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 10.04.3 LTS
Release:    10.04
Codename:    lucid

I could not add more than one attachment, so I added gcc -E output as an
attachment and foo.cc code goes here:

#include <vector>

class __attribute__ ((visibility ("hidden"))) Foo {
 public:
  int m() {
    return 0;
  }
};


int main(void) {
  std::vector<Foo> v;
  v.push_back(Foo());
  return 0;
}


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/50270] Some symbols are exported even when -fvisibility=hidden is used
  2011-09-01 19:54 [Bug c++/50270] New: Some symbols are exported even when -fvisibility=hidden is used almeidaraf at gmail dot com
@ 2011-09-01 19:57 ` almeidaraf at gmail dot com
  2011-09-01 19:58 ` almeidaraf at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: almeidaraf at gmail dot com @ 2011-09-01 19:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50270

--- Comment #1 from Rafael Almeida <almeidaraf at gmail dot com> 2011-09-01 19:57:04 UTC ---
Created attachment 25170
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25170
Preprocessed file generated by -save-temps


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/50270] Some symbols are exported even when -fvisibility=hidden is used
  2011-09-01 19:54 [Bug c++/50270] New: Some symbols are exported even when -fvisibility=hidden is used almeidaraf at gmail dot com
  2011-09-01 19:57 ` [Bug c++/50270] " almeidaraf at gmail dot com
@ 2011-09-01 19:58 ` almeidaraf at gmail dot com
  2011-09-01 19:59 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: almeidaraf at gmail dot com @ 2011-09-01 19:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50270

--- Comment #2 from Rafael Almeida <almeidaraf at gmail dot com> 2011-09-01 19:57:50 UTC ---
Created attachment 25171
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25171
foo.s generated by -save-temps


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/50270] Some symbols are exported even when -fvisibility=hidden is used
  2011-09-01 19:54 [Bug c++/50270] New: Some symbols are exported even when -fvisibility=hidden is used almeidaraf at gmail dot com
                   ` (2 preceding siblings ...)
  2011-09-01 19:59 ` pinskia at gcc dot gnu.org
@ 2011-09-01 19:59 ` almeidaraf at gmail dot com
  2011-09-02  9:32 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: almeidaraf at gmail dot com @ 2011-09-01 19:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50270

--- Comment #3 from Rafael Almeida <almeidaraf at gmail dot com> 2011-09-01 19:58:45 UTC ---
Created attachment 25172
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25172
Output of -save-temps -v


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/50270] Some symbols are exported even when -fvisibility=hidden is used
  2011-09-01 19:54 [Bug c++/50270] New: Some symbols are exported even when -fvisibility=hidden is used almeidaraf at gmail dot com
  2011-09-01 19:57 ` [Bug c++/50270] " almeidaraf at gmail dot com
  2011-09-01 19:58 ` almeidaraf at gmail dot com
@ 2011-09-01 19:59 ` pinskia at gcc dot gnu.org
  2011-09-01 19:59 ` almeidaraf at gmail dot com
  2011-09-02  9:32 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-09-01 19:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50270

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-09-01 19:59:18 UTC ---
Small testcase:
template <class a> class __attribute__ ((visibility ("default"))) vector {
public:
  vector(){t=2;};
  void push_back(a){t++;};
  int t;
};

class __attribute__ ((visibility ("hidden"))) Foo {
 public:
 int m() {
   return 0;
 }
};


int main(void) {
 vector<Foo> v;
 v.push_back(Foo());
 return 0;
}

Everything should be hidden except for main().


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/50270] Some symbols are exported even when -fvisibility=hidden is used
  2011-09-01 19:54 [Bug c++/50270] New: Some symbols are exported even when -fvisibility=hidden is used almeidaraf at gmail dot com
                   ` (3 preceding siblings ...)
  2011-09-01 19:59 ` almeidaraf at gmail dot com
@ 2011-09-02  9:32 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-02  9:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50270

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-02 09:30:32 UTC ---
Dup.

*** This bug has been marked as a duplicate of bug 48818 ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-02  9:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-01 19:54 [Bug c++/50270] New: Some symbols are exported even when -fvisibility=hidden is used almeidaraf at gmail dot com
2011-09-01 19:57 ` [Bug c++/50270] " almeidaraf at gmail dot com
2011-09-01 19:58 ` almeidaraf at gmail dot com
2011-09-01 19:59 ` pinskia at gcc dot gnu.org
2011-09-01 19:59 ` almeidaraf at gmail dot com
2011-09-02  9:32 ` rguenth at gcc dot gnu.org

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).