This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Information regarding -fPIC support for Interix gcc
Mayank Kumar <mayank@microsoft.com> writes:
> Ok, since I didn't get any pointers in this area.
> I have a more generic question now to everybody:-
>
> I am new to gcc development as well as its architecture. I am looking forward to fix the -fPIC issue for Interix. As of now I found that a shared library compiled with fPIC crashes due to some wrong assembly instructions(a jmp instruction) embedded into a function call which cause it to jump unconditionally to a different function altogether whereas the c code has no such jumps or function calls.
> Can some body point me to the part of source code that I should look into for this. I mean:-
These are all rather difficult questions to answer succintly. gcc is
a large code base. It is not organized in a way which makes it simple
to answer this sort of question.
> 1: the part which is responsible for generating this code from c code.
If by "this code" you mean inserting a jmp instruction, there are many
possibilities. The first one you should look at is that at least on
some x86 platforms gcc intentionally calls __i686.get_pc_thunk.bx as
part of setting the PIC register. This looks a different function but
it is just a tiny helper routine.
> 2: the part of the gcc code where -fPIC is being handled.
It is handled in a number of places. Search for flag_pic. For i386
in particular the most exciting place is probably
legitimize_pic_address.
> 3: any other pointers to investigating this would be helpful.
Reading the gcc internal's manual?
Ian