Build GCC/Binutils toolchain in tree. #1

Merged
drew merged 5 commits from toolchain into main 2023-06-15 15:39:15 -07:00
3 changed files with 171 additions and 0 deletions
Showing only changes of commit d0a4a06c7b - Show all commits

51
scripts/build_toolchain.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo $DIR
ARCH="x86_64"
TARGET="$ARCH-pc-acadia"
TOOLCHAIN="$DIR/../toolchain"
PREFIX="$TOOLCHAIN/local"
BUILD="$DIR/../builddbg"
SYSROOT="$DIR/../sysroot"
BINUTILS_VERSION="2.40"
BINUTILS_NAME="binutils-$BINUTILS_VERSION"
BINUTILS_PKG="${BINUTILS_NAME}.tar.xz"
BINUTILS_BASE_URL="https://ftp.gnu.org/gnu/binutils"
mkdir -p "$TOOLCHAIN/srcs"
pushd "$TOOLCHAIN/srcs"
# TODO: Check md5sum
if [ ! -e "$BINUTILS_PKG" ]; then
curl -LO "$BINUTILS_BASE_URL/$BINUTILS_PKG"
fi
if [ ! -d "$BINUTILS_NAME" ]; then
tar -xJf ${BINUTILS_PKG}
fi
popd
mkdir -p "$TOOLCHAIN/build"
pushd "$TOOLCHAIN/build"
# rm -rf binutils
if [ ! -d binutils ]; then
mkdir -p binutils
pushd binutils
# skip building documentation
export ac_cv_prog_MAKEINFO=true
"$TOOLCHAIN"/srcs/$BINUTILS_NAME/configure --prefix="$PREFIX" --target="$TARGET" --with-sysroot="$SYSROOT" --enable-shared --disable-nls
make MAKEINFO=true -j 8
make install MAKEINFO=true -j 8
popd
fi
popd

3
toolchain/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build/
local/
srcs/

View File

@ -0,0 +1,117 @@
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 1b0111fd..16dc49bf 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -238,6 +238,11 @@ esac
case "${targ}" in
# START OF targmatch.h
#ifdef BFD64
+ x86_64-*-acadia*)
+ targ_defvec=x86_64_elf64_vec
+ targ_selvecs=i386_elf32_vec
+ want64=true
+ ;;
aarch64-*-darwin*)
targ_defvec=aarch64_mach_o_vec
targ_selvecs="arm_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec"
diff --git a/config.sub b/config.sub
index 888e0fde..469ff17b 100755
--- a/config.sub
+++ b/config.sub
@@ -1754,7 +1754,7 @@ case $os in
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
- | fiwix*)
+ | fiwix* | acadia*)
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
diff --git a/config/override.m4 b/config/override.m4
index 5a1bffe6..fa281d24 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -29,7 +29,7 @@ m4_copy_force([_AC_PREREQ], [AC_PREREQ])
dnl Ensure exactly this Autoconf version is used
m4_ifndef([_GCC_AUTOCONF_VERSION],
- [m4_define([_GCC_AUTOCONF_VERSION], [2.69])])
+ [m4_define([_GCC_AUTOCONF_VERSION], [2.71])])
dnl Test for the exact version when AC_INIT is expanded.
dnl This allows one to update the tree in steps (for testing)
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 765ba736..b8d99f65 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -263,6 +263,7 @@ case ${generic_target} in
i386-*-nto-qnx*) fmt=elf ;;
i386-*-*nt*) fmt=coff em=pe ;;
i386-*-rdos*) fmt=elf ;;
+ i386-*-acadia*) fmt=elf ;;
i386-*-darwin*) fmt=macho ;;
ia16-*-elf*) fmt=elf ;;
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 12b2c3c4..66ff535a 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -454,6 +454,7 @@ ALL_64_EMULATION_SOURCES = \
eelf64tilegx_be.c \
eelf_mipsel_haiku.c \
eelf_x86_64.c \
+ eelf_x86_64_acadia.c \
eelf_x86_64_cloudabi.c \
eelf_x86_64_fbsd.c \
eelf_x86_64_haiku.c \
@@ -946,6 +947,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx_be.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_acadia.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Pc@am__quote@
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 3d5685d6..20cd5d88 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -954,6 +954,7 @@ ALL_64_EMULATION_SOURCES = \
eelf64tilegx_be.c \
eelf_mipsel_haiku.c \
eelf_x86_64.c \
+ eelf_x86_64_acadia.c \
eelf_x86_64_cloudabi.c \
eelf_x86_64_fbsd.c \
eelf_x86_64_haiku.c \
@@ -1462,6 +1463,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_s390.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_acadia.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Po@am__quote@
@@ -2619,7 +2621,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx_be.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Pc@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_acadia.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Pc@am__quote@
diff --git a/ld/configure.tgt b/ld/configure.tgt
index de04a44b..b1f3f26b 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -991,6 +991,9 @@ vax-*-linux-*) targ_emul=elf32vax
;;
visium-*-elf) targ_emul=elf32visium
;;
+x86_64-*-acadia*) targ_emul=elf_x86_64_acadia
+ target_extra_emuls="elf_x86_64"
+ ;;
x86_64-*-rdos*) targ_emul=elf64rdos
;;
x86_64-*-cloudabi*) targ_emul=elf_x86_64_cloudabi