This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/30361] Documentation: Example usage of __attribute__((visibility("hidden"))) misleading



------- Comment #6 from rich at phekda dot gotadsl dot co dot uk  2007-01-06 14:54 -------
I've repeated my testing with binutils 070103 (from snapshot from web page) and
gcc 4.3.0 20070104 from svn trunk (svn revision 120449).

Using hidden visibility with the attribute before the function name in the
declaration is still broken. It works if I use the attribute after the function
name in the declaration.

Those symptoms are what caused me to think the documentation was wrong in the
first place.

[rich@katrina test-cases]$ ld --version
GNU ld version 070103 20070103
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

[rich@katrina test-cases]$ gcc --version
gcc (GCC) 4.3.0 20070104 (experimental)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[rich@katrina test-cases]$ rm -f hidden && make
g++ -W -Wall -g    hidden.cpp   -o hidden
hidden.cpp:5: warning: 'visibility' attribute ignored on non-class types

[rich@katrina test-cases]$ readelf -s hidden | c++filt  | grep func
    51: 080489d8    28 FUNC    LOCAL  DEFAULT   12 global constructors keyed to
_Z4funcv
    54: 080491f8     4 OBJECT  LOCAL  DEFAULT   25 func2()::foo2
    56: 08049208     4 OBJECT  LOCAL  DEFAULT   25 func()::foo
    60: 080491f0     8 OBJECT  LOCAL  DEFAULT   25 guard variable for
func2()::foo2
    61: 08049200     8 OBJECT  LOCAL  DEFAULT   25 guard variable for
func()::foo
    93: 08048ae4   220 FUNC    GLOBAL DEFAULT   12 func()
   103: 08048a08   220 FUNC    GLOBAL HIDDEN   12 func2()

[rich@katrina test-cases]$ readelf --version
GNU readelf 070103 20070103
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]