how to use gp relative adressing in GASM for mips

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

Reply to
jean nemar
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.