Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 480412

Summary: c++ exception bug when linked with libunwind on ia64
Product: Red Hat Enterprise Linux 5 Reporter: Doug Chapman <dchapman>
Component: libunwindAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: high Docs Contact:
Priority: low    
Version: 5.3CC: ebachalo, jakub, jbastian, mnowak, pmuller, sghosh, syeghiay, tao
Target Milestone: rc   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: libunwind-0.98.5-4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 496219 (view as bug list) Environment:
Last Closed: 2009-05-06 15:32:37 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:
Bug Depends On:    
Bug Blocks: 496219    
Attachments:
Description Flags
simple reproducer, compile with g++ exception.cpp -lunwind
none
libunwind GetIPInfo() patch from upstream. none

Description Doug Chapman 2009-01-16 21:53:55 UTC
Created attachment 329257 [details]
simple reproducer, compile with g++ exception.cpp -lunwind

Description of problem:
A c++ program that is linked with -lunwind cannot handle exceptions cleanly.  I will attach a demonstration program.  When this is linked with -lunwind on ia64 the exceptions are not caught.

This is a regression from theupstream code.  I have tracked this down to a Red Hat specific patch in gcc:
gcc41-ia64-libunwind.patch

If I remove this patch and rebuild libgcc the test program works properly.  I am not clear as to the intent of this patch as it has not been pushed upstream and it does not mention what issue it is intending to resolve.  I also wasn't able to find a mention of this in the changelog.

I am attaching a simple reproducer for the problem.  Build it with:

g++ exception.cpp -lunwind

The expected output is:

Exception thrown in f()
In function g ()
Exception thrown in A()


however with RHEL5.X we get:

terminate called after throwing an instance of 'E'
terminate called recursively
Aborted


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 2 Jakub Jelinek 2009-03-31 11:35:46 UTC
We don't want to configure gcc with libunwind exceptions, as that brings in yet another (quite big) shared library into most of the binaries.  libgcc_s has its own unwinder.

The problem with programs linked against -lunwind (where -lunwind comes before -lgcc_s) is that libunwind seems to be very much unmaintained and haven't bothered to add _Unwind_GetIPInfo entrypoint during the last 3 years (since it has been added to gcc).
So, either it should be added to libunwind, or you should make sure -lgcc_s is linked first (linking with -lgcc_s -lunwind works).
Otherwise, when -lunwind comes first in symbol search scope, most of the _Unwind_* symbols are resolved to libunwind.so.7's version, but _Unwind_GetIPInfo
which is used by libstdc++.so/libgcj.so is resolved to libgcc_s.so.1 (as libunwind doesn't provide it) and given that libunwind's _Unwind_Context struct content and layout is incompatible with libgcc_s's, it is fatal to mix them.

Comment 6 Jan Kratochvil 2009-04-07 13:40:40 UTC
Created attachment 338501 [details]
libunwind GetIPInfo() patch from upstream.

Comment 18 errata-xmlrpc 2009-05-06 15:32:37 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-0464.html