From 06590dfff77c0891b1e908c21410ccb51a429012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20Bac=C5=82awski?= Date: Mon, 6 Jan 2025 15:52:13 +0100 Subject: [PATCH] Refresh binutils, add gcc 6.5.0b from Bebbo (#8) * Bump up binutils to 2.39.0 and gdb to 13.0 * Add missing GMP/MPFR/MPC/ISL libraries. * Add gcc 6.5.0b from Bebbo. * Switch to Github Actions v4. * Fix pip3/venv in Docker image --- .github/workflows/workflow.yml | 4 +- .gitmodules | 3 ++ Dockerfile | 4 +- patches/gdb-line-addr-fix.patch | 8 ++-- patches/ld-extra-chip-sections.patch | 4 +- submodules/binutils-gdb | 2 +- submodules/gcc-bebbo | 1 + toolchain-m68k.py | 68 +++++++++++++++++++++++++++- 8 files changed, 82 insertions(+), 12 deletions(-) create mode 160000 submodules/gcc-bebbo diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index b256322..459ce26 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -8,7 +8,7 @@ jobs: container: cahirwpz/demoscene-toolchain:latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -24,7 +24,7 @@ jobs: run: tar czf demoscene-toolchain.tar.gz /usr/local - name: Upload toolchain - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: demoscene-toolchain path: demoscene-toolchain.tar.gz diff --git a/.gitmodules b/.gitmodules index 6395182..b8dfa13 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "submodules/fs-uae"] path = submodules/fs-uae url = https://github.com/FrodeSolheim/fs-uae.git +[submodule "gcc-bebbo"] + path = submodules/gcc-bebbo + url = https://github.com/bebbo/gcc.git diff --git a/Dockerfile b/Dockerfile index 9ccfbc9..202ea76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,8 @@ RUN apt-get install -y --no-install-recommends \ automake bison ca-certificates flex git-core gettext gperf \ gcc g++ libc6-dev libglib2.0-dev libncurses-dev libpng-dev \ libsdl2-dev libsdl2-ttf-dev libopenal-dev libtool make patch \ - pkg-config python3 python3-dev python3-pip quilt texinfo zip + pkg-config python3 python3-dev python3-venv quilt texinfo zip COPY requirements.txt . RUN python3 -m venv .venv -RUN source .venv/bin/activate && \ +RUN . ./.venv/bin/activate && \ pip install --no-cache-dir -r requirements.txt diff --git a/patches/gdb-line-addr-fix.patch b/patches/gdb-line-addr-fix.patch index 0bc4330..9084d99 100644 --- a/patches/gdb-line-addr-fix.patch +++ b/patches/gdb-line-addr-fix.patch @@ -2,12 +2,12 @@ Index: demoscene-toolchain/submodules/binutils-gdb/gdb/dbxread.c =================================================================== --- demoscene-toolchain.orig/submodules/binutils-gdb/gdb/dbxread.c +++ demoscene-toolchain/submodules/binutils-gdb/gdb/dbxread.c -@@ -2581,7 +2581,7 @@ process_one_symbol (int type, int desc, - +@@ -2622,7 +2622,7 @@ process_one_symbol (int type, int desc, /* Relocate for dynamic loading and for ELF acc - function-relative symbols. */ + function-relative symbols. */ + #if (DEFAULT_BFD_VEC != amiga_vec) - valu += function_start_offset; + /* valu += function_start_offset; */ + #endif /* GCC 2.95.3 emits the first N_SLINE stab somewhere in the - middle of the prologue instead of right at the start of the diff --git a/patches/ld-extra-chip-sections.patch b/patches/ld-extra-chip-sections.patch index 46f85d6..38e032d 100644 --- a/patches/ld-extra-chip-sections.patch +++ b/patches/ld-extra-chip-sections.patch @@ -4,7 +4,7 @@ Index: demoscene-toolchain/submodules/binutils-gdb/bfd/amigaos.c +++ demoscene-toolchain/submodules/binutils-gdb/bfd/amigaos.c @@ -2825,9 +2825,15 @@ amiga_new_section_hook ( { - newsect->used_by_bfd = (PTR) bfd_zalloc (abfd, sizeof(amiga_per_section_type)); + newsect->used_by_bfd = (void *) bfd_zalloc (abfd, sizeof(amiga_per_section_type)); newsect->alignment_power = 2; - if (!strcmp (newsect->name, ".datachip") || !strcmp (newsect->name, ".bsschip")) + if (!strcmp (newsect->name, ".datachip") || @@ -18,5 +18,5 @@ Index: demoscene-toolchain/submodules/binutils-gdb/bfd/amigaos.c + !strncmp (newsect->name, ".datafast.", strlen(".datafast.")) || + !strncmp (newsect->name, ".bssfast.", strlen(".bssfast."))) amiga_per_section(newsect)->attribute |= MEMF_FAST; - return TRUE; + return true; } diff --git a/submodules/binutils-gdb b/submodules/binutils-gdb index 033085a..472f16b 160000 --- a/submodules/binutils-gdb +++ b/submodules/binutils-gdb @@ -1 +1 @@ -Subproject commit 033085a1380353822c19adc1d9c9dadb82ba42e1 +Subproject commit 472f16ba0ad9ed551a92dd8a7c6b8fbe9bc98a4e diff --git a/submodules/gcc-bebbo b/submodules/gcc-bebbo new file mode 160000 index 0000000..a970bf7 --- /dev/null +++ b/submodules/gcc-bebbo @@ -0,0 +1 @@ +Subproject commit a970bf7ee522b39d60b428b0e6fd6f03e87c2a30 diff --git a/toolchain-m68k.py b/toolchain-m68k.py index 8cdd794..fe94122 100644 --- a/toolchain-m68k.py +++ b/toolchain-m68k.py @@ -20,6 +20,10 @@ 'https://ftp.gnu.org/gnu/bison/bison-1.35.tar.gz', 'https://ftp.gnu.org/gnu/texinfo/texinfo-4.12.tar.gz', 'https://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz', + 'https://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.2.1.tar.bz2', + 'https://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.6.tar.bz2', + 'https://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz', + 'https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2', ('https://github.com/askeksa/Shrinkler/archive/refs/tags/v4.7.tar.gz', 'Shrinkler-4.7.tar.gz'), ('https://github.com/emmanuel-marty/salvador/archive/refs/tags/1.4.2.tar.gz', @@ -153,7 +157,7 @@ def touch_genfiles(dst): def download(): with cwd('{archives}'): for url in URLS: - if type(url) == tuple: + if type(url) is tuple: url, name = url[0], url[1] else: name = path.basename(url) @@ -270,6 +274,42 @@ def build(): make('{autoconf}', parallel=True) make('{autoconf}', 'install') + unpack('{gmp}') + configure('{gmp}', + '--prefix={host}', + '--disable-shared', + '--enable-static') + make('{gmp}', parallel=True) + make('{gmp}', 'install') + + unpack('{mpfr}') + configure('{mpfr}', + '--prefix={host}', + '--with-gmp={host}', + '--disable-shared', + '--enable-static') + make('{mpfr}', parallel=True) + make('{mpfr}', 'install') + + unpack('{mpc}') + configure('{mpc}', + '--prefix={host}', + '--with-gmp={host}', + '--with-mpfr={host}', + '--disable-shared', + '--enable-static') + make('{mpc}', parallel=True) + make('{mpc}', 'install') + + unpack('{isl}') + configure('{isl}', + '--prefix={host}', + '--with-gmp-prefix={host}', + '--disable-shared', + '--enable-static') + make('{isl}', parallel=True) + make('{isl}', 'install') + prepare_target() unpack('vasm', work_dir='{build}') @@ -304,6 +344,7 @@ def build(): '--disable-plugins', '--disable-werror', '--disable-tui', + '--with-libgmp-prefix={host}', '--with-python=' + sys.executable, '--target=m68k-amigaos', from_dir='{submodules}/{binutils}') @@ -340,6 +381,26 @@ def build(): make('{gcc}', 'all-gcc', MAKEINFO='makeinfo') make('{gcc}', 'install-gcc', MAKEINFO='makeinfo') + with env(CC=CC, CXX=CXX, CFLAGS=FLAGS, CXXFLAGS=FLAGS): + configure('{gcc_bebbo}', + '--prefix={prefix}', + '--infodir={prefix}/{target}/info', + '--mandir={prefix}/share/man', + '--program-prefix=m68k-amigaos-', + '--program-suffix=-6.5.0b', + '--with-gmp={host}', + '--with-mpfr={host}', + '--with-mpc={host}', + '--with-isl={host}', + '--target=m68k-amigaos', + '--enable-languages=c', + '--enable-version-specific-runtime-libs', + '--disable-nls', + '--disable-libssp', + from_dir='{submodules}/{gcc_bebbo}') + make('{gcc_bebbo}', 'all-gcc', parallel=True) + make('{gcc_bebbo}', 'install-gcc') + with env(CC=CC, CXX=CXX, CFLAGS=FLAGS, CXXFLAGS=FLAGS, PATH=PATH): fs_uae_bootstrap() configure('{fsuae}', @@ -422,10 +483,15 @@ def clean(): automake='automake-1.15', autoconf='autoconf-2.13', texinfo='texinfo-4.12', + gmp='gmp-6.2.1', + mpfr='mpfr-3.1.6', + mpc='mpc-1.0.3', + isl='isl-0.18', NDK='NDK_3.9', binutils='binutils-gdb', fsuae='fs-uae', gcc='gcc-2.95.3', + gcc_bebbo='gcc-bebbo', shrinkler='Shrinkler-4.7', salvador='salvador-1.4.2', lzsa='lzsa-1.4.1',