as: Xtensa Call Relaxation
1
1 9.55.4.2 Function Call Relaxation
1 .................................
1
1 Function calls may require relaxation because the Xtensa immediate call
1 instructions ('CALL0', 'CALL4', 'CALL8' and 'CALL12') provide a
1 PC-relative offset of only 512 Kbytes in either direction. For larger
1 programs, it may be necessary to use indirect calls ('CALLX0', 'CALLX4',
1 'CALLX8' and 'CALLX12') where the target address is specified in a
1 register. The Xtensa assembler can automatically relax immediate call
1 instructions into indirect call instructions. This relaxation is done
1 by loading the address of the called function into the callee's return
1 address register and then using a 'CALLX' instruction. So, for example:
1
1 call8 func
1
1 might be relaxed to:
1
1 .literal .L1, func
1 l32r a8, .L1
1 callx8 a8
1
1 Because the addresses of targets of function calls are not generally
1 known until link-time, the assembler must assume the worst and relax all
1 the calls to functions in other source files, not just those that really
1 will be out of range. The linker can recognize calls that were
1 unnecessarily relaxed, and it will remove the overhead introduced by the
1 assembler for those cases where direct calls are sufficient.
1
1 Call relaxation is disabled by default because it can have a negative
1 effect on both code size and performance, although the linker can
1 usually eliminate the unnecessary overhead. If a program is too large
1 and some of the calls are out of range, function call relaxation can be
1 enabled using the '--longcalls' command-line option or the 'longcalls'
1 directive (⇒longcalls Longcalls Directive.).
1