This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: MIPS gas relaxation still doesn't work
On Mon, Oct 14, 2002 at 12:51:34PM -0700, David S. Miller wrote:
> From: "H. J. Lu" <hjl@lucon.org>
> Date: Mon, 14 Oct 2002 12:55:49 -0700
>
> .set noreorder
> .set nomacro
>
> bne $2,$0,$L7493
> nop
> j $L2
> nop
>
> .set macro
> .set reorder
>
> answer your question?
>
>
> What instruction would you like to place in the bne's delay
> slot? 'j' cannot go into a delay slot.
>
> And likewise, 'bne' cannot go into j's delay slot.
If gcc just emits
bne $2,$0,$L7493
j $L2
gas will fill the delay slot with nop or branch relaxation. For
bar:
foo:
.space 0x20000
bne $2,$0,bar
j foo
gas generates
foo.o: file format elf32-tradlittlemips
Disassembly of section .text:
00000000 <bar>:
...
20000: 10400005 beqz v0,20018 <bar+0x20018>
20004: 00000000 nop
20008: 8f810000 lw at,0(gp)
20008: R_MIPS_GOT16 .text
2000c: 00000000 nop
20010: 24210000 addiu at,at,0
20010: R_MIPS_LO16 .text
20014: 00200008 jr at
20018: 00000000 nop
2001c: 8f810000 lw at,0(gp)
2001c: R_MIPS_GOT16 .text
20020: 00000000 nop
20024: 24210000 addiu at,at,0
20024: R_MIPS_LO16 .text
20028: 00200008 jr at
2002c: 00000000 nop
H.J.