This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] MIPS/GAS: Correct ISA bit handling in backreferences

"Maciej W. Rozycki" <> writes:
> 2012-09-21  Maciej W. Rozycki  <>
> 	gas/
> 	* config/tc-mips.c (md_assemble): Add a call to mips_mark_labels.

OK as far as it goes, but...

> 	gas/testsuite/
> 	* 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:

	.ent	foo
	.set	micromips
	addiu	$4,$4,.L2 - .
	addiu	$4,$4,. - .L1
	addiu	$4,$4,. - foo
	.end	foo


00000000 <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.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]