Skip to content

Commit 3fbe9fd

Browse files
authored
build: upgrade ci image and add a conan profile tool (#1028)
1 parent 6e4e9df commit 3fbe9fd

90 files changed

Lines changed: 1246 additions & 8515 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actions/bolt-build-base/action.yml‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@ description: 'Executes necessary commands to setup environment for the bolt buil
33
runs:
44
using: "composite"
55
steps:
6-
- name: Setup conan profile
6+
- name: Install Bolt dependencies
77
shell: bash
88
run: |
9-
conan profile detect
10-
cat >> ~/.conan2/profiles/default <<EOF
11-
12-
[conf]
13-
tools.build:exelinkflags=['-fuse-ld=mold', '-Wl,--allow-multiple-definition']
14-
tools.build:sharedlinkflags=['-fuse-ld=mold', '-Wl,--allow-multiple-definition']
15-
EOF
16-
echo "core.download:parallel=1" >> ~/.conan2/global.conf
9+
./scripts/install-bolt-deps.sh
1710
18-
- name: Add CI conan remote
11+
- name: Setup conan profile
1912
shell: bash
2013
run: |
21-
conan remote add --index=0 ci http://conanserver:9300
14+
python3 scripts/configure-conan-profile.py \
15+
--compiler clang \
16+
--libcxx libstdc++11 \
17+
--linker mold \
18+
--lto none && \
19+
echo "core.download:parallel=1" >> ~/.conan2/global.conf
2220
23-
- name: Install Bolt dependencies
21+
- name: Add CI conan remote
2422
shell: bash
2523
run: |
26-
./scripts/install-bolt-deps.sh
24+
conan remote add ci http://conanserver:9300

‎.github/runners/Dockerfile.ci‎

Lines changed: 104 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
FROM gcc:12
22

3-
ENV CMAKE_VERSION=3.31.8
4-
ENV MOLD_VERSION=2.40.4
3+
ENV CMAKE_VERSION=3.31.10
4+
ENV MOLD_VERSION=2.42.1
5+
6+
ARG GCC_VERSION=16.2.0
7+
ARG CLANG_VERSION=22.1.8
8+
ARG TOOLCHAIN_BUILD_DIR=/tmp/toolchain-build
59

610
ARG DEB_REGION=""
711
ARG https_proxy=""
@@ -13,24 +17,16 @@ RUN if [ "$DEB_REGION" != "" ]; then \
1317
fi
1418

1519
RUN apt-get update && \
16-
apt-get install -y \
20+
apt-get install -y --no-install-recommends \
1721
curl \
18-
tar
19-
20-
RUN arch=$(arch) && \
21-
https_proxy=${https_proxy} \
22-
curl -L -# -o /tmp/cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-${arch}.tar.gz && \
23-
tar -xzvf /tmp/cmake.tar.gz -C /opt && \
24-
ln -s /opt/cmake-$CMAKE_VERSION-linux-${arch}/bin/cmake /usr/local/bin/cmake && \
25-
ln -s /opt/cmake-$CMAKE_VERSION-linux-${arch}/bin/ctest /usr/local/bin/ctest && \
26-
rm /tmp/cmake.tar.gz
27-
28-
RUN apt-get update && apt-get install -y \
22+
libgmp-dev \
23+
libmpc-dev \
24+
libmpfr-dev \
25+
wget \
26+
tar \
2927
sudo \
3028
bash \
31-
vim-tiny \
3229
vim \
33-
sudo \
3430
git \
3531
gdb \
3632
python3 \
@@ -39,13 +35,16 @@ RUN apt-get update && apt-get install -y \
3935
ssh-client \
4036
ninja-build \
4137
bison \
38+
flex \
39+
gawk \
40+
bzip2 \
41+
xz-utils \
4242
maven \
4343
net-tools \
4444
telnet \
4545
ssh \
4646
rsync \
4747
openssh-server \
48-
lld \
4948
ccache \
5049
binutils-dev \
5150
make \
@@ -62,17 +61,99 @@ RUN apt-get update && apt-get install -y \
6261

6362
RUN ln -sf /bin/bash /bin/sh
6463

65-
RUN https_proxy=${https_proxy} curl -L -O --output-dir /tmp https://github.com/rui314/mold/releases/download/v$MOLD_VERSION/mold-$MOLD_VERSION-$(arch)-linux.tar.gz
66-
RUN cd /tmp && \
67-
sudo tar -C /usr/local --strip-components=1 -xzf mold-$MOLD_VERSION-$(arch)-linux.tar.gz
64+
# Replace the base image's GCC in /usr/local, including static and shared libraries.
65+
RUN set -eux; \
66+
mkdir -p "${TOOLCHAIN_BUILD_DIR}"; \
67+
cd "${TOOLCHAIN_BUILD_DIR}"; \
68+
wget --progress=dot:mega \
69+
"https://mirrors.aliyun.com/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.gz"; \
70+
tar -xzf "gcc-${GCC_VERSION}.tar.gz"; \
71+
mkdir -p "${TOOLCHAIN_BUILD_DIR}/gcc-build-${GCC_VERSION}"; \
72+
cd "${TOOLCHAIN_BUILD_DIR}/gcc-build-${GCC_VERSION}"; \
73+
"${TOOLCHAIN_BUILD_DIR}/gcc-${GCC_VERSION}/configure" \
74+
--prefix=/usr/local \
75+
--libdir=/usr/local/lib64 \
76+
--enable-languages=c,c++ \
77+
--enable-static \
78+
--enable-shared \
79+
--disable-checking \
80+
--disable-multilib; \
81+
make -j "$(nproc)" || { \
82+
find . -path '*/libatomic/config.log' -exec tail -n 300 {} \;; \
83+
exit 1; \
84+
}; \
85+
make install-strip; \
86+
ln -sf /usr/local/bin/gcc /usr/local/bin/gcc-16; \
87+
ln -sf /usr/local/bin/g++ /usr/local/bin/g++-16; \
88+
system_libdir="/lib/$(arch)-linux-gnu"; \
89+
cp -a --remove-destination /usr/local/lib64/libstdc++.so* "${system_libdir}/"; \
90+
cp -a --remove-destination /usr/local/lib64/libgcc_s.so* "${system_libdir}/"; \
91+
ldconfig; \
92+
gcc-16 --version; \
93+
g++-16 --version; \
94+
rm -rf "${TOOLCHAIN_BUILD_DIR:?}"/*
95+
96+
RUN arch=$(arch) && \
97+
https_proxy=${https_proxy} \
98+
curl -L -# -o /tmp/cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-${arch}.tar.gz && \
99+
tar -xzvf /tmp/cmake.tar.gz -C /opt && \
100+
ln -s /opt/cmake-$CMAKE_VERSION-linux-${arch}/bin/cmake /usr/local/bin/cmake && \
101+
ln -s /opt/cmake-$CMAKE_VERSION-linux-${arch}/bin/ctest /usr/local/bin/ctest && \
102+
rm /tmp/cmake.tar.gz
103+
104+
# Install Clang 22 and the CI tools that are distributed with LLVM.
105+
# and replace system's ld to avoid llvm-core building errors
106+
COPY assets/patches/llvm-pr220492.patch /tmp/llvm-pr220492.patch
107+
RUN set -eux; \
108+
mkdir -p "${TOOLCHAIN_BUILD_DIR}"; \
109+
cd "${TOOLCHAIN_BUILD_DIR}"; \
110+
wget --progress=dot:mega -O "llvm-project-${CLANG_VERSION}.tar.gz" \
111+
"https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${CLANG_VERSION}.tar.gz"; \
112+
tar -xzf "llvm-project-${CLANG_VERSION}.tar.gz"; \
113+
cd "llvm-project-llvmorg-${CLANG_VERSION}"; \
114+
git apply --check /tmp/llvm-pr220492.patch; \
115+
git apply /tmp/llvm-pr220492.patch; \
116+
rm /tmp/llvm-pr220492.patch; \
117+
cd "${TOOLCHAIN_BUILD_DIR}"; \
118+
cmake -S "llvm-project-llvmorg-${CLANG_VERSION}/llvm" -B llvm-build -G Ninja \
119+
-DCMAKE_BUILD_TYPE=Release \
120+
-DCMAKE_INSTALL_PREFIX="/opt/clang-${CLANG_VERSION}" \
121+
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld" \
122+
-DLLVM_DISTRIBUTION_COMPONENTS="clang;clang-resource-headers;clang-tidy;lld;llvm-ar;llvm-ranlib" \
123+
-DLLVM_BUILD_TESTS=OFF \
124+
-DLLVM_INCLUDE_TESTS=OFF \
125+
-DLLVM_BUILD_DOCS=OFF \
126+
-DLLVM_INCLUDE_DOCS=OFF \
127+
-DLLVM_BUILD_EXAMPLES=OFF \
128+
-DLLVM_INCLUDE_EXAMPLES=OFF; \
129+
cmake --build llvm-build --target install-distribution-stripped \
130+
--parallel "$(nproc)"; \
131+
ln -sf "/opt/clang-${CLANG_VERSION}/bin/clang" /usr/local/bin/clang-22; \
132+
ln -sf "/opt/clang-${CLANG_VERSION}/bin/clang++" /usr/local/bin/clang++-22; \
133+
clang-22 --version; \
134+
clang++-22 --version; \
135+
/opt/clang-${CLANG_VERSION}/bin/clang-tidy --version; \
136+
/opt/clang-${CLANG_VERSION}/bin/ld.lld --version; \
137+
ln -sf /opt/clang-${CLANG_VERSION}/bin/ld.lld $(which ld); \
138+
test -x "/opt/clang-${CLANG_VERSION}/bin/llvm-ar"; \
139+
test -x "/opt/clang-${CLANG_VERSION}/bin/llvm-ranlib"; \
140+
rm -rf "${TOOLCHAIN_BUILD_DIR:?}"/*
141+
142+
ENV PATH="/opt/clang-${CLANG_VERSION}/bin:${PATH}"
143+
144+
RUN set -eux; \
145+
mold_archive="/tmp/mold-${MOLD_VERSION}-$(arch)-linux.tar.gz"; \
146+
https_proxy=${https_proxy} curl -fL -o "${mold_archive}" \
147+
"https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-$(arch)-linux.tar.gz"; \
148+
tar -C /usr/local --strip-components=1 -xzf "${mold_archive}"; \
149+
rm "${mold_archive}"
68150

69-
# Add mold's ld as the first on the path
70-
env PATH=/usr/local/libexec/mold:$PATH
71151

72152
# License header check tool
73153
RUN https_proxy=${https_proxy} curl -L -# -o /tmp/skywalking-eyes-bin.tgz https://dlcdn.apache.org/skywalking/eyes/0.8.0/skywalking-license-eye-0.8.0-bin.tgz && \
74154
mkdir -p /opt/skywalking-license-eye && \
75-
sudo tar -C /opt/skywalking-license-eye --strip-components=1 -xzf /tmp/skywalking-eyes-bin.tgz
155+
sudo tar -C /opt/skywalking-license-eye --strip-components=1 -xzf /tmp/skywalking-eyes-bin.tgz && \
156+
rm /tmp/skywalking-eyes-bin.tgz
76157

77158
ENV PATH="/opt/skywalking-license-eye/bin/linux:${PATH}"
78159

@@ -102,31 +183,6 @@ RUN groupadd --gid $USER_GID $USERNAME \
102183

103184
USER $USERNAME
104185

105-
RUN conan profile detect && \
106-
sed -i 's/gnu14/gnu17/g' ~/.conan2/profiles/default
107-
108-
# Configure default conan profile to use the mold linker
109-
RUN cat >> ~/.conan2/profiles/default <<EOF
110-
111-
[conf]
112-
tools.build:exelinkflags=['-fuse-ld=mold', '-Wl,--allow-multiple-definition']
113-
tools.build:sharedlinkflags=['-fuse-ld=mold', '-Wl,--allow-multiple-definition']
114-
EOF
115-
116-
RUN cat > ~/.conan2/profiles/clang-profile <<EOF
117-
[settings]
118-
arch=$( [ "$arch" = "aarch64" ] && echo "armv8" || echo "$arch" )
119-
build_type=Release
120-
compiler=clang
121-
compiler.cppstd=17
122-
compiler.libcxx=libstdc++11
123-
compiler.version=16
124-
os=Linux
125-
126-
[conf]
127-
tools.build:compiler_executables={"c": "clang", "cpp": "clang++"}
128-
EOF
129-
130186
# Generate Locales
131187
RUN sudo sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen && \
132188
sudo locale-gen && \
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Fangrui Song <i@maskray.me>
3+
Date: Tue, 1 Sep 2026 21:47:49 -0700
4+
Subject: [PATCH] [ELF] Omit zero-range FDEs from .eh_frame_hdr
5+
6+
Semantic backport of https://github.com/llvm/llvm-project/pull/220492 to
7+
llvmorg-22.1.8. LLVM 22 builds the search table in EhFrameSection::writeTo,
8+
before the upstream code moved it to EhFrameHeader::updateAllocSize.
9+
10+
--- a/lld/ELF/EhFrame.cpp
11+
+++ b/lld/ELF/EhFrame.cpp
12+
@@ -139,6 +139,16 @@
13+
return EhReader(p.sec, p.data()).hasLSDA();
14+
}
15+
16+
+// pc_range follows the 4-byte length, 4-byte CIE pointer, and pc_begin, and
17+
+// uses pc_begin's encoding.
18+
+bool elf::hasZeroPcRange(Ctx &ctx, const EhSectionPiece &p, uint8_t enc) {
19+
+ size_t pSize = getAugPSize(ctx, enc);
20+
+ ArrayRef<uint8_t> d = p.data();
21+
+ if (pSize == 0 || d.size() < 8 + 2 * pSize)
22+
+ return false;
23+
+ return llvm::all_of(d.slice(8 + pSize, pSize), [](uint8_t c) { return !c; });
24+
+}
25+
+
26+
StringRef EhReader::getAugmentation() {
27+
skipBytes(8);
28+
int version = readByte();
29+
--- a/lld/ELF/EhFrame.h
30+
+++ b/lld/ELF/EhFrame.h
31+
@@ -12,10 +12,12 @@
32+
#include "lld/Common/LLVM.h"
33+
34+
namespace lld::elf {
35+
+struct Ctx;
36+
struct EhSectionPiece;
37+
38+
uint8_t getFdeEncoding(EhSectionPiece *p);
39+
bool hasLSDA(const EhSectionPiece &p);
40+
+bool hasZeroPcRange(Ctx &ctx, const EhSectionPiece &p, uint8_t enc);
41+
}
42+
43+
#endif
44+
--- a/lld/ELF/SyntheticSections.cpp
45+
+++ b/lld/ELF/SyntheticSections.cpp
46+
@@ -611,6 +611,10 @@
47+
for (CieRecord *rec : cieRecords) {
48+
uint8_t enc = getFdeEncoding(rec->cie);
49+
for (EhSectionPiece *fde : rec->fdes) {
50+
+ // Discard zero-range FDE, otherwise it would displace the FDE of the
51+
+ // next function, which shares its address.
52+
+ if (hasZeroPcRange(ctx, *fde, enc))
53+
+ continue;
54+
uint64_t pc = getFdePc(buf, fde->outputOff, enc);
55+
uint64_t fdeVA = getParent()->addr + fde->outputOff;
56+
if (!isInt<32>(pc - va)) {
57+
@@ -652,6 +656,14 @@
58+
}
59+
}
60+
61+
+size_t EhFrameSection::getNumFdesForHeader() const {
62+
+ size_t count = 0;
63+
+ for (CieRecord *rec : cieRecords)
64+
+ for (EhSectionPiece *fde : rec->fdes)
65+
+ count += !hasZeroPcRange(ctx, *fde, getFdeEncoding(rec->cie));
66+
+ return count;
67+
+}
68+
+
69+
EhFrameHeader::EhFrameHeader(Ctx &ctx)
70+
: SyntheticSection(ctx, ".eh_frame_hdr", SHT_PROGBITS, SHF_ALLOC, 4) {}
71+
72+
@@ -661,7 +673,7 @@
73+
74+
size_t EhFrameHeader::getSize() const {
75+
// .eh_frame_hdr has a 12 bytes header followed by an array of FDEs.
76+
- return 12 + getPartition(ctx).ehFrame->numFdes * 8;
77+
+ return 12 + getPartition(ctx).ehFrame->getNumFdesForHeader() * 8;
78+
}
79+
80+
bool EhFrameHeader::isNeeded() const {
81+
--- a/lld/ELF/SyntheticSections.h
82+
+++ b/lld/ELF/SyntheticSections.h
83+
@@ -55,6 +55,7 @@
84+
void finalizeContents() override;
85+
bool isNeeded() const override { return !sections.empty(); }
86+
size_t getSize() const override { return size; }
87+
+ size_t getNumFdesForHeader() const;
88+
89+
static bool classof(const SectionBase *d) {
90+
return SyntheticSection::classof(d) && d->name == ".eh_frame";

‎.github/runners/docker-compose.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
build:
44
context: .
55
dockerfile: Dockerfile.ci
6-
image: localhost:5000/bolt-ci:20260114
6+
image: localhost:5000/bolt-ci:20260921
77
command: ["/bin/bash", "-c", "Bolt CI Image"]
88
conan_server:
99
build:
@@ -27,7 +27,7 @@ services:
2727
- >-
2828
wget -q --spider
2929
--header='Accept: application/vnd.oci.image.index.v1+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v2+json'
30-
http://localhost:5000/v2/bolt-ci/manifests/20260114 &&
30+
http://localhost:5000/v2/bolt-ci/manifests/20260921 &&
3131
wget -q --spider
3232
--header='Accept: application/vnd.oci.image.index.v1+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v2+json'
3333
http://localhost:5000/v2/conan-server/manifests/latest

‎.github/workflows/build-main.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
if: ${{ needs.changes.outputs.source_code == 'true' }}
6161
runs-on: [ self-hosted, medium ]
6262
container:
63-
image: bolt-registry:5000/bolt-ci:20260114
63+
image: bolt-registry:5000/bolt-ci:20260921
6464
volumes:
6565
- /data/ccache-data:/data/ccache-data
6666
options: --user root --init

0 commit comments

Comments
 (0)