5.2. Jump tables

A jump table (or branch table) is a method used to remove dependencies between different versions of binary files. The simplest form of a jump table is a table of branch instructions. When calling a function in a separate binary file, the code branches into the jump table, and the jump table then branches to the required function.

Each function in a binary file that can be called from another binary has an entry in the jump table. The jump table is at a fixed location that is not changed between different versions of the binary file. Therefore any calls to a particular jump table entry results in the correct function being executed. The exact location of the function does not matter to the calling application and can vary between versions of the binary file.

Figure 5.1. Jump table

To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.


The example in Figure 5.1 shows two binaries. Binary A contains a function called foo that calls a function called bar in Binary B, using the second entry in a three-entry jump table. Each time a new version of the Binary B is created, provided that the address of the jump table is statically linked to the same location, the static linker does not need to worry about the address it gives to function bar. This is because any calls to bar go through the jump table.

In the example Binary A has no jump table, but if bar called foo, and Binary A is likely to be replaced in the future with a newer version, then Binary A also requires a jump table.

A situation where jump tables might be useful is when a system includes an RTOS, which is delivered with lower level functions for handling input and output The addresses of each function are stored in a given entry of the jump table (table of function pointers). If the RTOS is updated, some of the lower level functions might move to new locations. Any threads from a different binary which rely on the functions can still branch to them without the threads needing to be rebuilt and reloaded.

Jump tables are normally written in assembler and then placed at a fixed location in memory. It is critical that this location is not modified and that the location of individual jump table entries does not change between builds.

A symdefs file that only includes entries for the jump table can be used when generating other applications or binaries that use the functions.

Copyright © 2010 ARM. All rights reserved.ARM DAI 0242A
Non-ConfidentialID011411