This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fPIC and %ebx

Hi !
	I have been trying to force my program compiled using -fPIC to use
a GOT of my own i.e. one I create during program execution. I copy the
entire program segment to a separate location and then change %ebx to
point to the location of the new GOT. The problem is that whenever, I call
a function, the value of %ebx is being reset to the original one at the
beginning of the function.
	The assembly code shows that the compiler forces recalculation of
%ebx from the program counter at the beginning of every function. To be
more precise, %ebx is loaded with the present program counter value and
then the difference between the program counter and the original value of
%ebx is added to it. Is there anyway to get around this ? I mean how can I
avoid this reinitialisation of %ebx or what do I need to do to ensure that
this recalculation results in my changed %ebx and not the original one ?
	I would be very greatful to anyone who can throw some light on
this . Thanking you in anticipation,


Joy Mukherjee
Graduate Student,
Deptt. of CS,
Virginia Tech,
Blacksburg,VA - 24061.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]