Skip to content

Commit c68b232

Browse files
committed
Update to GCC 14.1.0
1 parent 7f68de8 commit c68b232

16 files changed

+205
-160
lines changed

.github/workflows/build.yml

+32-6
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,42 @@ 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.1.0-1
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 Raiden
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=- 'raiden' | 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.1.0-1
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'
@@ -38,6 +58,7 @@ jobs:
3858
strategy:
3959
matrix:
4060
target: [
61+
'ia64-unknown-linux-gnu',
4162
'alpha-unknown-linux-gnu',
4263
'x86_64-unknown-linux-gnu',
4364
'i386-unknown-linux-gnu',
@@ -51,19 +72,24 @@ jobs:
5172
's390-unknown-linux-gnu',
5273
's390x-unknown-linux-gnu',
5374
'sparc-unknown-linux-gnu',
54-
'powerpc64le-unknown-linux-gnu'
75+
'powerpc64le-unknown-linux-gnu',
76+
'mips64el-unknown-linux-gnuabi64'
5577
]
5678
steps:
5779
- uses: actions/checkout@main
5880
with:
5981
submodules: true
60-
- name: Download artifact
61-
uses: actions/download-artifact@main
82+
- name: Restore from cache
83+
uses: actions/cache@main
6284
with:
63-
name: native-toolchain
85+
key: gcc-14.1.0-1
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
6490
- name: Setup toolchain
6591
run: |
66-
tar --directory='/tmp' --extract --file='./x86_64-linux-gnu.tar.xz'
92+
tar --directory='/tmp' --extract --file='/tmp/x86_64-linux-gnu.tar.xz'
6793
mv '/tmp/raiden' '/tmp/raiden-toolchain'
6894
- name: Build Raiden with OBGGCC
6995
run: |
@@ -79,7 +105,7 @@ jobs:
79105
- name: Upload artifact
80106
uses: actions/upload-artifact@main
81107
with:
82-
name: cross-toolchain
108+
name: ${{ matrix.target }}
83109
if-no-files-found: error
84110
path: |
85111
/tmp/${{ matrix.target }}.tar.xz

aarch64-unknown-linux-musl.sh

-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
#!/bin/bash
22

3-
declare packages=(
4-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/aarch64/musl-1.1.24_17.aarch64-musl.xbps'
5-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/aarch64/musl-devel-1.1.24_17.aarch64-musl.xbps'
6-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/aarch64/kernel-libc-headers-5.10.4_1.aarch64.xbps'
7-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/aarch64/libexecinfo-devel-1.1_3.aarch64-musl.xbps'
8-
)
9-
103
declare extra_configure_flags=''
114

125
declare triplet='aarch64-unknown-linux-musl'
136

147
declare ld='ld-musl-aarch64.so.1'
158

16-
declare sysroot='https://web.archive.org/web/0if_/https://repo-default.voidlinux.org/live/current/void-aarch64-musl-ROOTFS-20230628.tar.xz'
17-
189
declare os='void'

arm-unknown-linux-musleabihf.sh

-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
#!/bin/bash
22

3-
declare packages=(
4-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/musl/musl-1.1.24_17.armv6l-musl.xbps'
5-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/musl/musl-devel-1.1.24_17.armv6l-musl.xbps'
6-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/kernel-libc-headers-5.10.4_1.armv6l.xbps'
7-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/musl/libexecinfo-devel-1.1_3.armv6l-musl.xbps'
8-
)
9-
103
declare extra_configure_flags='--with-arch=armv6 --with-fpu=vfp --with-float=hard'
114

125
declare triplet='arm-unknown-linux-musleabihf'
136

147
declare ld='ld-musl-armhf.so.1'
158

16-
declare sysroot='https://web.archive.org/web/0if_/https://repo-default.voidlinux.org/live/current/void-armv6l-musl-ROOTFS-20230628.tar.xz'
17-
189
declare os='void'

armv7l-unknown-linux-musleabihf.sh

-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
#!/bin/bash
22

3-
declare packages=(
4-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/musl/musl-1.1.24_17.armv7l-musl.xbps'
5-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/musl/musl-devel-1.1.24_17.armv7l-musl.xbps'
6-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/kernel-libc-headers-5.10.4_1.armv7l.xbps'
7-
'https://web.archive.org/web/0if_/https://alpha.de.repo.voidlinux.org/current/musl/libexecinfo-devel-1.1_3.armv7l-musl.xbps'
8-
)
9-
103
declare extra_configure_flags='--with-arch=armv7-a --with-fpu=vfpv3 --with-float=hard'
114

125
declare triplet='armv7l-unknown-linux-musleabihf'
136

147
declare ld='ld-musl-armhf.so.1'
158

16-
declare sysroot='https://web.archive.org/web/0if_/https://repo-default.voidlinux.org/live/current/void-armv7l-musl-ROOTFS-20230628.tar.xz'
17-
189
declare os='void'

build.sh

+68-77
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,63 @@
22

33
set -eu
44

5-
declare -r current_source_directory="${PWD}"
5+
declare -r workdir="${PWD}"
66

77
declare -r revision="$(git rev-parse --short HEAD)"
88

99
declare -r toolchain_directory='/tmp/raiden'
1010

1111
declare -r gmp_tarball='/tmp/gmp.tar.xz'
12-
declare -r gmp_directory='/tmp/gmp-6.2.1'
12+
declare -r gmp_directory='/tmp/gmp-6.3.0'
1313

1414
declare -r mpfr_tarball='/tmp/mpfr.tar.xz'
15-
declare -r mpfr_directory='/tmp/mpfr-4.2.0'
15+
declare -r mpfr_directory='/tmp/mpfr-4.2.1'
1616

1717
declare -r mpc_tarball='/tmp/mpc.tar.gz'
1818
declare -r mpc_directory='/tmp/mpc-1.3.1'
1919

2020
declare -r binutils_tarball='/tmp/binutils.tar.xz'
21-
declare -r binutils_directory='/tmp/binutils-2.40'
21+
declare -r binutils_directory='/tmp/binutils-2.42'
2222

23-
declare -r gcc_tarball='/tmp/gcc.tar.gz'
24-
declare -r gcc_directory='/tmp/gcc-13.2.0'
23+
declare gcc_directory=''
24+
25+
declare -r sysroot_tarball='/tmp/sysroot.tar.xz'
26+
27+
function setup_gcc_source() {
28+
29+
local gcc_version=''
30+
local gcc_url=''
31+
local gcc_tarball=''
32+
local tgt="${1}"
33+
34+
declare -r tgt
35+
36+
gcc_version='14'
37+
gcc_directory='/tmp/gcc-14.1.0'
38+
gcc_url='https://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.xz'
39+
40+
gcc_tarball="/tmp/gcc-${gcc_version}.tar.xz"
41+
42+
declare -r gcc_version
43+
declare -r gcc_url
44+
declare -r gcc_tarball
45+
46+
if ! [ -f "${gcc_tarball}" ]; then
47+
wget --no-verbose "${gcc_url}" --output-document="${gcc_tarball}"
48+
tar --directory="$(dirname "${gcc_directory}")" --extract --file="${gcc_tarball}"
49+
fi
50+
51+
[ -d "${gcc_directory}/build" ] || mkdir "${gcc_directory}/build"
52+
53+
sed --in-place 's/LDBL_MANT_DIG == 113/defined(__powerpc__) || defined(__powerpc64__) || defined(__s390x__)/g' "${gcc_directory}/libgcc/dfp-bit.h"
54+
sed --in-place 's/soft-fp.h/this-does-not-exist.h/g' "${gcc_directory}/libquadmath/math/sqrtq.c"
55+
56+
}
2557

2658
declare -r optflags='-Os'
2759
declare -r linkflags='-Wl,-s'
2860

29-
declare -r max_jobs="$(($(nproc) * 8))"
61+
declare -r max_jobs="$(($(nproc) * 17))"
3062

3163
declare build_type="${1}"
3264

@@ -51,32 +83,27 @@ if ! (( is_native )); then
5183
fi
5284

5385
if ! [ -f "${gmp_tarball}" ]; then
54-
curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/gmp/gmp-6.2.1.tar.xz' --output "${gmp_tarball}"
86+
wget --no-verbose 'https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz' --output-document="${gmp_tarball}"
5587
tar --directory="$(dirname "${gmp_directory}")" --extract --file="${gmp_tarball}"
5688
fi
5789

5890
if ! [ -f "${mpfr_tarball}" ]; then
59-
curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/mpfr/mpfr-4.2.0.tar.xz' --output "${mpfr_tarball}"
91+
wget --no-verbose 'https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz' --output-document="${mpfr_tarball}"
6092
tar --directory="$(dirname "${mpfr_directory}")" --extract --file="${mpfr_tarball}"
6193
fi
6294

6395
if ! [ -f "${mpc_tarball}" ]; then
64-
curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/mpc/mpc-1.3.1.tar.gz' --output "${mpc_tarball}"
96+
wget --no-verbose 'https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz' --output-document="${mpc_tarball}"
6597
tar --directory="$(dirname "${mpc_directory}")" --extract --file="${mpc_tarball}"
6698
fi
6799

68100
if ! [ -f "${binutils_tarball}" ]; then
69-
curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/binutils/binutils-2.40.tar.xz' --output "${binutils_tarball}"
101+
wget --no-verbose 'https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz' --output-document="${binutils_tarball}"
70102
tar --directory="$(dirname "${binutils_directory}")" --extract --file="${binutils_tarball}"
103+
104+
patch --directory="${binutils_directory}" --strip='1' --input="${workdir}/patches/0001-Revert-gold-Use-char16_t-char32_t-instead-of-uint16_.patch"
71105
fi
72106

73-
if ! [ -f "${gcc_tarball}" ]; then
74-
curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz' --output "${gcc_tarball}"
75-
tar --directory="$(dirname "${gcc_directory}")" --extract --file="${gcc_tarball}"
76-
fi
77-
78-
sed --in-place 's/LDBL_MANT_DIG == 106/defined(__powerpc64__)/g' "${gcc_directory}/libgcc/dfp-bit.h"
79-
80107
[ -d "${gmp_directory}/build" ] || mkdir "${gmp_directory}/build"
81108

82109
cd "${gmp_directory}/build"
@@ -120,84 +147,46 @@ cd "${mpc_directory}/build"
120147
--enable-shared \
121148
--enable-static \
122149
${cross_compile_flags} \
123-
CFLAGS="${optflags}" \
150+
CFLAGS="${optflags} -fpermissive" \
124151
CXXFLAGS="${optflags}" \
125152
LDFLAGS="${linkflags}"
126153

127154
make all --jobs
128155
make install
129156

130157
declare -ra targets=(
158+
# 'powerpc-unknown-linux-musl'
159+
's390x-unknown-linux-musl'
160+
'powerpc64le-unknown-linux-musl'
161+
# 'mips-unknown-linux-musl'
162+
# 'mipsel-unknown-linux-musl'
131163
'mips64-unknown-linux-musl'
132164
'armv7l-unknown-linux-musleabihf'
133-
'powerpc64le-unknown-linux-musl'
134165
'x86_64-unknown-linux-musl'
135166
'aarch64-unknown-linux-musl'
136167
'arm-unknown-linux-musleabihf'
137168
'riscv64-unknown-linux-musl'
138-
's390x-unknown-linux-musl'
139169
'i386-unknown-linux-musl'
140170
)
141171

142172
for target in "${targets[@]}"; do
143-
source "${current_source_directory}/${target}.sh"
173+
source "${workdir}/${target}.sh"
144174

145175
cd "$(mktemp --directory)"
146176

147-
if [ "${os}" == 'void' ]; then
148-
declare sysroot_filename="./sysroot.tar.xz"
149-
else
150-
declare sysroot_filename="./sysroot.tar.gz"
151-
fi
152-
153-
curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --output "${sysroot_filename}" --url "${sysroot}"
154-
155-
tar --extract --file="${sysroot_filename}" || true
177+
curl \
178+
--url "https://github.com/AmanoTeam/musl-sysroot/releases/latest/download/${triplet}.tar.xz" \
179+
--retry '30' \
180+
--retry-all-errors \
181+
--retry-delay '0' \
182+
--retry-max-time '0' \
183+
--location \
184+
--continue-at '-' \
185+
--output "${sysroot_tarball}"
156186

157-
if [ "${os}" == 'void' ]; then
158-
declare package_filename="./package.tar.xst"
159-
else
160-
declare package_filename="./package.tar.gz"
161-
fi
162-
163-
for package in "${packages[@]}"; do
164-
curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --output "${package_filename}" --url "${package}"
165-
tar --extract --file="${package_filename}"
166-
done
187+
tar --directory="${toolchain_directory}" --extract --file="${sysroot_tarball}"
167188

168-
[ -d "${toolchain_directory}/${triplet}" ] || mkdir --parent "${toolchain_directory}/${triplet}"
169-
170-
cp --recursive './usr/include' "${toolchain_directory}/${triplet}"
171-
cp --recursive './usr/lib' "${toolchain_directory}/${triplet}"
172-
173-
if [ -d './lib' ]; then
174-
cp --remove-destination --recursive './lib/'* "${toolchain_directory}/${triplet}/lib"
175-
fi
176-
177-
pushd "${toolchain_directory}/${triplet}/lib"
178-
179-
if [ "${os}" == 'alpine' ]; then
180-
find . -xtype l | xargs ls -l | grep '/lib/' | awk '{print "unlink "$9" && ln -s $(basename "$11") $(basename "$9")"}' | bash
181-
182-
unlink './libc.so'
183-
mv "${ld}" './libc.so'
184-
185-
patchelf --set-soname 'libc.so' './libc.so'
186-
fi
187-
188-
if [ -L "${ld}" ]; then
189-
unlink "${ld}"
190-
fi
191-
192-
ln --symbolic './libc.so' "${ld}"
193-
194-
while read filename; do
195-
if [[ "${filename}" =~ ^lib(pthread|resolv|rt|c|m|util|xnet)\.(so|a)$ || "${filename}" =~ ^.*\.o$ || "${filename}" =~ ^ld\-.*\.so.*$ ]]; then
196-
continue
197-
fi
198-
199-
rm --recursive "${filename}"
200-
done <<< "$(ls)"
189+
unlink "${sysroot_tarball}"
201190

202191
[ -d "${binutils_directory}/build" ] || mkdir "${binutils_directory}/build"
203192

@@ -218,9 +207,11 @@ for target in "${targets[@]}"; do
218207
CXXFLAGS="${optflags}" \
219208
LDFLAGS="${linkflags}"
220209

221-
make all --jobs="${max_jobs}"
210+
make all --jobs
222211
make install
223212

213+
setup_gcc_source "${triplet}"
214+
224215
[ -d "${gcc_directory}/build" ] || mkdir "${gcc_directory}/build"
225216

226217
cd "${gcc_directory}/build"
@@ -235,7 +226,7 @@ for target in "${targets[@]}"; do
235226
--with-mpc="${toolchain_directory}" \
236227
--with-mpfr="${toolchain_directory}" \
237228
--with-bugurl='https://github.com/AmanoTeam/Raiden/issues' \
238-
--with-pkgversion="Raiden v0.4-${revision}" \
229+
--with-pkgversion="Raiden v0.5-${revision}" \
239230
--with-sysroot="${toolchain_directory}/${triplet}" \
240231
--with-gcc-major-version-only \
241232
--with-native-system-header-dir='/include' \
@@ -285,7 +276,7 @@ for target in "${targets[@]}"; do
285276

286277
for name in *; do
287278
rm "${name}"
288-
ln -s "../../bin/${triplet}-${name}" "${name}"
279+
ln --symbolic "../../bin/${triplet}-${name}" "${name}"
289280
done
290281

291282
rm --recursive "${toolchain_directory}/share"

0 commit comments

Comments
 (0)