This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
use $gp with mips platform
- From: Yaroze <Yaroze at 21cn dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 20 Dec 2001 14:36:53 +0800
- Subject: use $gp with mips platform
- Reply-to: Yaroze <Yaroze at 21cn dot com>
Hello Everyone,
I am trying to optimize a program running on an embedded MIPS platform.
When I try to use $gp (global pointer) register to reduce the
instruction numbers to access global variables, linker ld refuses to
operate correctly. The program get compiled and linked fine with "-G
0"(turn off $gp optimization), but failed with "-G 8". The linker
gives a message of "relocation truncated to fit: R_MIPS_GPREL16 no
symbol" at each location using global variable.
Can anyone tell me how to solve this problem? I appreciate your help
very much.
And since the program includes boot code, I need to initialize $gp
with a given symbol by the linker. I tried with "la $gp,_gp", but
linker said it was an undefined symbol. So how should I initialize
$gp?
Alex mailto:Yaroze@21cn.com