vlink

A portable linker for multiple file formats.
Valid HTML 4.01!
About vlink
Last release source
Daily source snapshot
Tagged source archives
Compilation notes
Last release binaries
Daily snapshot binaries
vlink docs (pdf)
Volker's vlink page
vbcc/Amiga home page

vlink is a portable linker, written in ANSI-C, that can read and write a wide range of object- and executable file formats. It can be used to link a specific target format from several different input file formats, or for converting, stripping and manipulating files.

The linker can be controlled by GNU-style linker scripts to generate absolute code, but it also runs very well with default rules to create relocatable executables, as required for AmigaOS or MorphOS.

Of course there might be technical restrictions that object files of different architectures cannot be merged because of incompatible relocation types, differing endianess or symbol-names with and without leading underscores. But in theory everything is possible!

Currently the following object and executable file formats are supported by vlink:
  • ELF 32bit PowerPC big endian
  • ELF 32bit PowerPC AmigaOS (special dynamic linking rules)
  • ELF 32bit PowerPC MorphOS (relocatable executables)
  • ELF 32bit PowerPC PowerUp (relocatable executables)
  • ELF 32bit M68k big endian
  • ELF 32bit Jaguar RISC big endian
  • ELF 32bit x86 little endian
  • ELF 32bit x86 AROS (relocatable executables)
  • ELF 32bit ARM little endian
  • ELF 64bit x86_64 little endian
  • a.out Sun/010 (also Amiga/Atari 68000)
  • a.out Sun/020 (also Amiga/Atari 68020+)
  • a.out MiNT (embedded in Atari TOS format)
  • a.out Jaguar (M68k with support for RISC relocations)
  • a.out NetBSD/68k (4k and 8k pages)
  • a.out NetBSD/386
  • a.out PC/386
  • a.out generic
  • AmigaOS hunk format
  • EHF, extended hunk format (WarpOS)
  • Atari TOS format (writing only)
  • OS-9/6809 modules (writing only)
  • o65 binary relocation format V1.3 (6502 and 65816)
  • Motorola S-Records (writing only)
  • Intel-hex format (writing only)
  • AMSDOS format (Amstrad/Schneider CPC)
  • Commodore 8-bit PRG format (PET, VIC-20, 64, etc.)
  • Apple DOS 3.3 binary format (Apple II)
  • Atari 8-bit COM format (400, 600, 800, etc.)
  • BBC Micro/Master (.inf for emulator)
  • Dragon DOS binary files (Dragon 32 and 64)
  • Oric machine code file format (Oric-1, Atmos, Telestrat, Pravetz)
  • Sinclair QL binary format with QDOS header or XTcc trailer
  • Tandy Color Computer machine language files (CoCo 1, 2 and 3)
  • Raw binaries (writing only)
  • VOBJ, proprietary versatile object format (reading only)


28-Apr-2021: vlink 0.16h.
  • Prepared the code to work with architectures which don't use 8-bit bytes. Currently it should work with multiples of 8 bits.
  • New target file formats "o65-02" and "o65-816" can read and write object files and executables in the o65 format by Andre Fachat.
  • New target file format "oricmc" writes a machine code file header for Oric computers. Supports optional auto-exec (-autox).
  • New target file format "sinclairql" writes binary files for Sinclair QL emulators using either a QDOS header or a XTcc trailer and an optional reloc table.
  • New option -nowarn=n to not display a specific warning message.
  • Now the linker searches in all paths defined by -L first, before finally looking into the local directly.
  • -Ttext <addr> may define the start address of absolute code even without a linker script.
  • Some options are really target-specific now, and not available when a different target is selected.
  • Fixed a rare bug when merging sections with the same type and linking without a linker script.
  • Undefined symbols declared on the command line (-u) or in the linker script (EXTERN) allocated 4 bytes at the end of the first section. Fixed.
  • (vobj) Section attributes 'c' and 'x' both select type=code and set the executable flag. Otherwise "rx" would be classified as data.
  • (rawseg) Fixed relocations to linker-script symbols in unallocated sections.


31-Dec-2020: vlink 0.16g.
  • New target file format bbc to generate .inf files for BBC Micro/Master.
  • Fixed symbol assignments refering to other symbols in linker scripts.
  • Optional symbol assignments can be done with =?. Such an assignment will be silently ignored when the symbol already exists.
  • New option -D to define linker symbols on the command line.
  • ASCII output (S-Rec, ihex, etc.) is now done using the host systems line endings.
  • When calculated relocation addends in raw binary formats are out of bounds, also print the name and section-offset of the input file.
  • (os9) -os9-mem now specifies the memory to allocate in bytes instead of pages.
  • (os9) Fixed header parity and CRC calculation.
  • (os9) Fixed write error when vlink was not compiled by gcc.
  • (rawbin) -q can be used with rawbin1 to append a relocation table.
  • (rawseg) -q (emit relocations) is now supported for any target address size.


28-Sep-2020: vlink 0.16f.
  • New target file format os9-6809 to generate OS-9 modules for 6809 systems.
  • OS9-specific options: -os9-mem, -os9-name, -os9-ns, -os9-rev.
  • New binary target file formats applebin (Apple DOS 3.3), ataricom (Atari 8-bit), cocoml (Tandy Color Computer) and dragonbin (Dragon DOS).
  • New option -m enables special treatment of a feature-mask suffix in symbol names (global definitions and external references).
  • New option -Crel emits constructor/destructor function references which are relative to their table position.
  • Added cbmreu target for C64 REU memory expansion.
  • New linker script functions ORIGIN() and LENGTH() for memory regions.
  • Included description of linker scripts in the documentation.
  • Fixed bug with AT(lma) attribute in linker script section definitions.
  • (elf) Fixed reference to defined weak-symbols again.
  • (ados/ehf) External small-data references may have a signed addend now, while small-data relocs still use an unsigned section-offset.


07-Jul-2020: vlink 0.16e.
  • Changing the address within an output section in a linker script didn't work correctly when the destination memory region (load-address) differs from the relocation memory region (execution-address).
  • Data commands in linker scripts didn't work when there was nothing else in the output section.
  • Fixed a segfault when a linker script moves the address counter backwards inside an output section.
  • Fixed uninitialized pointer when loading input files via a linker-script INPUT command.
  • New linker-script command: RESERVE(n) to reserve n bytes of memory and fill it with the current FILL value.
  • FILL-pattern should always be written in big-endian.
  • Replaced FILL command by FILL8 and FILL16.
  • New option -mall to merge everything into a single output section.
  • Weak symbols must only be resolved in executables.
  • (rawbin) Motorola S-Records: Fixed start address in S8 and S9 trailer.
  • (vobj) Fixed reference to a defined weak symbol in an object.
  • (elf) Fixed reference to a defined weak symbol in an object.


18-Apr-2020: vlink 0.16d.
  • New option -N for renaming input sections.
  • New option -vicelabels to generate a label-address mapping for the debugger from the VICE emulator.
  • -M option for generating map files accepts an optional output file name.
  • Map files prints all symbols per section sorted by value. The values are printed on the first column now, using the target address size for formatting.
  • Multiple lines for the same section in a linker script are not allowed.
  • Try to avoid "segment is closed" errors in linker scripts which define and use memory regions, and no PHDR definitions.
  • Fixed output of trailing zero-bytes in all hex-formats, like S-Records, IHex, SHex1.
  • (ados/ehf) Always generate short-reloc hunks, when requested by -Rshort. Relocs with offsets > 0xffff will be written in a separate hunk.
  • (ados/ehf) HUNK_LIB parsing sometimes failed. Fixed.
  • (rawbin) Target cbmprg no longer automatically splits the output file, when there are larger gaps between output sections.
  • (rawbin) Trailing S-record (S7, S8, S9) contains the entry address.


10-Jun-2019: vlink 0.16c.
  • New target file format XFile, for Sharp X68000 computers. At the moment only executables may be created. No object file support.
  • (ados/ehf) Handle data-bss sections correctly, when linking/stripping executable files.

$Id: index.php,v 1.15 2021/01/17 11:18:48 frank Exp $