Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b998812

Browse files
committedDec 25, 2024
Add LTO support to clang in CI
1 parent 4f4d620 commit b998812

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
 

‎src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ RUN mkdir -p /rustroot/bin
4444
ENV PATH=/rustroot/bin:$PATH
4545
ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib32:/rustroot/lib
4646
ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
47+
# Clang needs to access GCC headers to enable linker plugin LTO
48+
ENV GCC_VERSION=9.5.0
4749
WORKDIR /tmp
4850
RUN mkdir /home/user
4951
COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
@@ -104,3 +106,7 @@ ENV DIST_SRC 1
104106
ENV LIBCURL_NO_PKG_CONFIG 1
105107

106108
ENV DIST_REQUIRE_ALL_TOOLS 1
109+
110+
# FIXME: Without this, LLVMgold.so incorrectly resolves to the system
111+
# libstdc++, instead of the one we build.
112+
ENV LD_PRELOAD=/rustroot/lib64/libstdc++.so.6

‎src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ hide_output \
3939
-DLLVM_INCLUDE_TESTS=OFF \
4040
-DLLVM_INCLUDE_EXAMPLES=OFF \
4141
-DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt;bolt" \
42+
-DLLVM_BINUTILS_INCDIR="/rustroot/lib/gcc/x86_64-pc-linux-gnu/$GCC_VERSION/plugin/include/" \
4243
-DC_INCLUDE_DIRS="$INC"
4344

4445
hide_output make -j$(nproc)

‎src/ci/docker/host-x86_64/dist-x86_64-linux/build-gcc.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env bash
2-
set -ex
2+
set -eux
33

44
source shared.sh
55

66
# Note: in the future when bumping to version 10.1.0, also take care of the sed block below.
7-
GCC=9.5.0
7+
# This version is specified in the Dockerfile
8+
GCC=$GCC_VERSION
89

910
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.xz | xzcat | tar xf -
1011
cd gcc-$GCC

0 commit comments

Comments
 (0)
Failed to load comments.