PIE Relocation: Tagging Addresses

In a Position-Independent Executable (PIE), absolute addresses aren't "tagged" directly within the machine code. Instead, the linker creates a separate list of instructions and data locations that need fixing, and this list is stored in a special section of the binary called the relocation table. The dynamic loader uses this table at runtime to patch the code with the correct memory addresses once the binary's actual location in memory is known. The Core Mechanism: Linker and Loader Teamwork šŸ¤ Think of it like moving into a new apartment building. You…

Understanding Binary File Components

Symbol Table Think of the symbol table as a directory for the "named things" within your code, like functions and global variables. When you compile a source file, the compiler creates an object file. This object file contains the machine code for your functions and space for your global variables, but it doesn't yet know the final memory addresses of everything. The symbol table maps these symbolic names (e.g., my_function, global_variable) to their locations within the object file. This is vital for the linker, the tool that combines multiple object files and libraries…

Control Dependence Graph and Data Dependence Graph

A Control Dependence Graph (CDG) and a Data Dependence Graph (DDG) are essential tools in computer science, particularly in compiler design and program analysis. They represent the dependencies between different parts of a program's code, but they focus on two distinct types of relationships. Control Dependence Graph (CDG) A Control Dependence Graph illustrates how the execution of a statement is controlled by a conditional branching statement. In simpler terms, a statement is control-dependent on a conditional if the outcome of that conditional determines whether the statement will be executed. NodesĀ in a CDG represent the…