Meta-repository providing a build of binutils for SuperH.
Go to file
Lephenixnoir d086715b32
slight improvements to README
2022-08-19 15:07:23 +02:00
.gitignore new build system for fxSDK sysroot 2022-08-19 15:03:06 +02:00
README.md slight improvements to README 2022-08-19 15:07:23 +02:00
build.sh new build system for fxSDK sysroot 2022-08-19 15:03:06 +02:00
configure.sh new build system for fxSDK sysroot 2022-08-19 15:03:06 +02:00
giteapc-config-any.make add an `any` configuration that uses existing binutils installs 2021-01-14 18:33:28 +01:00
giteapc-config-clean.make new build system for fxSDK sysroot 2022-08-19 15:03:06 +02:00
giteapc.make new build system for fxSDK sysroot 2022-08-19 15:03:06 +02:00
install.sh new build system for fxSDK sysroot 2022-08-19 15:03:06 +02:00
uninstall.sh new build system for fxSDK sysroot 2022-08-19 15:03:06 +02:00
util.sh new build system for fxSDK sysroot 2022-08-19 15:03:06 +02:00

README.md

SuperH toolchain: sh-elf-binutils

This repository provides a guide and automated scripts to install an SH3/SH4-compatible binutils suite. binutils is a collection of tools to assemble, edit and link binary programs, mainly object files. It is the main dependency for GCC, which compiles C down to assembler and relies on binutils to assemble and link this assembler output.

The following three methods all install binutils with different degrees of automation.

Method 1: Using GiteaPC

The most common way to install binutils (for the fxSDK) is by using GiteaPC:

% giteapc install Lephenixnoir/sh-elf-binutils

This will take care of all the steps and install binutils in the fxSDK's SuperH system root.

A :any configuration is provided in case you already have another version of binutils installed in the fxSDK sysroot and want to keep using it (ie. skip a version upgrade). This will mark this repository as installed, so other repositories depending on it can build, without actually compiling binutils. Having binutils installed outside the fxSDK sysroot is not sufficient for some libraries.

% giteapc install Lephenixnoir/sh-elf-binutils:any

A :clean configuration is also provided if you want to clean up the source and build files automatically after installing. This frees up some disk space.

% giteapc install Lephenixnoir/sh-elf-binutils:clean

Method 2: Manually running the scripts

You can also install binutils by directly running this repository's scripts. In terms of dependencies, you will need:

You can run fxsdk path sysroot to show the SuperH sysroot where binutils will be installed. You will need to specify a PATH-reachable PREFIX where the binaries of the toolchain will be symlinked. (The PREFIX is only for symlinks to executables, the toolchain will always be installed in the fxSDK's sysroot.) Once you're ready, run the main scripts with make:

% make -f giteapc.make configure build install PREFIX="$HOME/.local"

Method 3: Fully manually

Get your version of choice from ftp.gnu.org and extract the archive. Touch binutils-$VERSION/intl/plural.c to avoid autotools rebuilding it with bison, which no longer works ([1],[2]).

If you want to use the fxSDK, you must install in the SDK's SuperH sysroot and set the PREFIX to $(fxsdk path sysroot). Otherwise, anything that properly isolates the cross-compiler from the host is fine.

Create and move into a build folder, then configure:

% ../binutils-$VERSION/configure          \
    --prefix="$PREFIX"                    \
    --target="sh3eb-elf"                  \
    --with-multilib-list="m3,m4-nofpu"    \
    --program-prefix="sh-elf-"            \
    --enable-libssp                       \
    --enable-lto

Finally, build and install:

% make -j$(nproc)
% make install-strip

You should add the SuperH sysroot's bin to your PATH, or symlink them somewhere else in the PATH. You can then remove the build folder, source folder, and source archive if you need to free up disk space.