Skip to content

Commit 8d85c03

Browse files
Set some environment variables value only if ENABLE_GCC_CODEGEN is set
1 parent 30a0709 commit 8d85c03

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/ci/docker/host-x86_64/x86_64-gnu-llvm-15/Dockerfile

+2-5
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ RUN curl -sL "https://github.com/PowerShell/PowerShell/releases/download/v7.3.1/
3535
COPY scripts/sccache.sh /scripts/
3636
RUN sh /scripts/sccache.sh
3737

38-
# Make `libgccjit.so` accessible.
38+
# Make `libgccjit.so` accessible to the linker.
3939
RUN ln -s /usr/lib/gcc/x86_64-linux-gnu/12/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so
40-
# Fix rustc_codegen_gcc lto issues.
41-
ENV GCC_EXEC_PREFIX="/usr/lib/gcc/"
4240

4341
# We are disabling CI LLVM since this builder is intentionally using a host
4442
# LLVM, rather than the typical src/llvm-project LLVM.
@@ -53,8 +51,7 @@ ENV RUST_CONFIGURE_ARGS \
5351
--build=x86_64-unknown-linux-gnu \
5452
--llvm-root=/usr/lib/llvm-15 \
5553
--enable-llvm-link-shared \
56-
--set rust.thin-lto-import-instr-limit=10 \
57-
--enable-new-symbol-mangling
54+
--set rust.thin-lto-import-instr-limit=10
5855

5956
COPY host-x86_64/x86_64-gnu-llvm-15/script.sh /tmp/
6057

src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,20 @@ ENV NO_DOWNLOAD_CI_LLVM 1
4242
# be missing.
4343
ENV IS_NOT_LATEST_LLVM 1
4444

45+
# If `ENABLE_GCC_CODEGEN` is set and not empty, we add the `--enable-new-symbol-mangling`
46+
# argument to `RUST_CONFIGURE_ARGS` and set the `GCC_EXEC_PREFIX` environment variable.
47+
# `cg_gcc` doesn't support the legacy mangling so we need to enforce the new one
48+
# if we run `cg_gcc` tests.
49+
ENV USE_NEW_MANGLING ${ENABLE_GCC_CODEGEN:+ --enable-new-symbol-mangling}
50+
# Fix rustc_codegen_gcc lto issues.
51+
ENV GCC_EXEC_PREFIX ${ENABLE_GCC_CODEGEN:+/usr/lib/gcc/}
52+
4553
# Using llvm-link-shared due to libffi issues -- see #34486
4654
ENV RUST_CONFIGURE_ARGS \
4755
--build=x86_64-unknown-linux-gnu \
4856
--llvm-root=/usr/lib/llvm-16 \
4957
--enable-llvm-link-shared \
58+
$USE_NEW_MANGLING \
5059
--set rust.thin-lto-import-instr-limit=10
5160

5261
COPY host-x86_64/x86_64-gnu-llvm-15/script.sh /tmp/

0 commit comments

Comments
 (0)