GCC 4.0.1 -fvisibility=hidden option does nothing

Brian Foster bsfost@gmail.com
Mon Aug 22 17:57:00 GMT 2005


I've just compiled and installed a copy of GCC 4.0.1 on a RedHat
machine which also has GCC 2.95 installed (the OS itself is really
old, I believe it's RedHat 2.1), and I'm having a problem with the
-fvisibility feature.

The following is the output from a test build:

g++ -fvisibility=hidden -w -fpermissive -fPIC -ggdb -c ExceptionTestLib2.cpp

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-4.0.1
Thread model: posix
gcc version 4.0.1
-quiet -v -D_GNU_SOURCE ExceptionTestLib2.cpp -quiet -dumpbase
ExceptionTestLib2.cpp -mtune=pentiumpro -auxbase ExceptionTestLib2
-ggdb -w -version -fvisibility=hidden -fpermissive -fPIC -o
ignoring nonexistent directory
#include "..." search starts here:
#include <...> search starts here:
End of search list.
GNU C++ version 4.0.1 (i686-pc-linux-gnu)
        compiled by GNU C version 4.0.1.
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64098
 as --traditional-format -V -Qy -o ExceptionTestLib2.o /tmp/cc5XMCCh.s
GNU assembler version 2.16 (i686-pc-linux-gnu) using BFD version 2.16

... so I know it's using the correct version. But an objdump -x of the
resulting object file shows that none of the symbols are marked
hidden. I've been going back and forth between this box and another
more recent box with 3.4.3 installed, and the same compile command
works fine.

I also ran 'cc1plus' and 'as' directly (as shown by the g++ -v command
on each) box to see what the problem was, and all I saw was that the
cc1plus associated with this 4.0.1 installation does not inject the
'.hidden' keywords for the symbols in the resulting .s file. I'm not
sure if this is an issue with my actual GCC configuration/build, or if
there's a separate outside issue with my environment, any help is
greatly appreciated...

Brian F.

More information about the Gcc-help mailing list