[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. [EMAIL PROTECTED] 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. [EMAIL PROTECTED] 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. [EMAIL PROTECTED] test-cases]$ rm -f hidden make g++ -W -Wall -ghidden.cpp -o hidden hidden.cpp:5: warning: 'visibility' attribute ignored on non-class types [EMAIL PROTECTED] test-cases]$ readelf -s hidden | c++filt | grep func 51: 080489d828 FUNCLOCAL 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 FUNCGLOBAL DEFAULT 12 func() 103: 08048a08 220 FUNCGLOBAL HIDDEN 12 func2() [EMAIL PROTECTED] 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
[Bug other/30361] Documentation: Example usage of __attribute__((visibility(hidden))) misleading
-- rich at phekda dot gotadsl dot co dot uk changed: What|Removed |Added Severity|minor |normal http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30361
[Bug other/30361] Documentation: Example usage of __attribute__((visibility(hidden))) misleading
--- Comment #1 from pinskia at gcc dot gnu dot org 2007-01-03 21:43 --- Note that the attribute is attached to the return type of the function f, not the function declaration itself. I think this means that the hidden visibility is applied to the type, not the function, which is strange. That is because that is how attributes on function definitions work. this is really unrelated to visibility in general but attributes. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30361
[Bug other/30361] Documentation: Example usage of __attribute__((visibility(hidden))) misleading
--- Comment #2 from rich at phekda dot gotadsl dot co dot uk 2007-01-03 21:45 --- Created an attachment (id=12853) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12853action=view) A test case When I compile the attached test case, I get: [EMAIL PROTECTED] test-cases]$ make g++ -W -Wall -ghidden.cpp -o hidden hidden.cpp:5: warning: 'visibility' attribute ignored on non-class types Line 5 refers to the declaration with the attribute attached to the return type. Looking at the generated ELF file, I see that func is not hidden, but func2 is: [EMAIL PROTECTED] test-cases]$ readelf -s hidden | c++filt | grep func 51: 080487f223 FUNCLOCAL DEFAULT 12 global constructors keyed to _Z4funcv 53: 08049e80 4 OBJECT LOCAL DEFAULT 25 func2()::foo2 55: 08049e90 4 OBJECT LOCAL DEFAULT 25 func()::foo 59: 08049e78 8 OBJECT LOCAL DEFAULT 25 guard variable for func2()::foo2 60: 08049e88 8 OBJECT LOCAL DEFAULT 25 guard variable for func()::foo 89: 080488fa 220 FUNCGLOBAL DEFAULT 12 func() 99: 0804881e 220 FUNCGLOBAL HIDDEN 12 func2() Version information: [EMAIL PROTECTED] test-cases]$ gcc --version gcc (GCC) 4.1.1 20061011 (Red Hat 4.1.1-30) 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. [EMAIL PROTECTED] test-cases]$ ld --version GNU ld version 2.17.50.0.3-6 20060715 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. [EMAIL PROTECTED] test-cases]$ cat /etc/redhat-release Fedora Core release 6 (Zod) [EMAIL PROTECTED] test-cases]$ rpm -q gcc gcc-4.1.1-30 [EMAIL PROTECTED] test-cases]$ rpm -q binutils binutils-2.17.50.0.3-6 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30361
[Bug other/30361] Documentation: Example usage of __attribute__((visibility(hidden))) misleading
--- Comment #3 from pinskia at gcc dot gnu dot org 2007-01-03 21:45 --- Read: http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Attribute-Syntax.html Which describes the syntax. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30361
[Bug other/30361] Documentation: Example usage of __attribute__((visibility(hidden))) misleading
--- Comment #4 from pinskia at gcc dot gnu dot org 2007-01-03 21:46 --- gcc (GCC) 4.1.1 20061011 (Red Hat 4.1.1-30) This should also tell you, that you are using a modified version of the compiler and the bug report should have been filed up with redhat first. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30361
[Bug other/30361] Documentation: Example usage of __attribute__((visibility(hidden))) misleading
--- Comment #5 from rich at phekda dot gotadsl dot co dot uk 2007-01-03 21:55 --- Thanks for the quick response and the reference to the attribute documentation. I agree my comment about the documentation being incorrect is wrong. But it doesn't look to me like the visibility is correct for my test program. I'll try to reproduce this with vanilla trunk gcc binutils. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30361