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]

use $gp with mips platform


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



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