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.
The following options are available to control function inlining:
--no_inlinecommand-line options allow you to control branch inlining. However,
--no_inlineonly turns off inlining for user-supplied objects. The linker still inlines functions from the ARM C Library by default.
--inline_type=typecommand-line option gives you more control over inlining. You can also inline functions from the ARM C Library, and turn off inlining completely. This option overrides
--inlineif both are present on the command-line.
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.
The linker can inline two 16-bit encoded Thumb instructions in place of the 32-bit
--info=inline command-line option to list all the inlined