[patch, nios2] fix constant fixup overflow assembler bug

Sandra Loosemore sandra@codesourcery.com
Wed Jun 12 23:26:00 GMT 2013


Altera reported a Nios II assembler bug to us in which a movia 
pseudo-instruction with a negative constant operand generated bad code. 
  E.g.

	movia r2, 0xfffffff0

turned into

	movhi	r3,0             <- wrong register r3 instead of r2
	addi	r2,r2,-16

Turns out this really didn't have anything to do with movia per se; the 
problem was the failure to mask constant BFD_RELOC_NIOS2_HIADJ16 fixups 
to 16 bits before or'ing them with the instruction word.  Such masking 
is indicated by the documentation for the %hiadj macro in the processor 
documentation.

I've checked in the attached patch with the obvious fix and an 
additional test case.  Since this was a fairly generic change that could 
affect things other than movia, I also regression-tested on 
gcc/g++/libstdc++ testsuites to give broader test coverage.

-Sandra

-------------- next part --------------
A non-text attachment was scrubbed...
Name: movia.log
Type: text/x-log
Size: 285 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20130612/de533a13/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: movia.patch
Type: text/x-patch
Size: 1699 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20130612/de533a13/attachment-0001.bin>


More information about the Binutils mailing list