Skip to content

Commit 283d51c

Browse files
committed
Remove all PGO and LTO-related logic
1 parent fc3ad0b commit 283d51c

2 files changed

Lines changed: 34 additions & 77 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
id: check-cache
1818
uses: actions/cache@main
1919
with:
20-
key: gcc-15.2.0-2
20+
key: gcc-15.2.0-3
2121
lookup-only: true
2222
path: |
2323
/tmp/x86_64-linux-gnu.tar.xz
@@ -26,34 +26,20 @@ jobs:
2626
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
2727
run: |
2828
bash './build.sh' 'native'
29-
- name: Package profiling data
30-
run: |
31-
tar --directory='/tmp' --create --file=- 'profile-guided' | xz --threads='0' --compress -9 > '/tmp/profiling.tar.xz'
3229
- name: Generate tarball
3330
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
3431
run: |
3532
declare tarball_filename='/tmp/x86_64-linux-gnu.tar.xz'
3633
tar --directory='/tmp' --create --file=- 'obggcc' | xz --threads='0' --extreme --memlimit-compress='100%' --compress -9 > "${tarball_filename}"
3734
sha256sum "${tarball_filename}" | sed 's|/tmp/||' > "${tarball_filename}.sha256"
38-
- name: Upload artifact
39-
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
40-
uses: actions/upload-artifact@main
41-
with:
42-
name: native-toolchain
43-
if-no-files-found: error
44-
path: |
45-
/tmp/x86_64-linux-gnu.tar.xz
46-
/tmp/x86_64-linux-gnu.tar.xz.sha256
47-
/tmp/profiling.tar.xz
4835
- name: Cache artifact
4936
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
5037
uses: actions/cache@main
5138
with:
52-
key: gcc-15.2.0-2
39+
key: gcc-15.2.0-3
5340
path: |
5441
/tmp/x86_64-linux-gnu.tar.xz
5542
/tmp/x86_64-linux-gnu.tar.xz.sha256
56-
/tmp/profiling.tar.xz
5743
5844
cross-build:
5945
name: 'Cross build'
@@ -116,19 +102,15 @@ jobs:
116102
- name: Restore from cache
117103
uses: actions/cache@main
118104
with:
119-
key: gcc-15.2.0-2
105+
key: gcc-15.2.0-3
120106
fail-on-cache-miss: true
121107
path: |
122108
/tmp/x86_64-linux-gnu.tar.xz
123109
/tmp/x86_64-linux-gnu.tar.xz.sha256
124-
/tmp/profiling.tar.xz
125110
- name: Setup toolchain
126111
run: |
127112
tar --directory='/tmp' --extract --file='/tmp/x86_64-linux-gnu.tar.xz'
128113
mv '/tmp/obggcc' '/tmp/obggcc-toolchain'
129-
- name: Setup profiling data
130-
run: |
131-
tar --directory='/tmp' --extract --file='/tmp/profiling.tar.xz'
132114
- name: Cross-compile OBGGCC to ${{ matrix.target }}
133115
run: |
134116
source './tools/setup_toolchain.sh'

build.sh

Lines changed: 31 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,13 @@ declare -r gdb_directory='/tmp/gdb'
4242
declare -r nz_tarball='/tmp/nz.tar.xz'
4343
declare nz_directory=""
4444

45-
declare -r profile_sampling_directory='/tmp/profile-sampling'
46-
declare -r profile_guided_directory='/tmp/profile-guided'
47-
4845
declare -r zstd_tarball='/tmp/zstd.tar.gz'
4946
declare -r zstd_directory='/tmp/zstd-dev'
5047

5148
declare -r pieflags='-fPIE'
5249
declare -r ccflags='-w -O2'
5350
declare -r linkflags='-Xlinker -s'
5451

55-
declare lto_partition='none'
56-
5752
declare -r max_jobs='40'
5853

5954
declare -r sysroot_tarball='/tmp/sysroot.tar.xz'
@@ -137,14 +132,14 @@ declare -ra deprecated_targets=(
137132
'sparc-unknown-linux-gnu'
138133
'alpha-unknown-linux-gnu'
139134
'hppa-unknown-linux-gnu'
140-
'arm-unknown-linux-gnueabi'
141135
)
142136

143137
declare -ra targets=(
144138
'x86_64-unknown-linux-gnu'
145-
# 'aarch64-unknown-linux-gnu'
146-
# 'arm-unknown-linux-gnueabihf'
147-
# 'i386-unknown-linux-gnu'
139+
'aarch64-unknown-linux-gnu'
140+
'arm-unknown-linux-gnueabi'
141+
'arm-unknown-linux-gnueabihf'
142+
'i386-unknown-linux-gnu'
148143
)
149144

150145
declare -r PKG_CONFIG_PATH="${toolchain_directory}/lib/pkgconfig"
@@ -189,34 +184,6 @@ declare -r \
189184
build_type \
190185
is_native
191186

192-
declare -r profiling_generate="-fprofile-generate=${profile_sampling_directory} -fprofile-dir=${profile_sampling_directory} -fprofile-update=atomic"
193-
declare -r profiling_generate_link="-fprofile-generate"
194-
195-
declare -r profiling_use="-fprofile-use=${profile_guided_directory} -fprofile-dir=${profile_guided_directory}"
196-
197-
if (( is_native )); then
198-
declare -r profiling_cflags="${profiling_generate}"
199-
declare -r profiling_ldflags="${profiling_generate_link}"
200-
elif [ "${build_type}" = 'x86_64-unknown-linux-gnu' ]; then
201-
declare -r profiling_cflags="${profiling_use}"
202-
declare -r profiling_ldflags=''
203-
else
204-
declare -r profiling_cflags=''
205-
declare -r profiling_ldflags=''
206-
fi
207-
208-
if [[ "${build_type}" = 'arm'* ]]; then
209-
lto_partition='balanced'
210-
fi
211-
212-
if [[ "${build_type}" = *'openbsd' ]]; then
213-
declare -r ltoflags=''
214-
declare -r ltolinkflags=''
215-
else
216-
declare -r ltoflags="-flto=auto -fno-fat-lto-objects -flto-partition=${lto_partition} -flto-compression-level=0 -fdevirtualize-at-ltrans -fuse-linker-plugin"
217-
declare -r ltolinkflags='-flto'
218-
fi
219-
220187
if ! [ -f "${gmp_tarball}" ]; then
221188
curl \
222189
--url 'https://mirrors.kernel.org/gnu/gmp/gmp-6.3.0.tar.xz' \
@@ -395,9 +362,9 @@ rm --force --recursive ./*
395362
--prefix="${toolchain_directory}" \
396363
--enable-shared \
397364
--disable-static \
398-
CFLAGS="${ccflags} ${ltoflags}" \
399-
CXXFLAGS="${ccflags} ${ltoflags}" \
400-
LDFLAGS="${linkflags} ${ltolinkflags}"
365+
CFLAGS="${ccflags}" \
366+
CXXFLAGS="${ccflags}" \
367+
LDFLAGS="${linkflags}"
401368

402369
make all --jobs
403370
make install
@@ -413,9 +380,9 @@ rm --force --recursive ./*
413380
--with-gmp="${toolchain_directory}" \
414381
--enable-shared \
415382
--disable-static \
416-
CFLAGS="${ccflags} ${ltoflags}" \
417-
CXXFLAGS="${ccflags} ${ltoflags}" \
418-
LDFLAGS="${linkflags} ${ltolinkflags}"
383+
CFLAGS="${ccflags}" \
384+
CXXFLAGS="${ccflags}" \
385+
LDFLAGS="${linkflags}"
419386

420387
make all --jobs
421388
make install
@@ -431,9 +398,9 @@ rm --force --recursive ./*
431398
--with-gmp="${toolchain_directory}" \
432399
--enable-shared \
433400
--disable-static \
434-
CFLAGS="${ccflags} ${ltoflags}" \
435-
CXXFLAGS="${ccflags} ${ltoflags}" \
436-
LDFLAGS="${linkflags} ${ltolinkflags}"
401+
CFLAGS="${ccflags}" \
402+
CXXFLAGS="${ccflags}" \
403+
LDFLAGS="${linkflags}"
437404

438405
make all --jobs
439406
make install
@@ -449,9 +416,9 @@ rm --force --recursive ./*
449416
--with-gmp-prefix="${toolchain_directory}" \
450417
--enable-shared \
451418
--disable-static \
452-
CFLAGS="${pieflags} ${ccflags} ${ltoflags}" \
453-
CXXFLAGS="${pieflags} ${ccflags} ${ltoflags}" \
454-
LDFLAGS="-Xlinker -rpath-link -Xlinker ${toolchain_directory}/lib ${linkflags} ${ltolinkflags}"
419+
CFLAGS="${pieflags} ${ccflags}" \
420+
CXXFLAGS="${pieflags} ${ccflags}" \
421+
LDFLAGS="-Xlinker -rpath-link -Xlinker ${toolchain_directory}/lib ${linkflags}"
455422

456423
make all --jobs
457424
make install
@@ -556,9 +523,9 @@ for target in "${targets[@]}"; do
556523
--with-sysroot="${toolchain_directory}/${triplet}" \
557524
--without-static-standard-libraries \
558525
--with-zstd="${toolchain_directory}" \
559-
CFLAGS="${ccflags} ${ltoflags}" \
560-
CXXFLAGS="${ccflags} ${ltoflags}" \
561-
LDFLAGS="${linkflags} ${ltolinkflags}"
526+
CFLAGS="${ccflags}" \
527+
CXXFLAGS="${ccflags}" \
528+
LDFLAGS="${linkflags}"
562529

563530
make all --jobs
564531
make install
@@ -594,7 +561,7 @@ for target in "${targets[@]}"; do
594561
--with-zstd="${toolchain_directory}" \
595562
--with-bugurl='https://github.com/AmanoTeam/obggcc/issues' \
596563
--with-gcc-major-version-only \
597-
--with-pkgversion="OBGGCC v3.3-${revision}" \
564+
--with-pkgversion="OBGGCC v3.4-${revision}" \
598565
--with-sysroot="${toolchain_directory}/${triplet}" \
599566
--with-native-system-header-dir='/include' \
600567
--with-default-libstdcxx-abi='new' \
@@ -637,9 +604,9 @@ for target in "${targets[@]}"; do
637604
--without-headers \
638605
--without-static-standard-libraries \
639606
${extra_configure_flags} \
640-
CFLAGS="${ccflags} ${ltoflags} ${profiling_cflags}" \
641-
CXXFLAGS="${ccflags} ${ltoflags} ${profiling_cflags}" \
642-
LDFLAGS="${linkflags} ${ltolinkflags} ${profiling_ldflags}"
607+
CFLAGS="${ccflags}" \
608+
CXXFLAGS="${ccflags}" \
609+
LDFLAGS="${linkflags}"
643610

644611
cflags_for_target="${ccflags} ${linkflags}"
645612
cxxflags_for_target="${ccflags} ${linkflags}"
@@ -947,3 +914,11 @@ done
947914
mkdir --parent "${share_directory}"
948915

949916
cp --recursive "${workdir}/tools/dev/"* "${share_directory}"
917+
918+
[ -d "${toolchain_directory}/build" ] || mkdir "${toolchain_directory}/build"
919+
920+
ln \
921+
--symbolic \
922+
--relative \
923+
"${share_directory}/"* \
924+
"${toolchain_directory}/build"

0 commit comments

Comments
 (0)