Share via


Linker-Generated Thunking Routines

9/7/2007

If no declspec call enables interworking function calls, the linker generates a thunking routine to perform necessary caller-side mode changes from ARM to THUMB or vice versa. The linker generates a thunking routine for each unique function called from an object that requires the opposite mode.

For the required mode switch to occur on the return from the function, the programmer must use the /QRinterwork-return - Enable Interworking flag at compile time.

The following code example shows a linker-generated thunking routine generated when switching from ARM to THUMB mode.

0xe59fc000    ldr  r12, [pc]
0xe12fff1c    bx   r12
0x00000000    DCD |destination|

The following code example shows the linker-generated thunking routine generated when switching from THUMB to ARM mode.

0xb408        push  {r3}
0x4b02        ldr  r3, [pc, #8]
0x469c        mov r12, r3
0xbc08        pop  {r3}
0x4760        bx   r12
0x0000        pad
0x00000000    DCD |destination|

See Also

Reference

/QRinterwork-return - Enable Interworking
/QRArch - Specify Target Architecture