-fPIC compiler option doesnt let application initialize
Hi,
I am rather having a strange issue with using -fPIC compiler option. My application is developed using GCC and an binary executable created out of it which initializes successfully. By initialization, I meant all the threads in the application are created and I get the required response from the executable.
There was a need to create a .so file out of my application instead of binary executable, as it needs to be integrated with another .so file to create a final patch. So we used -fPIC compiler option and created a .so and also an binary executable.
But with -fPIC included, the executable fails to initialize at all. It executes some instructions in the main program, before finally haulting down with a " Program received signal SIGSEGV, Segmentation fault." error. And it always fails at the same faulty address which points to nothing in my application code.
Tried out different debugger tools gdb, valgrind and even strace. Doesnt seem to point any thing. What is that -fPIC adds to the code, which makes my code fail with strange behaviour.
Appreciate any help on this.
Thanks,
LNXDEBUG
|