[Bug c++/50270] New: Some symbols are exported even when -fvisibility=hidden is used
almeidaraf at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 1 19:54:00 GMT 2011
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;
}
More information about the Gcc-bugs
mailing list