Manual / ld
ld(1)
| LD(1) | General Commands Manual | LD(1) |
NAME
ld - link Merlin REL objects
SYNOPSIS
ld [-a address] [-z] [-t
type] -o output [-L directory]
[module | -l library | -s address ...]
ld @file
DESCRIPTION
Link Merlin REL modules, resolving their exported definitions and external references, and write a flat output file. Module code lengths are taken from each object's ProDOS auxiliary type; preserve the file metadata when transporting objects.
- -a address
- Set the link origin in hexadecimal, default 0800.
- -o output
- Name the output file (required).
- -t type
- Set the output ProDOS type byte in hexadecimal, default 06 (BIN). The link origin becomes its auxiliary type.
- -z
- Omit trailing zero bytes from the output. Use only when the program establishes any required working storage itself.
- -L directory
- Add a search directory, before /mnt/MAUX/LIB. Used for -l library resolution (unchanged: searched before /usr/lib), and also to resolve an explicit module operand that contains no slash: such a module is tried in each -L directory, in the order given on the command line, before falling back to the name exactly as given (relative to the current prefix; unlike -l, -L does not fall back to /usr/lib for a bare module operand). A module operand containing a slash is never searched; it is opened exactly as given, by construction, so existing absolute- or relative-path invocations are unaffected by adding -L. The attached spelling -L/path (one token, no space) is accepted, the same idiom as -s. It exists because a command line with several modules and one or more -L directories can exceed the shell's 32-token argument limit before it exceeds the 254-character line limit; the attached form removes one token per -L without shortening anything.
- -l library
- Search for directory LIBlibrary, selecting REL members needed to satisfy unresolved names. Each library is rescanned until it adds no members. Selected members occupy the flag's position among modules, in directory order. Library order matters.
- -s address
- Link following modules at a separate run address while the output file offset continues. -s 0 ends the run; up to two nonzero runs are allowed (sh links a segment at E000 and one at D000). The attached spelling -sE000 is accepted.
- @file
- Read the arguments from file: its words, separated by blanks and line ends (either ASCII convention), replace the command line, and every option above works in it. @file must be the only operand. A shell command line is limited to 31 arguments, which make(1) and sh(1) share; the native build links sh, vi, more, ex, nulib2 and diff through an argument file (up to 99 words and 1022 bytes). An unreadable or oversized file is refused with a diagnostic and status 1.
Options normally take separate operands. Addresses have hexadecimal digits without $ or 0x prefixes. A library is a ProDOS directory, not a Unix ar archive.
FILES
/usr/man/LD this page
SEE ALSO
DIAGNOSTICS
Exit status is 0 on success, 1 for link/I/O failures, 2 for usage errors.
BUGS
Limits include 96 total modules, four -L directories, four -l requests, a 3584-byte dictionary tail per object and a 16384-byte symbol-name pool. A pass-two failure attempts to remove partial output; do not use a pre-existing output as proof of a successful link. Supplied on native toolchain images.
| September 19, 2026 | maux |