From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19579 invoked by alias); 23 Jun 2007 03:46:06 -0000 Received: (qmail 19562 invoked by uid 48); 23 Jun 2007 03:45:57 -0000 Date: Sat, 23 Jun 2007 03:46:00 -0000 Subject: [Bug c++/32470] New: fvisibility=hidden without effect in some casses X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gd at spherenet dot de" 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: 2007-06/txt/msg02092.txt.bz2 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 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 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