This is the mail archive of the gcc-help@gcc.gnu.org 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]

Static variable addressing (addendum)


I am sorry , I forgot to provide the following important information in my
previous mail -

	 I am working on Intel Linux (glibc2) and using
Pthreads/Pth as the threads package.

	 I have appended the original mail for
the sake of identification . Once again thanks and sorry for the extra
traffic .

Joy.

-- Original message --

Hi !
	I was trying to separate static variables for threads i.e. if I
had 2 threads, I want that each should have its own copy of static
variables . Is there anyway I can do that ? What I could figure out on my
own is this -

	1> On using -fPIC to compile my code, the compiler allocates space for all
static variables in the .data section along with the globals. However,
while the true globals are accessed through the GOT, the statics are
accessed only as an offset from the beginning of the GOT .
	2> I can manage the required separation if I can somehow get the
statics also to be accessed through the GOT but gcc does not create
entries for the statics in the GOT at all. Is there anyway , I can do this
?
	3> Also, where in the gcc code are the global and static variables
handled ? That is , where in the code does the compiler allocate space in
the GOT for the globals and where is the access pattern for globals and
statics incorporated during the compilation process ? If I can know this,
I may try to go in and modify things if possible to suit my needs .

	I thank everyone for taking time to read this mail.

Sincerely,
Joy.

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]