Bug 493929

Summary: -fvisibility=hidden is broken when inlining is enabled
Product: Red Hat Enterprise Linux 5 Reporter: mkhon
Component: gcc44Assignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 5.3CC: kevinb, mnowak, pmuller, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-02 11:43:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description mkhon 2009-04-03 10:21:11 UTC
Test program:

--- cut here ---
#include <iostream>

int
main()
{
        std::cout << "Hello, world" << std::endl;
        return 0;
}
--- 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$

Environment:

kenny:~/work/ty$rpm -q gcc43 gcc43-c++ libstdc++43-devel libstdc++ binutils
gcc43-4.3.2-7.el5
gcc43-c++-4.3.2-7.el5
libstdc++43-devel-4.3.2-7.el5
libstdc++-4.1.2-44.el5
binutils-2.17.50.0.6-9.el5
kenny:~/work/ty$g++43 -v
Using built-in specs.
Target: i386-redhat-linux6E
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) 
kenny:~/work/ty$ld -v
GNU ld version 2.17.50.0.6-9.el5 20061020
kenny:~/work/ty$

Comment 9 Kevin Bowling 2009-07-23 05:54:38 UTC
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.

Comment 10 Michal Nowak 2009-07-23 11:38:46 UTC
(In reply to comment #9)

This bug has been verified against gcc44-4.4.0-6.el5. Do you experience problems with this version?

Comment 11 Kevin Bowling 2009-07-28 05:58:18 UTC
(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.

Comment 12 Michal Nowak 2009-08-03 09:11:39 UTC
(In reply to comment #11)
> Sorry, I don't have access to a 5.4 box.  No chance of backporting a fix to
> 5.3?  

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.

Comment 14 errata-xmlrpc 2009-09-02 11:43:24 UTC
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.

http://rhn.redhat.com/errata/RHBA-2009-1375.html