14. Position Independent Code (PIC) and Dynamic LinkingΒΆ

In some large and/or complex applications, it is useful to be able to load and unload blocks of code and data on an as-needed basis at run-time. This is particularly true in an embedded system where memory resources are limited, or in an application that needs to facilitate updates of plug-ins or libraries that it uses.

Dynamic Linking is well-suited to supply such capability. It is a process where libraries are linked with the underlying application and loaded into an available memory location at run-time. Dynamic linking requires that such libraries be comprised of Position Independent Code (PIC) that can be loaded to and run correctly from any available memory address.

The tiarmclang compiler tools, starting with version 5.1.0.LTS, provide support for generating position independent code (PIC) via the -fPIC compiler option and support for dynamic linking.