Skip to contentSkip to conversation

about gas load_address

DISCUSSION Fuxin Zhang 2 participants 2 messages May 27, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

hi,all

(sorry if it is somewhat out of topic,but i think most mips experts are here:)

else if (mips_pic == SVR4_PIC && ! mips_big_got)
{
expressionS ex;

/* If this is a reference to an external symbol, we want lw $reg,<sym>($gp) (BFD_RELOC_MIPS_GOT16)
Otherwise we want
lw $reg,<sym>($gp) (BFD_RELOC_MIPS_GOT16)
nop
QUESTION:
Could somebody tell me why we generate a unconditional 'nop' here? addiu $reg,$reg,<sym> (BFD_RELOC_LO16)
If there is a constant, it must be added in after.

If we have NewABI, we want
lw $reg,<sym+cst>($gp) (BFD_RELOC_MIPS_GOT_DISP) unless we're referencing a global symbol with a non-zero offset, in which case cst must be added separately. */

Thanks in advance.

#1 lore raw
Quoted 3 lines · Fuxin Zhang

Date: Tue, 27 May 2003 17:35:04 +0800
From: Fuxin Zhang <[email protected]>
To: MAKE FUN PRANK CALLS <[email protected]>

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Funny alias for this list :-)

Quoted 2 lines

(sorry if it is somewhat out of topic,but i think most mips experts are here:)

Certainly more on topic than making prank calls ;-)

Quoted 4 lines

else if (mips_pic == SVR4_PIC && ! mips_big_got)
{
expressionS ex;

Quoted 9 lines

/* If this is a reference to an external symbol, we want lw $reg,<sym>($gp) (BFD_RELOC_MIPS_GOT16)
Otherwise we want
lw $reg,<sym>($gp) (BFD_RELOC_MIPS_GOT16)
nop
QUESTION:
Could somebody tell me why we generate a unconditional 'nop' here? addiu $reg,$reg,<sym> (BFD_RELOC_LO16)
If there is a constant, it must be added in after.

The nop would only be needed for the R2000/R3000 family where a load instruction may not immediately be followed by it's consumer instruction. NewABI implies MIPS III or higher so the nop wouldn't be required for such processors. Gcc and gas have sort of a tradition of throwing many more nops in than needed ...

Quoted 4 lines

If we have NewABI, we want
lw $reg,<sym+cst>($gp) (BFD_RELOC_MIPS_GOT_DISP) unless we're referencing a global symbol with a non-zero offset, in which case cst must be added separately. */

Ralf