This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32470] New: fvisibility=hidden without effect in some casses
- From: "gd at spherenet dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jun 2007 03:45:57 -0000
- Subject: [Bug c++/32470] New: fvisibility=hidden without effect in some casses
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compiling the following code with fvisibility=hidden exports Test::test().
(The used compiler is 4.2.1 20070622. Version 4.2.0 on a i686 gives the same
results).
~$ cat test.cc
#include <streambuf>
class Test
{
void test();
};
void Test::test() { }
~$ g++ -fvisibility=hidden -fPIC -c -o test.o test.cc
~$ readelf -s test.o
Symbol table '.symtab' contains 12 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.cc
2: 0000000000000000 0 SECTION LOCAL DEFAULT 1
3: 0000000000000000 0 SECTION LOCAL DEFAULT 2
4: 0000000000000000 0 SECTION LOCAL DEFAULT 3
5: 0000000000000000 0 SECTION LOCAL DEFAULT 4
6: 0000000000000000 0 SECTION LOCAL DEFAULT 6
7: 0000000000000000 0 SECTION LOCAL DEFAULT 9
8: 0000000000000000 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 10 FUNC GLOBAL DEFAULT 1 _ZN4Test4testEv
10: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __gxx_personality_v0
11: 0000000000000000 8 OBJECT WEAK HIDDEN 6
DW.ref.__gxx_personality_
After removing #include <streambuf> from the testcase, Test::test() is hidden
as expected.
~$ g++ -fvisibility=hidden -fPIC -c -o test.o test.cc
~$ readelf -s test.o
Symbol table '.symtab' contains 12 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.cc
2: 0000000000000000 0 SECTION LOCAL DEFAULT 1
3: 0000000000000000 0 SECTION LOCAL DEFAULT 2
4: 0000000000000000 0 SECTION LOCAL DEFAULT 3
5: 0000000000000000 0 SECTION LOCAL DEFAULT 4
6: 0000000000000000 0 SECTION LOCAL DEFAULT 6
7: 0000000000000000 0 SECTION LOCAL DEFAULT 9
8: 0000000000000000 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 10 FUNC GLOBAL HIDDEN 1 _ZN4Test4testEv
10: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __gxx_personality_v0
11: 0000000000000000 8 OBJECT WEAK HIDDEN 6
DW.ref.__gxx_personality_
--
Summary: fvisibility=hidden without effect in some casses
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gd at spherenet dot de
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32470