Relocatable program forms: which description best characterizes a relocatable program?

Difficulty: Easy

Correct Answer: consists of a program plus relocation information so it can be placed at various addresses

Explanation:


Introduction / Context:
Object modules frequently need to be placed at different memory addresses at load time. To support this flexibility, a relocatable program includes metadata that enables a loader to adjust address-sensitive fields appropriately.


Given Data / Assumptions:

  • Standard relocatable object format with relocation records.
  • Loader capable of processing relocation entries.
  • No requirement that the program begins at a fixed address.


Concept / Approach:
A relocatable program has symbolic references and marked address fields. The loader, when choosing a load address, applies relocation by adding the chosen base to address-sensitive locations. This differs from absolute programs (fixed addresses) and self-relocating programs (which contain code to relocate themselves at runtime).


Step-by-Step Solution:

Identify relocation information in the object (e.g., relocation entries, symbol tables).Loader selects a base address at load time.Loader patches all marked fields so the program runs correctly at its new location.


Verification / Alternative check:
Relocation maps demonstrate consistent adjustment of code and data references by an offset equal to the load base, confirming relocatability.


Why Other Options Are Wrong:

(a) Describes an absolute (non-relocatable) program.(c) Describes a self-relocating program that performs its own relocation logic.(d) Cannot be true because (a) and (b) are mutually exclusive.


Common Pitfalls:
Assuming “relocatable” means the program moves itself; typically, the loader performs relocation using supplied metadata.


Final Answer:
consists of a program plus relocation information so it can be placed at various addresses.

More Questions from Language Processors

Discussion & Comments

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