Linker (hclink)

Multi-format linker producing flat binaries (COM), MZ executables (EXE), and REX relocatable format. Supports automatic object reordering and dead code elimination.

BinaryFormatUse Case
hclink-binFlat binaryCP/M .COM, ROM images, raw memory
hclink-mzMZ EXEMS-DOS .EXE with independent segments
hclink-rexREX relocatableRelocatable executables with relocation table

Flat Binary

hclink-bin -text 0x100 -o program.com start.obj main.obj lib.lib
hclink-bin -o firmware.bin code.obj data.obj
hclink-bin -text 0x4000 -bss 0xC000 -o game.rom game.obj

MZ EXE (MS-DOS)

hclink-mz -stack 1024 -o program.exe start.obj main.obj lib.lib

Segment deltas automatically computed:

ConstantValue
__data_seg_delta__Paragraphs from TEXT to DATA
__bss_seg_delta__Paragraphs from TEXT to BSS
__stack_top__Top of stack (BSS + stack size)

REX Relocatable

hclink-rex -o program.rex main.obj lib.obj
hclink-rex -sym symbols.txt -o program.rex main.obj

Produces an REX-format relocatable executable with a 18-byte header, sections, and a word-based relocation table. Ideal for custom operating systems and embedded environments where the loader needs to place code at arbitrary addresses.

Options

OptionDescriptionApplies to
-o <file>Output file (default: a.bin)All
-sym <file>Symbol table outputAll
-multicpuIgnore mismatched CPU types in objectsAll
-vVerbose outputAll
-text <offset>Text section start addressBIN
-data <offset>Data section start address (default: after text)BIN
-bss <offset>BSS section start address (default: after data)BIN
-align <size>Section alignment in bytes (default: 16)BIN, REX
-stack <size>Stack size in bytes (BIN default: 1024, MZ default: 4096)BIN, MZ, REX
-max-mem <size>Max memory available (default: 61440)BIN, REX

Features