Cross binutils vasm/vlink

From Freepascal Amiga wiki
Revision as of 20:58, 16 May 2020 by Migario (talk | contribs) (→‎Installation: apparantly vasm/vlnk does not support aros i386)
Jump to navigation Jump to search

How to create binutils (vasm, vlink) needed for FreePascal crosscompiling on a linux system.

These instructions apply for the targets Amiga (m68k), AmigaOS (ppc), MorphOS (ppc) and AROS (i386)

Requirements

  • working linux with gcc (e.g. ubuntu: sudo apt install build-essentials)
  • latest sources of vasm/vlink

Instructions

  1. create a working dir (e.g. mkdir build)
  2. enter the directory (e.g. cd build)
  3. create a directory that will store the results (e.g. mkdir release)
  4. Vasm assembler: Retrieve sources, create and build
    • retrieve the latest sources for vasm
    wget -N "http://sun.hasenbraten.de/vasm/release/vasm.tar.gz"
    • extract the sources for vasm
    tar -xvzf "vasm.tar.gz"
    • enter the vasm sources directory
    cd vasm
    • create vasm
    for powerpc: make -f Makefile CPU=ppc SYNTAX=std
    for m68k make -f Makefile CPU=68k SYNTAX=std
    for x86 make -f Makefile CPU=x86 SYNTAX=std
    • copy vasm executables to the release folder.
    for powerpc: cp "vasmppc_std" "../release"
    for m68k:cp "vasmm68k_std" "../release"
    for x86:cp "vasmx86_std" "../release"
    • enter your work directory again
    cd ..
  5. Vlink linker: Retrieve sources, create and build
    • retrieve the latest sources for vasm
    wget -N "http://sun.hasenbraten.de/vasm/release/vlink.tar.gz"
    • extract the sources for vasm
    tar -xvzf "vlink.tar.gz"
    • enter the vlink sources directory
    cd vlink
    • create vlink
    make -f Makefile
    • copy vlink executable to the release folder.
    cp "vlink" "../release"
    • enter your work directory again
    cd ..

The compiled tools do now reside in the work/release directory. Note that the vlink linker is only generated once because it supports all targets as mentioned.

Installation

install vasm assembler and vlink linker in your system

  • copy and rename the assembler to /usr/bin with required target prefix:
    for Amiga: m68k-amiga (e.g. cp work/release/vasmppc_std /usr/bin/m68k-amiga-vasmppc_std)
    for AmigaOS4: powerpc-amigaos (e.g. cp work/release/vasmppc_std /usr/bin/powerpc-amigaos-vasmppc_std)
    for Aros: i386-aros (e.g. cp work/release/vasmppc_std /usr/bin/i386-aros-vasmppc_std)
    for MorphOS: powerpc-morphos (e.g. cp work/release/vasmppc_std /usr/bin/powerpc-morphos-vasmppc_std)
  • copy and rename the linker to /usr/bin with required target prefix:
    for Amiga: m68k-amiga (e.g. cp work/release/vlink /usr/bin/m68k-amiga-vlink)
    for AmigaOS4: powerpc-amigaos (e.g. cp work/release/vlink /usr/bin/powerpc-amigaos-vlink)
    for Aros: i386-aros (e.g. cp work/release/vlink /usr/bin/i386-aros-vlink)
    for MorphOS: powerpc-morphos (e.g. cp work/release/vlink /usr/bin/powerpc-morphos-vlink)

Note that it is probably better/easier to use links for the specific targets and point that to the one single executable (that fits that target).

Usage

The vasm/vlink combination with Free Pascal can now be used by providing the additional command-line options -XV and -Avasm to the fpc commandline compiler.

NOTE/WARNING: It is not possible to mix vasm/vlink compiled units/objects with those generated by gnu binutils ld/as

In order to create the fpc cross-compiler use the additional make options: CROSSOPT="-XV -Avasm"