public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35827]  New: gfortran doesn't respect -fvisibility
@ 2008-04-04 18:09 3dw4rd at verizon dot net
  2008-04-04 18:13 ` [Bug middle-end/35827] -fvisibility only works for C/C++/Objective-C/Objective-C++ pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 3+ messages in thread
From: 3dw4rd at verizon dot net @ 2008-04-04 18:09 UTC (permalink / raw)
  To: gcc-bugs

I am having trouble with symbol visibility with gfortran on Linux x86_64.
It looks like -fvisibility=hidden doesn't work.

[ed@alion7 tirem-3.2]$ gfortran -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)


So I copied and translated a gcc.dg/visibility-9.c to Fortran for a small test
case.

I compiled with gfortran to a shared library (x86_64 ELF Linux etc.).

visibility-1.f90
--------------------------------------------------------------------
! Test that -fvisibility works.
! { dg-do compile }
! { dg-require-visibility "" }
! { dg-options "-fvisibility=hidden" }
! { dg-final { scan-hidden "foo" } }


subroutine foo
end subroutine
--------------------------------------------------------------------

[ed@alion7 ~]$ gfortran -shared  -fvisibility=default -fPIC -o visibility-1.so
visibility-1.f90
[ed@alion7 ~]$ nm -C -D visibility-1.so
                 w _Jv_RegisterClasses
00000000002007c8 A __bss_start
                 w __cxa_finalize
                 w __gmon_start__
00000000002007c8 A _edata
00000000002007d8 A _end
0000000000000548 T _fini
00000000000003f0 T _init
00000000000004fc T foo_

The "foo_" at the end is teh bad thing.

I haven't checked a gfortran less than 4.1 but g77 as of gcc-3.4 supports
visibility.
I've checked with an almost release gcc-4.3 and visibility still didn't work.

Is anyone else seeing a problem?

I'll check PPC MacOS and i32 Cygwin when I get home.

Ed Smith-Rowland

-------------------------------------------------------

I just verified this on PPC MacOSX:

MacOSX:~ ed$ bin-4.3/bin/gfortran -v
Using built-in specs.
Target: powerpc-apple-darwin7.9.0
Configured with: ../gcc/configure --prefix=/Users/ed/bin-4.3
--enable-languages=c,c++,objc,obj-c++,fortran,treelang
Thread model: posix
gcc version 4.3.0 20071116 (experimental) (GCC)


The results of nm:

MacOSX:~ ed$ bin-4.3/bin/gfortran -dynamiclib  -fvisibility=default -fPIC -o
visibility-1.dylib visibility-1.f90
MacOSX:~ ed$ nm visibility-1.dylib
...

visibility-1.dylib(ccsE7pf3.o):
00001db0 T _foo_

...
So foo is visible on PPC MacOSX too.


-- 
           Summary: gfortran doesn't respect -fvisibility
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: 3dw4rd at verizon dot net
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/35827] -fvisibility only works for C/C++/Objective-C/Objective-C++
  2008-04-04 18:09 [Bug fortran/35827] New: gfortran doesn't respect -fvisibility 3dw4rd at verizon dot net
@ 2008-04-04 18:13 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-04 18:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-04-04 18:12 -------
-fvisibility should be only a C/C++ option as you cannot change the visibility
in any other language.  Also it is only implemented for
C/C++/Objective-C/Objective-C++:
[dhcp-10-98-10-23:local/gcc/gcc] apinski% grep default_visibility */*.c
cp/decl.c:    default_visibility = VISIBILITY_HIDDEN;
cp/decl2.c:       DECL_VISIBILITY (decl) = default_visibility;
[dhcp-10-98-10-23:local/gcc/gcc] apinski% grep default_visibility *.c
c-common.c:      DECL_VISIBILITY (decl) = default_visibility;
c-pragma.c:              default_visibility);
c-pragma.c:    default_visibility = VISIBILITY_DEFAULT;
c-pragma.c:    default_visibility = VISIBILITY_INTERNAL;
c-pragma.c:    default_visibility = VISIBILITY_HIDDEN;
c-pragma.c:    default_visibility = VISIBILITY_PROTECTED;
c-pragma.c:  default_visibility = VEC_pop (visibility, visstack);
opts.c:enum symbol_visibility default_visibility = VISIBILITY_DEFAULT;
opts.c:          default_visibility = VISIBILITY_DEFAULT;
opts.c:          default_visibility = VISIBILITY_INTERNAL;
opts.c:          default_visibility = VISIBILITY_HIDDEN;
opts.c:          default_visibility = VISIBILITY_PROTECTED;


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
          Component|fortran                     |middle-end
            Summary|gfortran doesn't respect -  |-fvisibility only works for
                   |fvisibility                 |C/C++/Objective-C/Objective-
                   |                            |C++


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/35827] -fvisibility only works for C/C++/Objective-C/Objective-C++
       [not found] <bug-35827-4@http.gcc.gnu.org/bugzilla/>
@ 2011-06-10 10:20 ` roucaries.bastien+bugs at gmail dot com
  0 siblings, 0 replies; 3+ messages in thread
From: roucaries.bastien+bugs at gmail dot com @ 2011-06-10 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

Bastien ROUCARIES <roucaries.bastien+bugs at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roucaries.bastien+bugs at
                   |                            |gmail dot com

--- Comment #2 from Bastien ROUCARIES <roucaries.bastien+bugs at gmail dot com> 2011-06-10 10:20:15 UTC ---
Dear andrew,

You have miss that visibility is supported by intel fortran, and is therefore
quite useful for fortran dso. See
http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/fortran/lin/compiler_f/optaps/common/optaps_cmp_visib.htm

BTW could you mark that this bug is blocked by 41209 ?
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41209

Bastien


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-10 10:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-04 18:09 [Bug fortran/35827] New: gfortran doesn't respect -fvisibility 3dw4rd at verizon dot net
2008-04-04 18:13 ` [Bug middle-end/35827] -fvisibility only works for C/C++/Objective-C/Objective-C++ pinskia at gcc dot gnu dot org
     [not found] <bug-35827-4@http.gcc.gnu.org/bugzilla/>
2011-06-10 10:20 ` roucaries.bastien+bugs at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).