Exception handling in GCC 3.0.1 on AIX

David Edelsohn dje@watson.ibm.com
Mon Aug 20 13:45:00 GMT 2001


$ g++ dmitry.cc
$ dump -H a.out
                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      ...LIBPATH...
1                                    libc.a              shr.o               
2                                    libstdc++.a         libstdc++.so.3      
3                                    libgcc_s.a          shr.o       

$ ./a.out
Throwing exception...
Exception '268437520' catched

	Something still is wrong with GCC's native exception handling
interaction with shared libraries on AIX.  I suspect that somewhere the
shared library is using some data which it expects to be private to the
process, but currently is ending up shared.  When the process tries to
write into the shared segment, the application is terminated.

	If the archive file mode is set to disallow read-other, then the
shared library is placed in the AIX process private segment instead of the
shared text segment and throwing exceptions through shared libraries seems
to work (as above).  In other words,

chmod a+x,o-r libstdc++.a libgcc_s.a

	Exceptions do not work reliably when the GCC -static link option
is used.

David



More information about the Gcc mailing list