rtl problem when processing arm thumb mode switch

Chris Johns chrisj at rtems.org
Thu May 9 23:12:41 UTC 2013

Peng Fan wrote:
> I am trying to make the mode switch work on rtl for arm.

What does "mode switch" mean ?

> The following code is disassembled using arm linux gcc.
> elf object file:  compiled in thumb mode.
> 38:f7ff bffe b.w0 <rtems>
> 38: R_ARM_THM_JUMP24rtems
> It invokes a function "rtems" which are in arm mode.
> elf executable file:
> 8414:f000 b85c b.w84d0 <__rtems_from_thumb>
> 000084d0 <__rtems_from_thumb>: //stub code
>      84d0:4778 bxpc
>      84d2:46c0 nop; (mov r8, r8)
>      84d4:eaffffc0 b83dc <rtems>
> the arm linux gcc uses a stub code to handle the thumb to arm invoking.

Why would we want this ? I would assume RTL loaded code must be the same 
as the base kernel code.

> I also want to introduce this for arm rtl.But I do not have a good idea
> about how to manage the stub code. Each rap file may contain many such
> reloc entry, each such reloc entry needs a stub code.
> How to manage the stub codes?

RTEMS does not have the requirement to support multiple code "modes" at 
runtime and Linux does. For embedded systems it is sensible to enforce 
one code type.


More information about the devel mailing list