ancient ARM cpus

Torbjörn Granlund tg at
Sun Nov 15 11:57:47 UTC 2015

nisse at (Niels Möller) writes:

  Where and how do you set ARM_THUMB_MODE? If I understand these things
  correctly, the right check is not whether or not gmp is compiled in
  thumb mode, but whether or not it's going to run on a machine where
  thumb code might call it. Which I guess needs a configure option, since
  it is difficult for configure to guess correctly and automatically.
  What's the corresponding gcc flag to avoid using bx in compiler
  generated code?
I don't recall the details here, but I think the following is true:

* The bx instruction is not available before v5, except v4t...

* Using "mov lr, pc" (or ldm including pc) will not work correctly in
  ARM state for returning to thumb state.

If I haven't misundertstood things, our unconditional use of bx in
mpn/arm/*.asm is incorrect.  Such code should live in mpn/arm/v5, or
else be conditionalised to use bx when available.

I don't know the following:

* Is bx always available in v5 (and later) or only when there is also
  thumb support (which I think was optional before v7).

Please encrypt, key id 0xC8601622

More information about the gmp-bugs mailing list