Hi there, thanks for your questions.

> -----Original Message-----
> From: John Tytgat [mailto:john.tyt...@aaug.net] 

[...]

> I've read with interest the
> https://wiki.ubuntu.com/ARM/Thumb2PortingHowto page and I'm 
> wondering about the following : in the "Quick Reference" 
> section it is mentioned that "bx lr" is a no go for ARMv4 and earlier.

The Thumb instruction set did not exist at all before ARMv4T, and so in
ARMv4 and earlier architectures do not understand the BX instruction which
is used to switch to and from Thumb.

> But further on we have:
> 
> #ifdef (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
>         "mov    pc, lr"
> #else
>         "bx     lr"
> #endif
> 
> Why do we have the __ARM_ARCH_4T__ test ? ARMv4T happily 
> groks "bx lr", no ?

You are right, but to minimise any impact on Debian (who build for ARMv4T
but do not make use of Thumb) I count ARMv4T as a non-Thumb architecture.

As things stand Debian should work on ARMv4 (non-T) platforms, and it's
possible some are still in use; if so, I don't want to break these with our
updates.

ARMv4T has some particular limitations which require less efficient
interworking return sequences for Thumb functions compared with the newer
architectures, so Thumb is less likely to be used for general userspace code
in Debian (unless they migrate completely to a higher architecture baseline
at some point in the future).


Strictly speaking, the test could be

#if defined(__ARM_ARCH_2__) || defined(__ARM_ARCH_3__) || \
        defined(__ARM_ARCH_3M__) || \
        defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)

However, this is verbose and easy to get wrong; and ARMv4 is about the
oldest baseline used by anyone at present.

Reversing the sense of the #if (to detect any compatible architecture, as
opposed to rejecting incompatible ones) is difficult to do in an
upwards-compatible way because of the way GCC describes the architecture in
its predefines.


I'll poke the wiki to clarify the rationale here (though discussion is still
welcome).

Cheers
---Dave



-- 
Ubuntu-mobile mailing list
Ubuntu-mobile@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-mobile

Reply via email to