01 – C++ Name Mangling – Investigating Overloaded Functions

This video explains the concept of name mangling in C++, detailing how it enables function overloading and supports linking. It also explores the role of object files, symbol tables, and relocations in the compilation and linking process.

Keypoints :

  • Name mangling in C++ encodes function names with additional information about return types and arguments to support features like function overloading.
  • The mangled names are present in object files and help the linker resolve function calls to the correct implementations.
  • Tools like dumpbin, IDA Pro, and demangling utilities can be used to interpret mangled names and recover human-readable function signatures.
  • Object files contain symbol tables and relocation entries that assist the linker in assigning final addresses to functions and resolving references across multiple files.
  • Relocations specify offsets within sections that need to be updated during linking to point to the correct addresses.
  • The process involves calculating relative addresses using displacements and symbol table information, which the linker updates in the final executable.
  • In the resulting executable, name mangling is typically not visible, but it plays a crucial role in the compilation and linking stages across object files.