This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] MIPS/GAS: Correct ISA bit handling in backreferences
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: <binutils at sourceware dot org>
- Date: Sat, 22 Sep 2012 09:01:03 +0100
- Subject: Re: [PATCH] MIPS/GAS: Correct ISA bit handling in backreferences
- References: <alpine.DEB.email@example.com>
"Maciej W. Rozycki" <firstname.lastname@example.org> writes:
> 2012-09-21 Maciej W. Rozycki <email@example.com>
> * config/tc-mips.c (md_assemble): Add a call to mips_mark_labels.
OK as far as it goes, but...
> * gas/mips/branch-swap-2.s: Make sure the ISA bit is clear in
> the label used for calculation.
...not OK. "." ought to evaluate to the same thing as a label
on the current instruction. It happens to do that at the moment
because of the bug you're fixing, but only by both being wrong.
Having the (. - foo) in:
insn1 (. - foo)
evaluate to anything other than 0 is wrong.
To show there's a bug here:
addiu $4,$4,.L2 - .
addiu $4,$4,. - .L1
addiu $4,$4,. - foo
0: 0c00 nop
2: 0c00 nop
4: 3084 000a addiu a0,a0,10
8: 4c8a addiu a0,a0,5
a: 3084 0009 addiu a0,a0,9
e: 0c00 nop
The forward reference (first ADDIU) is correct, but the other two
are wrong. (The forward reference works thanks to your 2010-12-16 change.)