On 17/08/16 10:19, Adam Wysocki wrote:
Is it possible for a compiler to generate BX instructions without Thumb code (for example to return from a function with bx lr, where lr will always be even - no Thumb)? Correct me if I'm wrong, but I thought that BX patch (to emulate BX instruction in kernel) was supposed to allow running code with BX instructions on a processor that lacks it, and that's why I want to use it (to run Debian for armel on StrongARM SA-1100, which has ARMv4 core, so without Thumb). Code in Debian for armel architecture doesn't use Thumb?
Unless explicitly told otherwise the compilers in Debian armel build arm mode code. I don't think there is anything forbidding packagers from chosing thumb mode for their code but they would have to go out of their way to make that choice and i'm not aware of anyone doing so. However the compiler doesn't know whether you will be mixing the arm code it built with thumb code built with another compiler invocation. So it uses BX for function calls and returns.