ld86(1)
β¨ NAME β¨
ld86 β the linker bestie for as86(1) π
πΈ SYNOPSIS πΈ
ld86 [-03MNdimrstyz[-]] [-llib_extension] [-o outfile] [-Ccrtfile]
[-Llibdir] [-Olibfile] [-Ttextaddr] [-Hheapsize] [-Ddataaddr] infile...
π DESCRIPTION π
okay so bestie, listen. ld86 is a linker with very specific taste β it only understands the object files that the as86 assembler makes, and nothing else. no cap. feed it anything else and it's just gonna sit there like π§
and then it links them into either an impure executable or a separate I&D executable. that's the whole personality.
the linking defaults are, and I quote, everything off or none β except for -0, which is on by default. so it's giving minimal effort main character energy β¨ and the output file is a.out.
heads up bestie: there is not a standard library location defined in the linker. like, at all. you gotta tell it where stuff lives. it will not guess. π
π OPTIONS π
one bullet per option, as the universe intended. every single one is here, no skipping, periodt.
-0β produce header with 16-bit magic β-3β produce header with 32-bit magic β-7β produce Seventh Edition UNIXa.outheader.-dβ delete the header from the output file, used for MSDOS COM files. As a side effect this also includes-sas there's nowhere to put a symbol table. (no room bestie, the header took the whole closet π)-Cxβ add filelibdir-from-search/crtx.oto list of files linked-Dβ data base address follows (in format suitable forstrtoul)-Hβ the top of heap (initial stack) address (in format suitable forstrtoul)-Lxβ add dir name x to the head of the list of library dirs searched-Mβ print symbols linked on stdout-Nβ Create a native Linux OMAGIC output file. If the contents are i386 code the binary can be either linked by GCC or executed by linux. If the-zoption is also included the linker can generate a QMAGIC executable. π₯-Oxβ add library or object filelibdir-from-search/xto list of files linked-Tβ text base address follows (in format suitable forstrtoul)-iβ separate I&D output-lxβ add librarylibdir-from-search/libx.ato list of files linked-mβ print modules linked on stdout-oβ output file name follows-sβ strip symbols-rβ Generate a relocatable object from one source object, if the linker is given the-Noption also the output format will be the hosts native format if possible.-tβ trace modules being looked at on stdout-yβ Alter the symbol tables to add label 'extensions' so that labels with more than 8 characters can be stored in elks executables. (long names? in this economy? we make it work π )-zβ produce "unmapped zero page" or "QMAGIC" executables
iykyk moment: All the options not taking an argument may be turned off by following the option letter by a-, as forcc1. so like-N-? vibe check passed, that's how you turn it off. β¨
π¦ PREDEFINED LABELS π¦
the linker predefines several labels that can be imported into user programs. free real estate, bestie π«Ά
__etext
Standard C variable for the end of the text segment.
__edata
Standard C variable for the end of the initilised data.
__end
Standard C variable for the end of the bss area.
__segoff
The offset within the executable file between the start of the text segment and the start of the data segment in 16 byte 'paragraphs'. Note this is zero for impure (tiny model) executables and is adjusted for executables that don't start at offset 0 within the segment.
__segXDL
The lowest address with data in segment 'X'. (eg __seg0DL is for segment zero or the text segment, __seg3DL is for the data segment) The value 'X' is a hex digit.
__segXDH
The top of segment 'X's data area.
__segXCL
The bottom of segment 'X's 'common data' or unitilised data area. Each segment has both an initilised and unitilised data area.
__segXCH
The top of segment 'X's common area.
__segXSO
This is the adjusted offset from segment 0 of the start of segment 'X' in 'paragraphs'.
π HISTORY π
- The 6809 version does not support
-i. (she simply does not do that π«) - The previous versions of the linker could produce an 8086 executable with segments of a size >64k, now only i386 executables may have segments this large.
π BUGS π
okay so the tea β
- The linker cannot deal with reverse seeks caused by
orginstructions in the object file. Unlike previous versions the current one traps the error rather than trying to fill up the hard disk. (thank u for not eating my entire drive, queen π) - The linker produces a broken
a.outobject file if given one input and the-roption this is so it is compatible with pre-dev86 versions.
fr fr: that second one is a broken output file, on purpose, for compatibility. it's not a bug that got fixed, it's a bug that stayed. iconic behaviour honestly.
and that's the whole page bestie!! this lil beauty is from the General Commands Manual, dated Apr, 1997, and it's still out here linking like it's nobody's business. ld86(1) β she's old, she's picky, she only speaks as86 object files, and we love her for it. slay πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- alpine 3.22: dev86-doc 0.16.21-r3 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.23: dev86-doc 0.16.21-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.24: dev86-doc 0.16.21-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- fedora 43: dev86 0.16.21-31.fc43 Β· GPL-1.0-or-later AND GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+
- fedora 44: dev86 0.16.21-33.fc44 Β· GPL-1.0-or-later AND GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms