gfortran and -fvisibility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux