Skip to content

Commit 2eb5566

Browse files
committed
Update to GCC 14.2.0
1 parent 027980c commit 2eb5566

5 files changed

Lines changed: 208 additions & 28 deletions

File tree

.github/workflows/build.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,52 @@ jobs:
1313
- uses: actions/checkout@main
1414
with:
1515
submodules: true
16+
- name: Check for cache
17+
id: check-cache
18+
uses: actions/cache@main
19+
with:
20+
key: gcc-14.2.0
21+
lookup-only: true
22+
path: |
23+
/tmp/x86_64-linux-gnu.tar.xz
24+
/tmp/x86_64-linux-gnu.tar.xz.sha256
1625
- name: Build Venti
26+
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
1727
run: |
1828
bash './build.sh' 'native'
1929
- name: Generate tarball
30+
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
2031
run: |
2132
declare tarball_filename='/tmp/x86_64-linux-gnu.tar.xz'
2233
tar --directory='/tmp' --create --file=- 'venti' | xz --threads='0' --compress -9 > "${tarball_filename}"
2334
sha256sum "${tarball_filename}" | sed 's|/tmp/||' > "${tarball_filename}.sha256"
2435
- name: Upload artifact
36+
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
2537
uses: actions/upload-artifact@main
2638
with:
2739
name: native-toolchain
2840
if-no-files-found: error
2941
path: |
3042
/tmp/x86_64-linux-gnu.tar.xz
3143
/tmp/x86_64-linux-gnu.tar.xz.sha256
44+
- name: Cache artifact
45+
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
46+
uses: actions/cache@main
47+
with:
48+
key: gcc-14.2.0
49+
path: |
50+
/tmp/x86_64-linux-gnu.tar.xz
51+
/tmp/x86_64-linux-gnu.tar.xz.sha256
3252
3353
cross-build:
3454
name: 'Cross build'
3555
needs: native-build
3656
runs-on: ubuntu-latest
57+
continue-on-error: true
3758
strategy:
3859
matrix:
3960
target: [
61+
'ia64-unknown-linux-gnu',
4062
'alpha-unknown-linux-gnu',
4163
'x86_64-unknown-linux-gnu',
4264
'i386-unknown-linux-gnu',
@@ -50,19 +72,24 @@ jobs:
5072
's390-unknown-linux-gnu',
5173
's390x-unknown-linux-gnu',
5274
'sparc-unknown-linux-gnu',
53-
'powerpc64le-unknown-linux-gnu'
75+
'powerpc64le-unknown-linux-gnu',
76+
'mips64el-unknown-linux-gnuabi64'
5477
]
5578
steps:
5679
- uses: actions/checkout@main
5780
with:
5881
submodules: true
59-
- name: Download artifact
60-
uses: actions/download-artifact@main
82+
- name: Restore from cache
83+
uses: actions/cache@main
6184
with:
62-
name: native-toolchain
85+
key: gcc-14.2.0
86+
fail-on-cache-miss: true
87+
path: |
88+
/tmp/x86_64-linux-gnu.tar.xz
89+
/tmp/x86_64-linux-gnu.tar.xz.sha256
6390
- name: Setup toolchain
6491
run: |
65-
tar --directory='/tmp' --extract --file='./x86_64-linux-gnu.tar.xz'
92+
tar --directory='/tmp' --extract --file='/tmp/x86_64-linux-gnu.tar.xz'
6693
mv '/tmp/venti' '/tmp/venti-toolchain'
6794
- name: Build Venti with OBGGCC
6895
run: |
@@ -78,7 +105,7 @@ jobs:
78105
- name: Upload artifact
79106
uses: actions/upload-artifact@main
80107
with:
81-
name: cross-toolchain
108+
name: ${{ matrix.target }}
82109
if-no-files-found: error
83110
path: |
84111
/tmp/${{ matrix.target }}.tar.xz

build.sh

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22

33
set -eu
44

5+
declare -r workdir="${PWD}"
6+
57
declare -r revision="$(git rev-parse --short HEAD)"
68

79
declare -r gmp_tarball='/tmp/gmp.tar.xz'
8-
declare -r gmp_directory='/tmp/gmp-6.2.1'
10+
declare -r gmp_directory='/tmp/gmp-6.3.0'
911

1012
declare -r mpfr_tarball='/tmp/mpfr.tar.xz'
11-
declare -r mpfr_directory='/tmp/mpfr-4.2.0'
13+
declare -r mpfr_directory='/tmp/mpfr-4.2.1'
1214

1315
declare -r mpc_tarball='/tmp/mpc.tar.gz'
1416
declare -r mpc_directory='/tmp/mpc-1.3.1'
1517

1618
declare -r binutils_tarball='/tmp/binutils.tar.xz'
17-
declare -r binutils_directory='/tmp/binutils-2.40'
19+
declare -r binutils_directory='/tmp/binutils-2.43'
1820

19-
declare -r gcc_tarball='/tmp/gcc.tar.gz'
20-
declare -r gcc_directory='/tmp/gcc-13.2.0'
21+
declare -r gcc_tarball='/tmp/gcc.tar.xz'
22+
declare -r gcc_directory='/tmp/gcc-14.2.0'
2123

2224
declare -r system_image='/tmp/dragonflybsd.iso'
2325
declare -r system_image_compressed='/tmp/dragonflybsd.iso.bz2'
@@ -28,7 +30,7 @@ declare -r triplet='x86_64-unknown-dragonfly'
2830
declare -r optflags='-Os'
2931
declare -r linkflags='-Wl,-s'
3032

31-
declare -r max_jobs="$(($(nproc) * 8))"
33+
declare -r max_jobs="$(($(nproc) * 17))"
3234

3335
declare build_type="${1}"
3436

@@ -52,24 +54,38 @@ if ! (( is_native )); then
5254
cross_compile_flags+="--host=${CROSS_COMPILE_TRIPLET}"
5355
fi
5456

55-
declare -r toolchain_directory="/tmp/venti"
57+
if ! [ -f "${gmp_tarball}" ]; then
58+
wget --no-verbose 'https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz' --output-document="${gmp_tarball}"
59+
tar --directory="$(dirname "${gmp_directory}")" --extract --file="${gmp_tarball}"
60+
fi
5661

57-
wget --no-verbose 'https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz' --output-document="${gmp_tarball}"
58-
tar --directory="$(dirname "${gmp_directory}")" --extract --file="${gmp_tarball}"
62+
if ! [ -f "${mpfr_tarball}" ]; then
63+
wget --no-verbose 'https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz' --output-document="${mpfr_tarball}"
64+
tar --directory="$(dirname "${mpfr_directory}")" --extract --file="${mpfr_tarball}"
65+
fi
5966

60-
wget --no-verbose 'https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.0.tar.xz' --output-document="${mpfr_tarball}"
61-
tar --directory="$(dirname "${mpfr_directory}")" --extract --file="${mpfr_tarball}"
67+
if ! [ -f "${mpc_tarball}" ]; then
68+
wget --no-verbose 'https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz' --output-document="${mpc_tarball}"
69+
tar --directory="$(dirname "${mpc_directory}")" --extract --file="${mpc_tarball}"
70+
fi
6271

63-
wget --no-verbose 'https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz' --output-document="${mpc_tarball}"
64-
tar --directory="$(dirname "${mpc_directory}")" --extract --file="${mpc_tarball}"
72+
if ! [ -f "${binutils_tarball}" ]; then
73+
wget --no-verbose 'https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.xz' --output-document="${binutils_tarball}"
74+
tar --directory="$(dirname "${binutils_directory}")" --extract --file="${binutils_tarball}"
75+
76+
patch --directory="${binutils_directory}" --strip='1' --input="${workdir}/patches/0001-Revert-gold-Use-char16_t-char32_t-instead-of-uint16_.patch"
77+
fi
6578

66-
wget --no-verbose 'https://ftp.gnu.org/gnu/binutils/binutils-2.40.tar.xz' --output-document="${binutils_tarball}"
67-
tar --directory="$(dirname "${binutils_directory}")" --extract --file="${binutils_tarball}"
79+
if ! [ -f "${gcc_tarball}" ]; then
80+
wget --no-verbose 'https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz' --output-document="${gcc_tarball}"
81+
tar --directory="$(dirname "${gcc_directory}")" --extract --file="${gcc_tarball}"
82+
83+
patch --directory="${gcc_directory}" --strip='1' --input="${workdir}/patches/0001-Revert-GCC-change-about-turning-Wimplicit-function-d.patch"
84+
fi
6885

69-
wget --no-verbose 'https://mirrors.kernel.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz' --output-document="${gcc_tarball}"
70-
tar --directory="$(dirname "${gcc_directory}")" --extract --file="${gcc_tarball}"
86+
declare -r toolchain_directory="/tmp/venti"
7187

72-
wget --no-verbose 'https://mirror-master.dragonflybsd.org/iso-images/dfly-x86_64-5.0.0_REL.iso.bz2' --output-document="${system_image_compressed}"
88+
wget --no-verbose 'https://mirror-master.dragonflybsd.org/iso-images/dfly-x86_64-5.0.0_REL.iso.bz2' --output-document="${system_image_compressed}"
7389

7490
pushd "$(dirname "${system_image_compressed}")"
7591

@@ -145,8 +161,6 @@ cd "${mpc_directory}/build"
145161
make all --jobs
146162
make install
147163

148-
sed -i 's/#include <stdint.h>/#include <stdint.h>\n#include <stdio.h>/g' "${toolchain_directory}/include/mpc.h"
149-
150164
[ -d "${binutils_directory}/build" ] || mkdir "${binutils_directory}/build"
151165

152166
cd "${binutils_directory}/build"
@@ -182,7 +196,7 @@ rm --force --recursive ./*
182196
--with-mpfr="${toolchain_directory}" \
183197
--with-bugurl='https://github.com/AmanoTeam/Venti/issues' \
184198
--with-gcc-major-version-only \
185-
--with-pkgversion="Venti v0.4-${revision}" \
199+
--with-pkgversion="Venti v0.5-${revision}" \
186200
--with-sysroot="${toolchain_directory}/${triplet}" \
187201
--with-native-system-header-dir='/include' \
188202
--includedir="${toolchain_directory}/${triplet}/include" \
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
From 9088a8ce453a6b66d51b87d096bf9cf15042794d Mon Sep 17 00:00:00 2001
2+
From: Kartatz <105828205+Kartatz@users.noreply.github.com>
3+
Date: Sun, 11 Aug 2024 22:06:07 +0200
4+
Subject: [PATCH] Revert GCC change about turning -Wimplicit-function-declaration into errors
5+
6+
Unfortunately, the new behavior breaks the compilation of some GCC dependencies and even GCC itself when building for very old targets.
7+
8+
This is due to these platforms lacking support for some required standard library functions and APIs: Until GCC 13, the compiler always fell back to a built-in alternative in case one of those functions was missing (see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html). The compiler, however, used to just issue an "implicit function declaration" warning for the usage of those builtins. Since this warning is now treated as an error, this simply made the compilation fail.
9+
---
10+
gcc/c/c-decl.cc | 10 +++++-----
11+
1 file changed, 5 insertions(+), 5 deletions(-)
12+
13+
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
14+
index 0e52f2176..dde2b207c 100644
15+
--- a/gcc/c/c-decl.cc
16+
+++ b/gcc/c/c-decl.cc
17+
@@ -3566,7 +3566,7 @@ pushdecl (tree x)
18+
or NULL_TREE. */
19+
20+
static void
21+
-implicit_decl_permerror (location_t loc, tree id, tree olddecl)
22+
+implicit_decl_warning (location_t loc, tree id, tree olddecl)
23+
{
24+
if (!warn_implicit_function_declaration)
25+
return;
26+
@@ -3583,13 +3583,13 @@ implicit_decl_permerror (location_t loc, tree id, tree olddecl)
27+
{
28+
gcc_rich_location richloc (loc);
29+
richloc.add_fixit_replace (suggestion);
30+
- warned = permerror_opt (&richloc, OPT_Wimplicit_function_declaration,
31+
+ warned = pedwarn (&richloc, OPT_Wimplicit_function_declaration,
32+
"implicit declaration of function %qE;"
33+
" did you mean %qs?",
34+
id, suggestion);
35+
}
36+
else
37+
- warned = permerror_opt (loc, OPT_Wimplicit_function_declaration,
38+
+ warned = pedwarn (loc, OPT_Wimplicit_function_declaration,
39+
"implicit declaration of function %qE", id);
40+
}
41+
else if (const char *suggestion = hint.suggestion ())
42+
@@ -3880,7 +3880,7 @@ implicitly_declare (location_t loc, tree functionid)
43+
then recycle the old declaration but with the new type. */
44+
if (!C_DECL_IMPLICIT (decl))
45+
{
46+
- implicit_decl_permerror (loc, functionid, decl);
47+
+ implicit_decl_warning (loc, functionid, decl);
48+
C_DECL_IMPLICIT (decl) = 1;
49+
}
50+
if (fndecl_built_in_p (decl))
51+
@@ -3933,7 +3933,7 @@ implicitly_declare (location_t loc, tree functionid)
52+
DECL_EXTERNAL (decl) = 1;
53+
TREE_PUBLIC (decl) = 1;
54+
C_DECL_IMPLICIT (decl) = 1;
55+
- implicit_decl_permerror (loc, functionid, 0);
56+
+ implicit_decl_warning (loc, functionid, 0);
57+
asmspec_tree = maybe_apply_renaming_pragma (decl, /*asmname=*/NULL);
58+
if (asmspec_tree)
59+
set_user_assembler_name (decl, TREE_STRING_POINTER (asmspec_tree));
60+
--
61+
2.36.6
62+
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
From c5fcba3bc2b47e1061e066deac04efbbdb53362d Mon Sep 17 00:00:00 2001
2+
From: Kartatz <105828205+Kartatz@users.noreply.github.com>
3+
Date: Wed, 8 May 2024 07:04:54 +0200
4+
Subject: [PATCH] Revert "gold: Use char16_t, char32_t instead of uint16_t,
5+
uint32_t as character types"
6+
7+
This reverts commit 5e9091dab8858b25210a91d22fbbbfdee9c969ad.
8+
---
9+
diff --git a/gold/merge.cc b/gold/merge.cc
10+
index ca15149c767..55de3013a1b 100644
11+
--- a/gold/merge.cc
12+
+++ b/gold/merge.cc
13+
@@ -665,10 +665,10 @@ template
14+
class Output_merge_string<char>;
15+
16+
template
17+
-class Output_merge_string<char16_t>;
18+
+class Output_merge_string<uint16_t>;
19+
20+
template
21+
-class Output_merge_string<char32_t>;
22+
+class Output_merge_string<uint32_t>;
23+
24+
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
25+
template
26+
diff --git a/gold/output.cc b/gold/output.cc
27+
index ead67f20363..3375d322506 100644
28+
--- a/gold/output.cc
29+
+++ b/gold/output.cc
30+
@@ -29,7 +29,6 @@
31+
#include <unistd.h>
32+
#include <sys/stat.h>
33+
#include <algorithm>
34+
-#include <uchar.h>
35+
36+
#ifdef HAVE_SYS_MMAN_H
37+
#include <sys/mman.h>
38+
@@ -2707,10 +2706,10 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int shndx,
39+
pomb = new Output_merge_string<char>(addralign);
40+
break;
41+
case 2:
42+
- pomb = new Output_merge_string<char16_t>(addralign);
43+
+ pomb = new Output_merge_string<uint16_t>(addralign);
44+
break;
45+
case 4:
46+
- pomb = new Output_merge_string<char32_t>(addralign);
47+
+ pomb = new Output_merge_string<uint32_t>(addralign);
48+
break;
49+
default:
50+
return false;
51+
diff --git a/gold/stringpool.cc b/gold/stringpool.cc
52+
index d8f38cfabc1..2e4a746d1a8 100644
53+
--- a/gold/stringpool.cc
54+
+++ b/gold/stringpool.cc
55+
@@ -25,7 +25,6 @@
56+
#include <cstring>
57+
#include <algorithm>
58+
#include <vector>
59+
-#include <uchar.h>
60+
61+
#include "output.h"
62+
#include "parameters.h"
63+
@@ -528,9 +527,9 @@ template
64+
class Stringpool_template<char>;
65+
66+
template
67+
-class Stringpool_template<char16_t>;
68+
+class Stringpool_template<uint16_t>;
69+
70+
template
71+
-class Stringpool_template<char32_t>;
72+
+class Stringpool_template<uint32_t>;
73+
74+
} // End namespace gold.
75+
--
76+
2.36.6
77+

0 commit comments

Comments
 (0)