Table of Contents

Relocatable linking (ivss)

Relocatable linking combines object contributions without assigning final runtime section addresses or requiring every reference to be resolved. ivss exposes this mode with -relocatable:

$ ./linker \
    -relocatable \
    -o combined.dump \
    main.o data.o

The linker merges sections, symbols, and relocation records, then sets section addresses to zero. Undefined-symbol reporting for a final link is skipped, allowing the combined representation to retain references for later resolution.

The current command interface makes -relocatable and -hex mutually exclusive. Consequently, this command writes a human-readable dump, not the hex serialization read by another linker invocation. Renaming combined.dump to .o does not turn it into valid input.

This distinction limits the current workflow: the internal combined representation remains relocatable, but the command does not provide an ordinary serialized partial-link artifact for chaining subsequent links. Use the dump to inspect merging, and pass the original serialized objects to a final -hex link when producing an emulator input.

Source: linker.c.