Linking and Loading In a relocating/absolute loading context, which tool generates the relocation (relocation/reallocation) bits used later by the loader?

Difficulty: Easy

Correct Answer: Assembler or translator

Explanation:

Introduction / Context:During program preparation, tools produce metadata that enables code to be placed at varying memory locations. Relocation information (often called relocation bits/records) identifies addresses that must be adjusted when the program is loaded at a different base address.

Given Data / Assumptions:

  • Assembler and compilers translate source into object modules with relocation records.
  • Loaders and linkers consume these records to adjust addresses.
  • In absolute schemes, the assembler may produce absolute addresses; in relocating schemes, it emits relocation info.

Concept / Approach:Separate producers of relocation info from consumers. Assemblers/translators know which references are relocatable and mark them. Linkers/loaders read these marks to fix up addresses at link or load time.

Step-by-Step Solution:Source → assemble/compile → object file with relocation entries.Linker optionally resolves external symbols and performs partial relocation.Loader applies remaining relocation at load address.

Verification / Alternative check:Inspect an object file (e.g., with objdump) to view relocation sections created at assembly/compile time; observe how the loader/linker uses them later.

Why Other Options Are Wrong:Relocating loader (Option A) consumes relocation bits; it does not generate them.Linker (Option B) may create new relocation records when combining modules, but the original markings originate in the assembler/translator.Macro processor (Option D) simply expands macros before translation; it does not create relocation info.

Common Pitfalls:

  • Confusing who generates versus who applies relocation.
  • Assuming absolute loaders never need relocation metadata—hybrid scenarios exist.

Final Answer:Assembler or translator.

More Questions from Operating Systems Concepts

Discussion & Comments

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