ARM Thumb byte stores

Nick Clifton nickc@redhat.com
Tue Feb 6 12:07:00 GMT 2001


Hi Jifl,

: arm-elf-gcc -mthumb generates the following instruction:
: 
: 	.code	16
: 	strb	r3, [sp]
: 
: However this seems to be falling foul of a check in
: gas/config/tc-arm.c:5863:
: 
:   if (Rb == REG_PC || Rb == REG_SP)
:     {
:       if (size != THUMB_WORD)
: 	{
: 	  inst.error = _("byte or halfword not valid for base register");
: 	  return;
: 	}
: 
: The size in this case is obviously THUMB_BYTE, not THUMB_WORD. So is this
: check in gas correct? Or is this a gcc problem. I don't know much about
: Thumb, sorry.

It is a GCC bug.  The STRB instruction in Thumb mode can only take a
"low" register (r0 - r7) as the base address register.  The STR
instruction has an extra mode where it can also use the stack pointer
(SP) as an address register.

What is the source code/command line that is generating this
assembler? 

Cheers
	Nick


More information about the Binutils mailing list