Skip to content

Commit 8ab8cb2

Browse files
Add ArchieSDK (Acorn Archimedes GCC 8.5.0 cross-compiler) (#127)
* Add ArchieSDK GCC cross-compiler builder ArchieSDK provides a GCC 8.5.0 cross-compiler targeting arm-archie (26-bit ARMv2 for Acorn Archimedes / RISC OS). Closes compiler-explorer/compiler-explorer#7982. 🤖 Generated by LLM (Claude, via OpenClaw) * fix(archiesdk): complete build script - build toolchain from source with correct sysroot The previous script incorrectly called './build.sh gcc' (not a supported invocation). This replaces it with a full build that: - Clones gcc and binutils from _targz's patched master branches - Builds with --prefix and --with-sysroot pointing to the final CE install path (/opt/compiler-explorer/archiesdk/VERSION/SDK) so the baked-in sysroot path is correct at runtime - Builds the SDK libraries (libc.a, libm.a, libarchie.a, crt0.o, crtheap.o) and installs them into the sysroot - Tracks revisions from all three upstream repos for skip detection 🤖 Generated by LLM (Claude, via OpenClaw) --------- Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
1 parent 1fd7ee7 commit 8ab8cb2

File tree

3 files changed

+126
-0
lines changed

3 files changed

+126
-0
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
image:
12+
- archiesdk
1213
- ccc
1314
- compcert
1415
- clad

Dockerfile.archiesdk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:22.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update -y -q && apt-get upgrade -y -q && \
5+
apt-get install -y -q \
6+
bison \
7+
build-essential \
8+
ca-certificates \
9+
curl \
10+
flex \
11+
git \
12+
texinfo \
13+
wget \
14+
xz-utils
15+
16+
RUN mkdir -p /root
17+
COPY archiesdk /root/
18+
COPY common.sh /root/
19+
20+
WORKDIR /root

archiesdk/build.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/bin/bash
2+
3+
## $1 : version (e.g. "Release-1")
4+
## $2 : destination directory
5+
## $3 : last revision successfully built
6+
7+
set -ex
8+
source common.sh
9+
10+
VERSION="${1}"
11+
LAST_REVISION="${3:-}"
12+
13+
GCC_URL="https://gitlab.com/_targz/gcc.git"
14+
BINUTILS_URL="https://gitlab.com/_targz/binutils.git"
15+
SDK_URL="https://gitlab.com/_targz/archiesdk.git"
16+
17+
GCC_REVISION=$(get_remote_revision "${GCC_URL}" "heads/master")
18+
BINUTILS_REVISION=$(get_remote_revision "${BINUTILS_URL}" "heads/master")
19+
SDK_REVISION=$(get_remote_revision "${SDK_URL}" "tags/${VERSION}")
20+
21+
# Revision captures all three upstream sources
22+
REVISION="${VERSION}-gcc${GCC_REVISION:0:8}-bi${BINUTILS_REVISION:0:8}-sdk${SDK_REVISION:0:8}"
23+
24+
FULLNAME="archiesdk-${VERSION}"
25+
OUTPUT=$(realpath "$2/${FULLNAME}.tar.xz")
26+
27+
initialise "${REVISION}" "${OUTPUT}" "${LAST_REVISION}"
28+
29+
# Build to the final CE install path so the sysroot baked into GCC is correct at runtime
30+
INSTALL_PREFIX="/opt/compiler-explorer/archiesdk/${VERSION}"
31+
SYSROOT="${INSTALL_PREFIX}/SDK"
32+
mkdir -p "${SYSROOT}/include" "${SYSROOT}/lib"
33+
34+
NCPU=$(nproc)
35+
36+
# Clone archiesdk at the tagged version
37+
git clone --depth 1 --branch "${VERSION}" "${SDK_URL}" archiesdk-src
38+
ARCHIESDK=$(realpath archiesdk-src)
39+
40+
# Install SDK headers into the sysroot
41+
cp -r "${ARCHIESDK}/SDK/include/." "${SYSROOT}/include/"
42+
43+
# Clone binutils and GCC from master
44+
git clone --depth 1 "${BINUTILS_URL}" binutils-src
45+
git clone --depth 1 "${GCC_URL}" gcc-src
46+
47+
# Fetch GCC build prerequisites (gmp, mpc, mpfr, isl)
48+
cd gcc-src
49+
./contrib/download_prerequisites
50+
cd ..
51+
52+
# Build binutils
53+
mkdir -p build-binutils
54+
cd build-binutils
55+
../binutils-src/configure \
56+
--prefix="${INSTALL_PREFIX}" \
57+
--target=arm-archie \
58+
--with-sysroot="${SYSROOT}" \
59+
--with-build-sysroot="${SYSROOT}" \
60+
--disable-nls \
61+
--disable-multilib
62+
make -j"${NCPU}" configure-host
63+
make -j"${NCPU}"
64+
make install
65+
cd ..
66+
67+
# Build GCC cross-compiler + libgcc
68+
mkdir -p build-gcc
69+
cd build-gcc
70+
../gcc-src/configure \
71+
--prefix="${INSTALL_PREFIX}" \
72+
--target=arm-archie \
73+
--with-sysroot="${SYSROOT}" \
74+
--with-build-sysroot="${SYSROOT}" \
75+
--disable-nls \
76+
--disable-shared \
77+
--enable-languages=c \
78+
--disable-multilib \
79+
--disable-threads \
80+
--disable-decimal-float \
81+
--disable-libgomp \
82+
--disable-libmudflap \
83+
--disable-libssp \
84+
--disable-libatomic \
85+
--disable-libquadmath \
86+
--with-cpu=arm2 \
87+
--with-float=soft
88+
make -j"${NCPU}" all-gcc all-target-libgcc \
89+
CFLAGS_FOR_TARGET='-msoft-float -mcpu=arm2 -mno-thumb-interwork -O2 -ffreestanding'
90+
make install-gcc install-target-libgcc
91+
cd ..
92+
93+
# Build SDK libraries (libc.a, libm.a, libarchie.a, crt0.o, crtheap.o)
94+
# Override tool paths to use our freshly built cross-compiler
95+
cd "${ARCHIESDK}/SDK"
96+
make sdk \
97+
ARCHIESDK="${ARCHIESDK}" \
98+
ARCHIECC="${INSTALL_PREFIX}/bin/arm-archie-gcc" \
99+
ARCHIEAS="${INSTALL_PREFIX}/bin/arm-archie-as" \
100+
ARCHIEAR="${INSTALL_PREFIX}/bin/arm-archie-ar" \
101+
ARCHIEOBJCOPY="${INSTALL_PREFIX}/bin/arm-archie-objcopy"
102+
cp lib/*.a lib/*.o "${SYSROOT}/lib/"
103+
cd -
104+
105+
complete "${INSTALL_PREFIX}" "${FULLNAME}" "${OUTPUT}"

0 commit comments

Comments
 (0)