Re: AIX/g++: Preventing early destruction of exception handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I omitted one important detail:
$ g++ -v
Using built-in specs.
Target: powerpc-ibm-aix5.3.0.0
Configured with: ../configure --prefix=/usr/local/gcc-4.2.2
--enable-languages=c,c++ --with-as=/usr/bin/as --with-ld=/usr/bin/ld
--disable-nls --enable-threads --enable-version-specific-runtime-libs
--host=powerpc-ibm-aix5.3.0.0
Thread model: aix
gcc version 4.2.2

Also, trying to use the at_exit mechanism for destruction does not work:
$ g++ -fuse-cxa-atexit t2.cpp
ld: 0711-317 ERROR: Undefined symbol: __dso_handle
ld: 0711-317 ERROR: Undefined symbol: .__cxa_atexit



                                                                       
             Michael                                                   
             Veksler/Haifa/IBM                                         
                                                                        To
             03/03/08 03:59            gcc-help@xxxxxxxxxxx            
                                                                        cc
                                                                       
                                                                   Subject
                                       AIX/g++: Preventing early       
                                       destruction of exception handling
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       



The following trivial code crashes on AIX-5.3 + gcc-4.2.2 (same with
gcc-3.4.3):

$ cat t.cpp
struct A { ~A() { try {throw 1;} catch(...) {} } };
A a;
int main() { }
$ g++ -g t.cpp
$ ./a.out
Abort

It looks like the libgcc_s.a(shr.o) library is destroyed (along with
exception supporting data structures) before the destructor of A has been
called. This is done by a function named _GLOBAL__FD_shr_o which seems to
be responsible for destruction of all global objects in libgcc.

When the destructor of A is called (by _GLOBAL__FD_a_out), exception
handling mechanism is already dead.

Is there anything constructive I can do to overcome this hurdle?
Should I open a PR (unless there is one, already open).
As far as I can tell, my code is well specified and defined from the ISO-C+
+ point of view, and is accepted on gcc+Linux and xlC+AIX. Only gcc+AIX
happens to problematic.


Thanks
   Michael



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux