6.1.13 K: Disable Overlap of Compiled Stack

The -K linker option disables the overlap of auto/parameter blocks stored on the compiled stack managed by the linker.

If you are linking C programs, the compiled stack is managed by the compiler's code generator. The linker takes no part in the formation of the compiled stack and this option has no effect.

For hand-written assembly programs built using the PIC Assembler, a compiled stack used to hold auto-like and parameter objects is automatically created once you start using FN-type directives in your code. Such a stack is managed by the linker.

If two routines using the compiled stack are not active at the same time (as indicated by a program's FNCALL directives), the blocks of data used by those routines for stack-based objects are automatically overlapped in memory by the linker. The -K option prevents this overlap, forcing the linker to assign each block into unique memory. The use of this option might increase the amount of data memory used by a program.