how to use gp relative adressing in GASM for mips

Jul 07, 2011 0 Replies

my problem is very simple. I'm uisng GCC for mips, and , I have to do a small part of the code in assembly



I have my $(gp) register correctly set to the _gp section -in the midle of the sda section



I have one variable defined like that



.sdata usbMaxPipeNum: .word 0xFFFFFFFF



and now, in my source, I would like to load $t8 with the content of usbMaxPipeNum, using the gp relative adressing I tried lw $t8, (usbMaxPipeNum) $(gp) the result is Error: illegal operands `lw $t8,usbMaxPipeNum $(gp)'



I tried to add .extern _gp in the .sdata section and then lw $t8, (usbMaxPipeNum - _gp) $(gp) the result is illegal operands `lw $t8,(usbMaxPipeNum-_gp)$(gp)'



what is the correct syntax to do what I want ? thanks in advance for your help



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required