3.6.1.15 Short-calls Option
The -mshort-call
option controls how calls are
encoded.
When building for devices which have more then 8kB of program memory,
the compiler will automatically use the longer form of the jump and call instructions
when program execution is leaving the current function. Doing so allows program
execution to reach the entire memory space, but the program will be larger and take
longer to execute. The -mshort-calls
option will force calls to use
PC-relative instructions such as the rjmp
and rcall
instructions, which have a limited destination range. This option has no effect on
indirect jumps or calls made via function pointers.
Use this option with caution, as your code might fail if functions fall
out of range of the shorter instructions. See the -mrelax
option (3.6.1.11 Relax Option) to allow function
pointers to be encoded as 16-bits wide, even on large memory device. This option has no
effect for the avr2 and avr4 architectures, which have less than 8kB of program memory
and which always use the shorter form of the call/jump instructions.