Red Hat Bugzilla – Bug 493929
-fvisibility=hidden is broken when inlining is enabled
Last modified: 2009-09-02 07:43:24 EDT
--- cut here ---
std::cout << "Hello, world" << std::endl;
--- cut here ---
The program can not be compiled with -fvisibility=hidden and -O1 or higher, but adding -fno-inline helps:
kenny:~/work/ty$g++43 -fvisibility=hidden -O t.cc
/usr/bin/ld: a.out: hidden symbol `void std::__ostream_fill<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, long)' isn't defined
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
kenny:~/work/ty$g++43 -fvisibility=hidden -O -fno-inline t.cc
kenny:~/work/ty$rpm -q gcc43 gcc43-c++ libstdc++43-devel libstdc++ binutils
Using built-in specs.
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,fortran --disable-libgcj --with-cpu=generic --build=i386-redhat-linux6E
Thread model: posix
gcc version 4.3.2 20081007 (Red Hat 4.3.2-7) (GCC)
GNU ld version 126.96.36.199.6-9.el5 20061020
I hit this when compiling just about anything since -O triggers it (obviously since any time iostream is used). Any ETA on a fix? Compiling with -fno-inline is a valid workaround but at the expense of size and speed of compiled binaries.
(In reply to comment #9)
This bug has been verified against gcc44-4.4.0-6.el5. Do you experience problems with this version?
(In reply to comment #10)
> (In reply to comment #9)
> This bug has been verified against gcc44-4.4.0-6.el5. Do you experience
> problems with this version?
Sorry, I don't have access to a 5.4 box. No chance of backporting a fix to 5.3? -O and iostream is just about everything. How this made is past internal testing must be embarrassing :-P.
(In reply to comment #11)
> Sorry, I don't have access to a 5.4 box. No chance of backporting a fix to
Ask support on how to escalate issues into EUS.
> -O and iostream is just about everything. How this made is past internal
> testing must be embarrassing :-P.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.