Category: Programming

  • Linkers part 17

    Warning Symbols The GNU linker supports a weird extension to ELF used to issue warnings when symbols are referenced at link time. This was originally implemented for a.out using a special symbol type. For ELF, I implemented it using a special section name. If you create a section named .gnu.warning.SYMBOL, then if and when the…

  • Linkers part 16

    C++ Template Instantiation There is still more C++ fun at link time, though somewhat less related to the linker proper. A C++ program can declare templates, and instantiate them with specific types. Ideally those specific instantiations will only appear once in a program, not once per source file which instantiates the templates. There are a…

  • Linkers part 15

    COMDAT sections In C++ there are several constructs which do not clearly live in a single place. Examples are inline functions defined in a header file, virtual tables, and typeinfo objects. There must be only a single instance of each of these constructs in the final linked program (actually we could probably get away with…

  • Linkers part 14

    Link Time Optimization I’ve already mentioned some optimizations which are peculiar to the linker: relaxation and garbage collection of unwanted sections. There is another class of optimizations which occur at link time, but are really related to the compiler. The general name for these optimizations is link time optimization or whole program optimization. The general…

  • Linkers part 13

    Symbol Versions Redux I’ve talked about symbol versions from the linker’s point of view. I think it’s worth discussing them a bit from the user’s point of view. As I’ve discussed before, symbol versions are an ELF extension designed to solve a specific problem: making it possible to upgrade a shared library without changing existing…