What Does the Linker Actually Do for Us?

By CB Bailey & Andy Balaam

In this session Andy and CB explore what linkers actually get up to when they pull together your C++ code and libraries to produce an executable.

This session is aimed at developers who have some experience with working with a compiled language such as C or C++ and want to know more about the how the last tool in their toolchain works.

The session will examine what information object files typically contain and what is required to make a complete executable program out of one or more object files. All of the examples and demonstrations will be using Linux and ELF object files, but the concepts are applicable across most modern environments.

We’ll define concepts such as sections, symbols, relocations and look at how code and data are managed in a program. We’ll explore how the operating system runs a program and how this shapes what the linker actually does. We’ll also explore aspects particular to C++ such as how template instantiations and inline functions are managed.

On the way we’ll look at tools that can be used for examining object files and executables that let us dispel the mysteries of the linker.