@@ -35,10 +35,8 @@ RUN curl -sL "https://github.com/PowerShell/PowerShell/releases/download/v7.3.1/
3535COPY scripts/sccache.sh /scripts/
3636RUN sh /scripts/sccache.sh
3737
38- # Make `libgccjit.so` accessible.
38+ # Make `libgccjit.so` accessible to the linker .
3939RUN 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.
@@ -48,13 +46,21 @@ ENV NO_DOWNLOAD_CI_LLVM 1
4846# be missing.
4947ENV IS_NOT_LATEST_LLVM 1
5048
49+ # If `ENABLE_GCC_CODEGEN` is set and not empty, we add the `--enable-new-symbol-mangling`
50+ # argument to `RUST_CONFIGURE_ARGS` and set the `GCC_EXEC_PREFIX` environment variable.
51+ # `cg_gcc` doesn't support the legacy mangling so we need to enforce the new one
52+ # if we run `cg_gcc` tests.
53+ ENV USE_NEW_MANGLING ${ENABLE_GCC_CODEGEN:+ --enable-new-symbol-mangling}
54+ # Fix rustc_codegen_gcc lto issues.
55+ ENV GCC_EXEC_PREFIX ${ENABLE_GCC_CODEGEN:+/usr/lib/gcc/}
56+
5157# Using llvm-link-shared due to libffi issues -- see #34486
5258ENV RUST_CONFIGURE_ARGS \
5359 --build=x86_64-unknown-linux-gnu \
5460 --llvm-root=/usr/lib/llvm-15 \
5561 --enable-llvm-link-shared \
56- --set rust.thin-lto-import-instr-limit=10 \
57- --enable-new-symbol-mangling
62+ $USE_NEW_MANGLING \
63+ --set rust.thin-lto-import-instr-limit=10
5864
5965COPY host-x86_64/x86_64-gnu-llvm-15/script.sh /tmp/
6066
0 commit comments