A portable linker for multiple file formats.
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/DRI format
  • 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)

22-Sep-2022: vlink 0.17a.
  • Fixed segfault following a syntax error in the linker script.
  • Allow '-' in the linker script for section names.
  • Fixed support for masked symbols (-m option).
  • No more "out of memory" when trying to read (Linux) directories.
  • -baseoff option was broken in the last release. Fixed.
  • Make sure symbol definitions from already linked object units have priority.
  • Reworked some error messages. Print signed values and mask output according to target address size.
  • New option -wfail makes vlink return with an error code not only for errors but also for warnings.
  • (ados/ehf) Enabled masked symbol support.
  • (ados/ehf) Sections from executables get a unique name made out of their type and memory flags.
  • (elf) NOLOAD sections should not be part of any load-segment.
  • (elf) Enabled support for R_NONE relocations.
  • (vobj) Enabled support for R_NONE relocations.

26-Feb-2022: vlink 0.17.
  • Fixed bug when linking different object file formats.
  • Fixed malformatted output of some error codes for 32-bit hosts.
  • The string "DONTMERGE_" within a section name is replaced by a unique id to optionally prevent merging with any other section.
  • Report global symbol name conflicts from linked library objects, except when their definition sections belong to different architectures (needed for linking mixed binaries, like WarpOS 68k/PPC).
  • Fixed random values from illegal arguments for various "-opt <n>" style options.
  • Target format option (-b) is now parsed before any other option, so target-specific options may appear in front of it again.
  • (rawbin) Fixed output of leading empty sections, which don't have the NOLOAD flag.
  • (rawbin) Fixed file size in AMSDOS header at offset 64.
  • (a.out) aoutnull must default to 32 bit addresses.
  • (a.out) Make baserel (small-data) relocations compatible to GNU-binutils.
  • (ados/ehf) Fixed recognition of EHF objects and libraries.
  • (ados/ehf) Ignore free-floating debug hunks (SAS/C debug?).
  • (ados/ehf) New option -broken-debug.
  • (ados/ehf) Fastcall-ABI constructors/destructors (symbol names starting with '@' instead of '_') replace standard ones, when priority and name is otherwise identical.
  • (ados/ehf) Fixed EHF symbol redefinition bug since V0.16f.
  • (tos) Make sure data section size is even. No longer try to add the uninitialized data part to bss.

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 referring 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.

$Id: index.php,v 1.16 2023/09/30 11:57:36 frank Exp $