Caveats

For ARM v4t architectures (such as ARM7TDMI), it is not possible to return to the Thumb operating state from a far function call.

For example, suppose you have the folllowing source code in Thumb mode:

    ldr r1,[pc+16] ;load address of far function 
    mov lr,pc 
    bx r1 
    ... more thumb instructions ... 

A return from the far function would return in ARM mode because in ARM v4t architectures, the statement mov lr,pc does not preserve the operating state of the machine. This is not an issue in ARM v5t architectures because the blx instruction preserves the operating state of the machine.

A warning is issued for any far function calls for ARM v4t machines:

Warning : Return from far function call in v4t machine will not restore Thumb state 

Another thing to be aware of is that designating a function as a far function will not prevent automatic inlining if the reference and definition of the function are in the same file and automatic inlining is enabled.

However, automatic inlining can be suppressed with:

 __attribute__((noinline)) 
Listing: Example of suppressing automatic inlining
__declspec(section "FARSECT")  void farfunc(int) 
__attribute__((noinline));