This is the mail archive of the
mailing list for the GCC project.
Static variables and PIC option problem ![thumb]
- From: "Thierry COLIN" <thierry dot colin at thales-e-transactions dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 27 May 2002 18:19:47 +0200
- Subject: Static variables and PIC option problem ![thumb]
- Organization: THALES-e-TRANSACTIONS SA
I would like to use a static variable which can be known only to the
functions in the file where it is declared.
However, I need to use the PIC option to generate position independent
I work with GCC 3.1 for arm/thumb processors (options -mthumb
When the program want to access to the static variable, It use a
assembler code like that :
- Use an offset contained in the code section
- Add the PIC register to this offset
It contains so the address in data section where the static variable is
When I move the code section, the offset became incorrect and when it
adds the PIC register, the address is not correct and access to a
Does it exist a solution to produce a code which use the PIC register as
without the static variable (because without static, it access to the
variable by the PIC register and the GOT section...) or an option to
specify that the variable will be accedded by PIC register?
Thanks and regards