views:

19

answers:

1

I'm trying to convert a Windows based library that my company produces to run on AIX. We are currently able to run it on Solaris and Linux but AIX is causing some additional issues. I'm not sure if this is an OS setup issue or a coding issue but I'm trying the coding approach first. The library exports some function using a C style convention from various modules. My test application can happily call some of the functions from some modules. There is one particular module, however, where every function segfaults. I've put a cout log message at the top of the function and this does not get hit. Looking at the coredump with dbx shows only that the fault is an illegal opcode 0x0. I've tried writing a test app that exports a function from a library and consumes it in an app which is fine. I've also tried writing a smaller test app which links in only the module containing the offending functions. In this case I can trigger the cout logging in the function. I have all optimisations switched off and the same compiler flags/versions for the app and the library.

It feels to me like the library is too large/exports too many functions and something is becoming corrupted/overflowing. I have no AIX experience so any pointers on whether this is likely or other avenues to persue for debugging this would be much appreciated.

A: 

The segfault is a red herring. The problem was that I had used -G on the linker line in the application. It seems that tells the linker that you're using run time linking and so it ignores undefined functions. When I called an underfined function which I hadn't dynamically linked in it was reasonably crashing. Once I took out the -G flag from the app I had a list of undefined symbols for the functions that were causing me problems. I'm still not completely clear why but trimming back linker flags a bit further seems to have resolved that as well (specifically I've removed the -shared flag I had on the library). I just need to statically link some third party libs in and I'll be all set.

Jon
Actually removing -shared just makes the library static so you don't need to export anything. I need the library to be shared so I've had to put this back. If you don't use an explicit export list you need to use -bexpfull to make sure that you export everything. -bexpall doesn't seem to always export everything.
Jon