Linking and relocation: Which component provides the linker with the list of external symbols and relocation information used to build an executable?

Difficulty: Easy

Correct Answer: Translator

Explanation:


Introduction / Context:
In the compile–link–load pipeline, each tool has a specific role. Understanding who produces symbol tables and relocation records clarifies how separate compilation works and how the linker resolves references across modules and libraries.


Given Data / Assumptions:

  • Source code is first processed by a translator (compiler/assembler) into object modules.
  • Object modules contain relocation entries and external symbol information.
  • The linker consumes these records to produce a final executable or library.


Concept / Approach:
The translator (compiler for high-level languages, assembler for assembly) emits object code plus metadata: symbol tables, relocation entries, and unresolved external references. The linker uses this information to place code/data at final addresses and to bind externals to definitions. The loader then places the finished image into memory for execution. Macro processors and editors do not produce relocation data.


Step-by-Step Solution:

Translate source to object: the translator outputs .obj/.o files with relocation and symbol info.Linker reads all objects and libraries, resolves externals, and relocates sections.Loader maps the linked image into memory at run time.Confirm that the relocation information originates from the translator’s object output.


Verification / Alternative check:
Object file formats (COFF, ELF, Mach-O) clearly specify relocation and symbol sections produced by translators and consumed by linkers.


Why Other Options Are Wrong:
Macro processor: performs textual substitution before translation. Loader: consumes the linked image, does not provide relocation to the linker. Editor: text editing only.


Common Pitfalls:
Confusing dynamic loader relocations (at run time) with static relocation records generated by the translator for the linker.


Final Answer:
Translator

More Questions from Operating Systems Concepts

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion