Exceptions, Optimizations and AIX
Michael Veksler
VEKSLER@il.ibm.com
Tue Sep 2 15:53:00 GMT 2003
> A little supplement:
>
> I just tried building all my objects/libraries with -O1 and it works.
>
> So mixing different objects/libraries with different optimization levels
> doesn't work.
> This is not what i would expect. Can you please confirm that this should
> work?
I found that on some circumstances it may look it is a matter of
optimization flags when in fact one of the following happens:
1. You forgot to add a link flag: -Wl,-brtl
This will break many things, including static variables
of template classes.
2. When you created two different shared objects, you created
them in the following way:
gcc -shared first.o -o tmp.so && mv tmp.so first.so
gcc -shared second.o -o tmp.so && mv tmp.so second.so
This will break your global variable construction.
In all cases, when global variables get broken, it is possible
to have exceptions broken as well.
One annoying thing that I have noticed for AIX-4.3.3 and at least
gcc-3.2, is that exception handling information gets constructed
after global variables are. This means that 'catch' does not
work in constructors of global variable.
I have not checked that for newer gcc's yet.
More information about the Gcc
mailing list