Cross binutils vasm/vlink

From Freepascal Amiga wiki
Revision as of 19:18, 16 May 2020 by Migario (talk | contribs) (→‎Usage: typo's)
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

  1. copy and rename the assembler to /usr/bin with prefix powerpc-morphos (e.g. cp gas/as-new /usr/bin/powerpc-morphos-as)
  2. copy and rename the linker to /usr/bin with prefix powerpc-morphos (e.g. cp ld/ld-new /usr/bin/powerpc-morphos-ld)

editors note: add the missing platforms and use/correct the right naming scheme.

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: You can not mix vasm/vlink compiled units with those generated by gnu ld/as

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