Difficulty: Easy
Correct Answer: Linker
Explanation:
Introduction / Context:Modern software is typically split across multiple object files and libraries. Names (symbols) referenced in one module may be defined in another. The component that resolves these cross-module references at build time is the linker, which produces an executable or library with all external references satisfied.
Given Data / Assumptions:
Concept / Approach:The linker reads object modules, matches undefined symbols to definitions, performs relocation, and emits an executable image. In contrast, the loader maps an already-linked image into memory at run time. The compiler translates high-level code to intermediate/object code; the assembler converts assembly to object code. Only the linker resolves external symbols across modules.
Step-by-Step Solution:
1) Compilation/assembly produce relocatable objects with unresolved externals.2) The linker scans these objects and libraries for matching symbol definitions.3) It patches references (relocation) and outputs a single executable or library.4) The loader later places that image into memory to run.Verification / Alternative check:Build logs typically show the linker stage resolving symbols; unresolved external errors appear during linking, not during compiling or loading, confirming the linker’s role.
Why Other Options Are Wrong:
Common Pitfalls:Confusing relocation (linker) with loading, or assuming the compiler “knows” other modules’ addresses during code generation—it does not in modular builds.
Final Answer:Linker
Discussion & Comments