SPRUI04F july 2015 – april 2023
Finally, the preferred function order command file that is produced by the clt6x is fed into the linker during the re-build of the application, as follows:
cl6xoptions --run_linker *.obj forder.cmd -llnk.cmd |
The preferred function order command file, forder.cmd, contains a list of --preferred_order=function specification options. The linker prioritizes the placement of functions relative to each other in the order that the --preferred_order options are encountered during the linker invocation.
Each --preferred_order option contains a function specification. A function specification can describe simply the name of the function for a global function, or it can provide the path name and source file name where the function is defined. A function specification that contains path and file name information is used to distinguish one static function from another that has the same function name.
The --preferred_order options are interpreted by the linker as suggestions to guide the placement of functions relative to each other. They are not explicit placement instructions. If an object file or input section is explicitly mentioned in a linker command file SECTIONS directive, then the placement instruction specified in the linker command file takes precedence over any suggestion from a --preferred_order option that is associated with a function that is defined in that object file or input section.
This precedence can be relaxed by applying the unordered() operator to an output specification as described in Section 4.11.7.