NOT TESTED YET

This commit is contained in:
Ada Orbit 2026-04-01 17:57:00 +02:00
parent fb9a47244e
commit 32265a5e25
3 changed files with 128 additions and 78 deletions

49
build-gcc.sh Normal file → Executable file
View file

@ -1,7 +1,14 @@
#!/usr/bin/env bash
set -e
# Step 1. Download GCC and binutils source code
ADACASIO_BINUTILS_URL="https://ftp.gnu.org/gnu/binutils/binutils-2.46.0.tar.gz"
ADACASIO_GCC_URL="https://ftp.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.gz"
ADACASIO_BINUTILS_VERSION="2.46.0"
ADACASIO_GCC_VERSION="15.2.0"
ADACASIO_BINUTILS_URL="https://ftp.gnu.org/gnu/binutils/binutils-$ADACASIO_BINUTILS_VERSION.tar.gz"
ADACASIO_GCC_URL="https://ftp.gnu.org/gnu/gcc/gcc-15.2.0/gcc-$ADACASIO_GCC_VERSION.tar.gz"
ADACASIO_PREFIX="$(pwd)/sysroot"
ADACASIO_TARGET="sh-elf"
# prepare configure and build enviornment
wget -O binutils.tar.gz $ADACASIO_BINUTILS_URL
@ -9,29 +16,43 @@ wget -O gcc.tar.gz $ADACASIO_GCC_URL
tar -xf binutils.tar.gz
tar -xf gcc.tar.gz
# Step 2. configure GCC and binutils
# Got the command list from https://git.planet-casio.com/Lephenixnoir/sh-elf-binutils Method 3
# Step 2. configure and build GCC and binutils
mkdir build-binutils build-gcc $ADACASIO_PREFIX
cd build-binutils
../binutils-*/configure \
--prefix="$PREFIX" \
--prefix="$ADACASIO_PREFIX" \
--target="sh3eb-elf" \
--with-multilib-list="m3,m4-nofpu" \
--program-prefix="sh3eb-elf-" \
--host="native" \
--disable-nls \
--disable-multilib \
--disable-shared \
--with-sysroot
--program-prefix="$ADACASIO_TARGET-" \
--enable-libssp \
--enable-lto
make -j$(nproc)
make install-strip
cd ../build-gcc
../gcc/configure \
--enable-languages="ada,c" \
# Build GCC the same way as Lephenixnoir does but also add ada
# https://git.planet-casio.com/Lephenixnoir/sh-elf-gcc
cd ../build-gcc/
../gcc-$VERSION/configure \
--prefix="$SYSROOT" \
--target="sh3eb-elf" \
--with-multilib-list="m3,m4-nofpu" \
--enable-languages="c,c++,ada" \
--disable-libada \
--without-headers \
--program-prefix="sh-elf-" \
--enable-libssp \
--enable-lto \
--enable-clocale="generic" \
--enable-libstdcxx-allocator \
--disable-threads \
--disable-libstdcxx-verbose \
--enable-cxx-flags="-fno-exceptions
--enable-cxx-flags="-fno-exceptions"
make -j$(nproc) all-gcc all-target-libgcc
make install-strip-gcc install-strip-target-libgcc
# TODO:
# install openlibm and fxlibc for C++ support later on