Search results for: “linker”

  • Linkers part 3

    Continuing notes on linkers. Address Spaces An address space is simply a view of memory, in which each byte has an address. The linker deals with three distinct types of address space. Every input object file is a small address space: the contents have addresses, and the symbols and relocations refer to the contents by…

  • Linkers part 2

    I’m back, and I’m still doing the linker technical introduction. Shared libraries were invented as an optimization for virtual memory systems running many processes simultaneously. People noticed that there is a set of basic functions which appear in almost every program. Before shared libraries, in a system which runs multiple processes simultaneously, that meant that…

  • Linkers part 1

    I’ve been working on and off on a new linker. To my surprise, I’ve discovered in talking about this that some people, even some computer programmers, are unfamiliar with the details of the linking process. I’ve decided to write some notes about linkers, with the goal of producing an essay similar to my existing one…

  • Piece of PIE

    Modern ELF systems can randomize the address at which shared libraries are loaded. This is generally referred to as Address Space Layout Randomization, or ASLR. Shared libraries are always position independent, which means that they can be loaded at any address. Randomizing the load address makes it slightly harder for attackers of a running program…

  • Executable stack

    The gcc compiler implements an extension to C: nested functions. A trivial example: int f() { int i = 2; int g(int j) { return i + j; } return g(3); } The function f will return 5. Note in particular that the nested function g refers to the variable i defined in the enclosing…