bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GAS for ARM: does not support BX instruction for ARMv3 and lower


From: Nicholas Clifton
Subject: Re: GAS for ARM: does not support BX instruction for ARMv3 and lower
Date: Tue, 23 Dec 2014 11:09:15 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

Hi Sergey,

I try to compile program for ARMv3 or ARMv2 CPU target using GCC (4.8.x).
It produces assembler code with BX LR instructions (return from function)
which GAS (2.23.2) cannot compile:
    Error: selected processor does not support ARM mode `bx lr'

This is really a gcc bug. ARM architectures before v4T do not support the BX instruction, and so gcc should not be generating it.


It is work for ARMv4 mode and greater (ARMv4 has no BX <reg> instruction
support, but GAS compiles it as MOV PC,<reg>).

You could try adding "--fix-v4bx" (or -Wa,--fix-v4bx) to your command line, but whilst this will allow the instruction to be assembled, it will not convert it into a MOV PC, LR instruction.


As I know BX <reg> is strongly recommended to be used instead of MOV
PC,<reg> by the ARM architecture manual (section A.4.1.1).

True - although I think that the ARM ARM also assumes that you will be using a newer architecture - v2 and v3 are very old now.

Cheers
  Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]