This is the mail archive of the gcc@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 variables and PIC option problem ![thumb]


Hi,

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
code.
I work with GCC 3.1 for arm/thumb processors (options -mthumb
-mthumb-interwork -fpic)

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
present.
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
undefined address...

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
Thierry


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