Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
Functions
2012-2013 Microchip Technology Inc. DS50002071C-page 187
13.7.1 Near or Far Code
Functions that are near (within a radius of 32 kWords of each other) may call each other
more efficiently than those which are not. If it is known that all functions in an applica-
tion are near, then the default -msmall-code command line option can be used when
compiling each module to direct the compiler to use a more efficient form of the function
call.
If this default option is not suitable, then the following alternatives are available:
1. It is possible to compile some modules of an application using the
-msmall-code command line option. In this case, only function calls in those
modules will use a more efficient form of the function call.
2. If the -msmall-code command-line option has been used, then the compiler
may be directed to use the long form of the function call for an individual function
by tagging it with the far attribute.
3. Instead of using command-line options, which have module scope, the compiler
may be directed to call individual functions using a more efficient form of the
function call by tagging their declaration and definition with the near attribute.
4. Group locally referent code together by using named sections or keep this code
in common translation units.
The linker will produce an error message if the function declared to be near cannot be
reached by one of its callers using a more efficient form of the function call.
Protego_Release_01_05-Related-OEM-Documentation-MPLAB-XC16-C-Compiler.pdf