Function inlining with the linker
The linker inlines functions depending on what options you specify and the content of the input files.
The linker can inline small functions in place of a branch instruction to that function. For the linker to be able to do this, the function (without the return instruction) must fit in the four bytes of the branch instruction.
--no_inline command-line options to control branch
only turns off inlining for user-supplied objects. The linker still inlines functions from
the ARM® standard
libraries by default.
If branch inlining optimization is enabled, the linker scans each function call in the image and then inlines as appropriate. When the linker finds a suitable function to inline, it replaces the function call with the instruction from the function that is being called.
The linker applies branch inlining optimization before any unused sections are eliminated so that inlined sections can also be removed if they are no longer called.
- For ARMv7-A, the linker can inline two 16-bit encoded Thumb instructions in place of
the 32-bit encoded Thumb
- For ARMv8-A and ARMv8-M, the linker can inline two 16-bit T32 instructions in place of
the 32-bit T32
--info=inline command-line option to list all the inlined