Skip to content

Commit c890dd6

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

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

Diff for: src/ci/docker/host-x86_64/x86_64-gnu-llvm-15/Dockerfile

+3-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,8 @@ 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+
$USE_NEW_MANGLING \
55+
--set rust.thin-lto-import-instr-limit=10
5856

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

Diff for: src/ci/docker/run.sh

+14-1
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,24 @@ fi
267267
SUMMARY_FILE=github-summary.md
268268
touch $objdir/${SUMMARY_FILE}
269269

270+
extra_env=""
271+
if [ "$ENABLE_GCC_CODEGEN" = "1" ]; then
272+
extra_env="$EXTRA_ENV --env ENABLE_GCC_CODEGEN=1"
273+
# If `ENABLE_GCC_CODEGEN` is set and not empty, we add the `--enable-new-symbol-mangling`
274+
# argument to `RUST_CONFIGURE_ARGS` and set the `GCC_EXEC_PREFIX` environment variable.
275+
# `cg_gcc` doesn't support the legacy mangling so we need to enforce the new one
276+
# if we run `cg_gcc` tests.
277+
extra_env="$EXTRA_ENV --env USE_NEW_MANGLING=--enable-new-symbol-mangling"
278+
# Fix rustc_codegen_gcc lto issues.
279+
extra_env="$EXTRA_ENV --env GCC_EXEC_PREFIX=/usr/lib/gcc/"
280+
echo "Setting extra environment values for docker: $extra_env"
281+
fi
282+
270283
docker \
271284
run \
272285
--workdir /checkout/obj \
273286
--env SRC=/checkout \
274-
--env "ENABLE_GCC_CODEGEN=$ENABLE_GCC_CODEGEN" \
287+
$extra_env \
275288
$args \
276289
--env CARGO_HOME=/cargo \
277290
--env DEPLOY \

0 commit comments

Comments
 (0)