Exception handling is not working in GCC compile shared object
777730Mar 15 2011 — edited Mar 17 2011Hello,
I am facing very strange issue on Solaris x86_64 platform with C++ code compiled usging gcc.3.4.3.
I have compiled shared object that load into web server process space while initialization. Whenever any exception generate in code base, it is not being caught by exception handler. Even though exception handlers are there. Same code is working fine since long time but on Solaris x86, Sparc arch, Linux platform
With Dbx, I am getting following stack trace.
Stack trace is
dbx: internal error: reference through NULL pointer at line 973 in file symbol.cc
[1] 0x11335(0x1, 0x1, 0x474e5543432b2b00, 0x59cb60, 0xfffffd7fffdff2b0, 0x11335), at 0x11335
---- hidden frames, use 'where -h' to see them all ----
=>[4] __cxa_throw(obj = (nil), tinfo = (nil), dest = (nil), , line 75 in "eh_throw.cc"
[5] OBWebGate_Authent(r = 0xfffffd7fff3fb300), line 86 in "apache.cpp"
[6] ap_run_post_config(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x444624
[7] main(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x42c39a
I am using following link options.
Compile option is
/usr/sfw/bin/g++ -c -I/scratch/ashishas/view_storage/build/coreid1014/palantir/apache22/solaris-x86_64/include -m64 -fPIC -D_REENTRANT -Wall -g -o apache.o apache.cpp
Link option is
/usr/sfw/bin/g++ -shared -m64 -o apache.so apache.o -lsocket -lnsl -ldl -lpthread -lthread
At line 86, we are just throwing simple exception which have catch handlers in place. Also we do have catch(...) handler as well.
Surpursing things are..same issue didn't observe if we make it as executable.
Issue only comes if this is shared object loaded on webserver. If this is plain shared object, opened by anyother exe, it works fine.
Can someone help me out. This is completly blocking issue for us. Using Solaris Sun Studio compiler is no option as of now.