public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13878] New: Uncaught exception on AIX with shared libraries
@ 2004-01-27  8:31 joerg dot richter at pdv-fs dot de
  2004-01-31  0:43 ` [Bug c++/13878] " dhazeghi at yahoo dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: joerg dot richter at pdv-fs dot de @ 2004-01-27  8:31 UTC (permalink / raw)
  To: gcc-bugs

> g++ -v
Reading specs from /tools/pkg/gcc/3.3.2/lib/gcc-lib/powerpc-ibm-
aix5.1.0.0/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --prefix=/tools/pkg/gcc/3.3.2 --with-
ld=/bin/ld --with-as=/bin/as --enable-languages=c,c++,f77
Thread model: aix
gcc version 3.3.2


Under some circumstances the GCC runtime environment is unable to find the 
right handler for an exception. I spend some days producing a small testcase. 
With no success. So I debugged the exception handling. 
I found out that one assumption made in the source does not hold for my program:

(from gcc/unwind-dw2-fde.c)
  /* Linear search through the classified objects, to find the one
     containing the pc.  Note that pc_begin is sorted descending, and
     we expect objects to be non-overlapping.  */

Actually the objects are overlapping. Somehow nearly all libraries share some 
fdes (Frame Descriptor Elements) in the shared memory segment (0xd). There is 
no problem when you have process local shared libraries (segment 0x2). They are 
still overlapping (at the end of the pc range). But the list seen_objects is 
sorted by pc_begin and the right object will be found.

But it is a problem when some shared objects start behind the shared fdes. 
(With behind I mean with a greater pc). Then some libraries have the same 
pc_begin (overlapping at the front) and _Unwind_Find_FDE can find the wrong 
object. 

I made the following workaround to handle this case too. Just search the list 
of seen_objects until search_object finds a fde. This works for me. But I think 
that the real bug lies somewhere else. Perhaps someone with more AIX or 
exception handling experience can say more to it.


*** gcc-3.2.1/gcc/unwind-dw2-fde.c	Mon Jan 21 14:08:31 2002
--- gcc-3.2.1-dbg/gcc/unwind-dw2-fde.c	Wed Jan 21 08:57:10 2004
***************
*** 985,991 ****
  	f = search_object (ob, pc);
  	if (f)
  	  goto fini;
- 	break;
        }
  
    /* Classify and search the objects we've not yet processed.  */
--- 985,990 ----

-- 
           Summary: Uncaught exception on AIX with shared libraries
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joerg dot richter at pdv-fs dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-ibm-aix5.1.0.0
  GCC host triplet: powerpc-ibm-aix5.1.0.0
GCC target triplet: powerpc-ibm-aix5.1.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
@ 2004-01-31  0:43 ` dhazeghi at yahoo dot com
  2004-02-01  2:52 ` dje at watson dot ibm dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dhazeghi at yahoo dot com @ 2004-01-31  0:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dhazeghi at yahoo dot com  2004-01-31 00:43 -------
David, can you comment on this? Thanks.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at gcc dot gnu dot org
           Keywords|                            |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
  2004-01-31  0:43 ` [Bug c++/13878] " dhazeghi at yahoo dot com
@ 2004-02-01  2:52 ` dje at watson dot ibm dot com
  2004-02-01 10:26 ` joerg dot richter at pdv-fs dot de
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dje at watson dot ibm dot com @ 2004-02-01  2:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at watson dot ibm dot com  2004-02-01 02:52 -------
Subject: Re:  Uncaught exception on AIX with shared libraries 

	I think this bug is related to or a duplicate of PR 13391.

	I do not understand the analysis in the bug report mentioning
overlapping FDE ranges.  AIX's memory layout is more complicated than most
other systems, but it still is a flat, linear address space.  Is this
trying to say that shared objects re-export symbols in other shared
objects, so the FDE and address actually corresponds to another shared
object?  Or is it saying that some ranges represent the end of the module
to the top of memory when, in fact, another shared object could be in that
higher address range?

	If the analysis could give some examples of symbols with
overlapping FDE ranges, that would help.

David



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
  2004-01-31  0:43 ` [Bug c++/13878] " dhazeghi at yahoo dot com
  2004-02-01  2:52 ` dje at watson dot ibm dot com
@ 2004-02-01 10:26 ` joerg dot richter at pdv-fs dot de
  2004-02-21 19:12 ` greed at pobox dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: joerg dot richter at pdv-fs dot de @ 2004-02-01 10:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From joerg dot richter at pdv-fs dot de  2004-02-01 10:26 -------
There is a good chance that this is a duplicate of PR 13391. At least I 
experienced the same problems. (Not reproducible with small testcases. Not even 
reproducible when you run the same executable/libraries another time)

I modified GCC runtime to output object* and fde* for every fde found. How I 
understand it, an object* is actually unique to every shared library.
I would expect an 1:n relationship between this pointer values. But you could 
see an n:m relationship. So some FDEs are shared between some shared libraries.

   Joerg

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (2 preceding siblings ...)
  2004-02-01 10:26 ` joerg dot richter at pdv-fs dot de
@ 2004-02-21 19:12 ` greed at pobox dot com
  2004-03-01 21:01 ` smethells at llnl dot gov
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: greed at pobox dot com @ 2004-02-21 19:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From greed at pobox dot com  2004-02-21 19:12 -------
Applying the patch in this testcase solves the problem I filed as PR 13391.  I
left the systems rebuilding the 3rd party code yesterday, and we'll try a build
of our product and regression test next week.

I also incorporated the patch in PR 13150 and a patch to stop collect2 from
emitting _GLOBAL__DI and _GLOBAL__DD (which cause duplicate symbol warnings, and
are no longer needed with the AIX 4.2 linker's -binitfini: feature.)


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greed at pobox dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (3 preceding siblings ...)
  2004-02-21 19:12 ` greed at pobox dot com
@ 2004-03-01 21:01 ` smethells at llnl dot gov
  2004-03-03 20:52 ` ajd at gentrack dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: smethells at llnl dot gov @ 2004-03-01 21:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From smethells at llnl dot gov  2004-03-01 21:01 -------
Our project is also experiencing problems with exceptions not being caught, when
compiling with g++ on AIX. Small example codes that we have tried to put
together to model what we are seeing, do not end up having the same incorrect
behavior. On large test cases (our entire application as linked by g++), any
exceptions thrown (that make it into _cxa_throw) do not bubble up to the catch
statement (not even a literal catch(...)); rather, all exceptions call abort().
I would be extremely interested in hearing how this issue sorts itself out. I
can try to give you more feedback no our problem than this, if requested. At the
moment we are not sure what the property is that is required in order for the
exception handling behavior to go from good to bad. That is work in progress.
This occurs on AIX 5, GCC 3.3.2.

Greg Smethells
Lawrence Livermore National Lab
smethells@llnl.gov

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smethells at llnl dot gov


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (4 preceding siblings ...)
  2004-03-01 21:01 ` smethells at llnl dot gov
@ 2004-03-03 20:52 ` ajd at gentrack dot com
  2004-03-03 22:50 ` dje at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ajd at gentrack dot com @ 2004-03-03 20:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ajd at gentrack dot com  2004-03-03 20:52 -------
I think the shared/duplicate FDE's are coming from collect2.

See my comments on PR 13391.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ajd at gentrack dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (5 preceding siblings ...)
  2004-03-03 20:52 ` ajd at gentrack dot com
@ 2004-03-03 22:50 ` dje at gcc dot gnu dot org
  2004-03-03 22:51 ` dje at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dje at gcc dot gnu dot org @ 2004-03-03 22:50 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tsorensen at dtrac dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (6 preceding siblings ...)
  2004-03-03 22:50 ` dje at gcc dot gnu dot org
@ 2004-03-03 22:51 ` dje at gcc dot gnu dot org
  2004-03-03 22:54 ` dje at watson dot ibm dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dje at gcc dot gnu dot org @ 2004-03-03 22:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at gcc dot gnu dot org  2004-03-03 22:51 -------
*** Bug 13887 has been marked as a duplicate of this bug. ***

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (7 preceding siblings ...)
  2004-03-03 22:51 ` dje at gcc dot gnu dot org
@ 2004-03-03 22:54 ` dje at watson dot ibm dot com
  2004-03-06 20:55 ` dje at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dje at watson dot ibm dot com @ 2004-03-03 22:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at watson dot ibm dot com  2004-03-03 22:54 -------
Subject: Re:  Uncaught exception on AIX with shared libraries 

	Can you try the appended patch that disables exporting _GLOBAL_*
symbols in AIX shared libraries?

Thanks, David

Index: collect2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/collect2.c,v
retrieving revision 1.160
diff -c -p -r1.160 collect2.c
*** collect2.c	21 Jan 2004 20:39:52 -0000	1.160
--- collect2.c	3 Mar 2004 22:38:31 -0000
*************** main (int argc, char **argv)
*** 1398,1407 ****
--- 1398,1409 ----
        if (! exports.first)
  	*ld2++ = concat ("-bE:", export_file, NULL);
  
+ #ifndef LD_INIT_SWITCH
        add_to_list (&exports, initname);
        add_to_list (&exports, fininame);
        add_to_list (&exports, "_GLOBAL__DI");
        add_to_list (&exports, "_GLOBAL__DD");
+ #endif
        exportf = fopen (export_file, "w");
        if (exportf == (FILE *) 0)
  	fatal_perror ("fopen %s", export_file);
*************** scan_prog_file (const char *prog_name, e
*** 2720,2726 ****
  			  if (! is_shared)
  			    add_to_list (&constructors, name);
  #ifdef COLLECT_EXPORT_LIST
! 			  if (which_pass == PASS_OBJ)
  			    add_to_list (&exports, name);
  #endif
  			  break;
--- 2722,2728 ----
  			  if (! is_shared)
  			    add_to_list (&constructors, name);
  #ifdef COLLECT_EXPORT_LIST
! 			  if (!shared_obj && which_pass == PASS_OBJ)
  			    add_to_list (&exports, name);
  #endif
  			  break;
*************** scan_prog_file (const char *prog_name, e
*** 2729,2735 ****
  			  if (! is_shared)
  			    add_to_list (&destructors, name);
  #ifdef COLLECT_EXPORT_LIST
! 			  if (which_pass == PASS_OBJ)
  			    add_to_list (&exports, name);
  #endif
  			  break;
--- 2731,2737 ----
  			  if (! is_shared)
  			    add_to_list (&destructors, name);
  #ifdef COLLECT_EXPORT_LIST
! 			  if (!shared_obj && which_pass == PASS_OBJ)
  			    add_to_list (&exports, name);
  #endif
  			  break;
*************** scan_prog_file (const char *prog_name, e
*** 2754,2760 ****
  			  if (! is_shared)
  			    add_to_list (&frame_tables, name);
  #ifdef COLLECT_EXPORT_LIST
! 			  if (which_pass == PASS_OBJ)
  			    add_to_list (&exports, name);
  #endif
  			  break;
--- 2756,2762 ----
  			  if (! is_shared)
  			    add_to_list (&frame_tables, name);
  #ifdef COLLECT_EXPORT_LIST
! 			  if (!shared_obj && which_pass == PASS_OBJ)
  			    add_to_list (&exports, name);
  #endif
  			  break;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (8 preceding siblings ...)
  2004-03-03 22:54 ` dje at watson dot ibm dot com
@ 2004-03-06 20:55 ` dje at gcc dot gnu dot org
  2004-03-06 23:31 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dje at gcc dot gnu dot org @ 2004-03-06 20:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at gcc dot gnu dot org  2004-03-06 20:55 -------
patches committed

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (9 preceding siblings ...)
  2004-03-06 20:55 ` dje at gcc dot gnu dot org
@ 2004-03-06 23:31 ` pinskia at gcc dot gnu dot org
  2004-03-07 22:37 ` dje at gcc dot gnu dot org
  2005-05-31 12:54 ` nagaraj_hayyal at satyam dot com
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-06 23:31 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (10 preceding siblings ...)
  2004-03-06 23:31 ` pinskia at gcc dot gnu dot org
@ 2004-03-07 22:37 ` dje at gcc dot gnu dot org
  2005-05-31 12:54 ` nagaraj_hayyal at satyam dot com
  12 siblings, 0 replies; 14+ messages in thread
From: dje at gcc dot gnu dot org @ 2004-03-07 22:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.5.0                       |3.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/13878] Uncaught exception on AIX with shared libraries
  2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
                   ` (11 preceding siblings ...)
  2004-03-07 22:37 ` dje at gcc dot gnu dot org
@ 2005-05-31 12:54 ` nagaraj_hayyal at satyam dot com
  12 siblings, 0 replies; 14+ messages in thread
From: nagaraj_hayyal at satyam dot com @ 2005-05-31 12:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nagaraj_hayyal at satyam dot com  2005-05-31 12:21 -------
(In reply to comment #5)
Did you get any solution for this?
We are experiencing the same problem here.
Please let us know the solution if you have already found one.
mail: Nagaraj_Hayyal@satyam.com

> Our project is also experiencing problems with exceptions not being caught, 
when
> compiling with g++ on AIX. Small example codes that we have tried to put
> together to model what we are seeing, do not end up having the same incorrect
> behavior. On large test cases (our entire application as linked by g++), any
> exceptions thrown (that make it into _cxa_throw) do not bubble up to the 
catch
> statement (not even a literal catch(...)); rather, all exceptions call abort
().
> I would be extremely interested in hearing how this issue sorts itself out. I
> can try to give you more feedback no our problem than this, if requested. At 
the
> moment we are not sure what the property is that is required in order for the
> exception handling behavior to go from good to bad. That is work in progress.
> This occurs on AIX 5, GCC 3.3.2.
> Greg Smethells
> Lawrence Livermore National Lab
> smethells@llnl.gov



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-05-31 12:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-27  8:31 [Bug c++/13878] New: Uncaught exception on AIX with shared libraries joerg dot richter at pdv-fs dot de
2004-01-31  0:43 ` [Bug c++/13878] " dhazeghi at yahoo dot com
2004-02-01  2:52 ` dje at watson dot ibm dot com
2004-02-01 10:26 ` joerg dot richter at pdv-fs dot de
2004-02-21 19:12 ` greed at pobox dot com
2004-03-01 21:01 ` smethells at llnl dot gov
2004-03-03 20:52 ` ajd at gentrack dot com
2004-03-03 22:50 ` dje at gcc dot gnu dot org
2004-03-03 22:51 ` dje at gcc dot gnu dot org
2004-03-03 22:54 ` dje at watson dot ibm dot com
2004-03-06 20:55 ` dje at gcc dot gnu dot org
2004-03-06 23:31 ` pinskia at gcc dot gnu dot org
2004-03-07 22:37 ` dje at gcc dot gnu dot org
2005-05-31 12:54 ` nagaraj_hayyal at satyam dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).