Working toolchain

This commit is contained in:
Drew Galbraith 2023-06-14 12:09:23 -07:00
parent bd5cd5a011
commit a9db73e443
4 changed files with 6005 additions and 35 deletions

View File

@ -1,2 +1,7 @@
#! /bin/bash
cmake -B builddbg/ -G Ninja -D CMAKE_CXX_COMPILER=x86_64-elf-gcc -D CMAKE_ASM-ATT_COMPILER=x86_64-elf-gcc -D CMAKE_AR=`which x86_64-elf-ar` -D CMAKE_BUILD_TYPE=Debug
CWD="$(pwd)"
BIN=$CWD/toolchain/local/bin
GCC=$BIN/x86_64-pc-acadia-gcc
AR=$BIN/x86_64-pc-acadia-ar
cmake -B builddbg/ -G Ninja -D CMAKE_CXX_COMPILER=${GCC} -D CMAKE_ASM-ATT_COMPILER=${GCC} -D CMAKE_AR=${AR} -D CMAKE_BUILD_TYPE=Debug

View File

@ -18,11 +18,6 @@ BINUTILS_NAME="binutils-$BINUTILS_VERSION"
BINUTILS_PKG="${BINUTILS_NAME}.tar.xz"
BINUTILS_BASE_URL="https://ftp.gnu.org/gnu/binutils"
NEWLIB_VERSION="4.1.0"
NEWLIB_NAME="newlib-$NEWLIB_VERSION"
NEWLIB_PKG="${NEWLIB_NAME}.tar.gz"
NEWLIB_BASE_URL="ftp://sourceware.org/pub/newlib"
GCC_VERSION="13.1.0"
GCC_NAME="gcc-$GCC_VERSION"
GCC_PKG="${GCC_NAME}.tar.xz"
@ -38,18 +33,14 @@ pushd "$TOOLCHAIN/srcs"
if [ ! -d "$BINUTILS_NAME" ]; then
tar -xJf ${BINUTILS_PKG}
pushd $BINUTILS_NAME
# Set up a baseline to make it easier to create patches in the future.
git init
git add .
git commit -m "base"
patch -p1 <$TOOLCHAIN/patches/binutils/00-first.patch
popd
fi
if [ ! -e $NEWLIB_PKG ]; then
curl -LO $NEWLIB_BASE_URL/$NEWLIB_PKG
fi
if [ ! -d $NEWLIB_NAME ]; then
tar -xzf $NEWLIB_PKG
fi
if [ ! -e "$GCC_PKG" ]; then
curl -LO "$GCC_BASE_URL/$GCC_NAME/$GCC_PKG"
fi
@ -57,7 +48,12 @@ pushd "$TOOLCHAIN/srcs"
if [ ! -d "$GCC_NAME" ]; then
tar -xJf $GCC_PKG
pushd $GCC_NAME
# Set up a baseline to make it easier to create patches in the future.
git init
git add .
git commit -m "base"
patch -p1 <$TOOLCHAIN/patches/gcc/00-first.patch
patch -p1 <$TOOLCHAIN/patches/gcc/01-libstdc++.patch
popd
fi
@ -66,8 +62,7 @@ popd
mkdir -p "$TOOLCHAIN/build"
pushd "$TOOLCHAIN/build"
# rm -rf binutils
if [ ! -d binutils ]; then
rm -rf binutils
mkdir -p binutils
pushd binutils
# skip building documentation
@ -82,20 +77,6 @@ pushd "$TOOLCHAIN/build"
make MAKEINFO=true -j 8
make install MAKEINFO=true -j 8
popd
fi
# rm -rf newlib
if [ ! -d newlib ]; then
mkdir -p newlib
pushd newlib
$TOOLCHAIN/srcs/$NEWLIB_NAME/configure \
--prefix=$SYSROOT/usr \
--target=x86_64-elf \
--with-sysroot=$SYSROOT
make -j 8
make -j 8 install
popd
fi
rm -rf gcc
mkdir -p gcc
@ -104,6 +85,7 @@ pushd "$TOOLCHAIN/build"
--prefix=$PREFIX \
--target=$TARGET \
--with-sysroot=$SYSROOT \
--with-newlib \
--disable-nls \
--enable-languages=c,c++
@ -112,8 +94,6 @@ pushd "$TOOLCHAIN/build"
make -j 8 all-target-libgcc
make -j 8 install-gcc install-target-libgcc
popd
popd

View File

@ -35,10 +35,10 @@ index df90720b7..ae12e48d1 100755
i?86-*-mingw32* | \
x86_64-*-mingw32* | \
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6fd159448..f8b4f29bc 100644
index 6fd159448..e2fb4b52c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -690,6 +690,11 @@ x86_cpus="generic intel"
@@ -690,6 +690,12 @@ x86_cpus="generic intel"
# Common parts for widely ported systems.
case ${target} in
@ -46,11 +46,12 @@ index 6fd159448..f8b4f29bc 100644
+ gas=yes
+ gnu_ld=yes
+ default_use_cxa_atexit=yes
+ use_gcc_stdint=provide
+ ;;
*-*-darwin*)
tmake_file="t-darwin "
tm_file="${tm_file} darwin.h"
@@ -1126,6 +1131,9 @@ case ${target} in
@@ -1126,6 +1132,9 @@ case ${target} in
esac
case ${target} in

File diff suppressed because it is too large Load Diff