Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/base/windows_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub(crate) fn opts() -> TargetOptions {
emit_debug_gdb_scripts: false,
requires_uwtable: true,
eh_frame_header: false,
has_thread_local: true,
debuginfo_kind: DebuginfoKind::Dwarf,
// FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
// output DWO, despite using DWARF, doesn't use ELF..
Expand Down
100 changes: 51 additions & 49 deletions src/ci/scripts/install-mingw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,44 @@ IFS=$'\n\t'
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"

MINGW_ARCHIVE_32="i686-14.1.0-release-posix-dwarf-msvcrt-rt_v12-rev0.7z"
MINGW_ARCHIVE_64="x86_64-14.1.0-release-posix-seh-msvcrt-rt_v12-rev0.7z"
MINGW_ARCHIVE_64="x86_64-14.2.0-release-posix-seh-msvcrt-rt_v12-rev2.7z"
LLVM_MINGW_ARCHIVE_AARCH64="llvm-mingw-20251104-ucrt-aarch64.zip"
LLVM_MINGW_ARCHIVE_X86_64="llvm-mingw-20251104-ucrt-x86_64.zip"

if isWindows && isKnownToBeMingwBuild; then
case "${CI_JOB_NAME}" in
*aarch64-llvm*)
mingw_dir="clangarm64"
mingw_archive="${LLVM_MINGW_ARCHIVE_AARCH64}"
arch="aarch64"
# Rustup defaults to AArch64 MSVC which has a hard time building Ring crate
# for citool. MSVC jobs install special Clang build to solve that, but here
# it would be an overkill. So we just use toolchain that doesn't have this
# issue.
rustup default stable-aarch64-pc-windows-gnullvm
;;
*x86_64-llvm*)
mingw_dir="clang64"
mingw_archive="${LLVM_MINGW_ARCHIVE_X86_64}"
arch="x86_64"
;;
*i686*)
mingw_dir="mingw32"
mingw_archive="${MINGW_ARCHIVE_32}"
;;
*x86_64*)
mingw_dir="mingw64"
mingw_archive="${MINGW_ARCHIVE_64}"
;;
*aarch64*)
echo "AArch64 Windows is not supported by GNU tools"
exit 1
;;
*)
echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
echo "please tweak it to recognize the builder named '${CI_JOB_NAME}'"
exit 1
;;
*aarch64-llvm*)
mingw_dir="clangarm64"
mingw_archive="${LLVM_MINGW_ARCHIVE_AARCH64}"
arch="aarch64"
# Rustup defaults to AArch64 MSVC which has a hard time building Ring crate
# for citool. MSVC jobs install special Clang build to solve that, but here
# it would be an overkill. So we just use toolchain that doesn't have this
# issue.
rustup default stable-aarch64-pc-windows-gnullvm
;;
*x86_64-llvm*)
mingw_dir="clang64"
mingw_archive="${LLVM_MINGW_ARCHIVE_X86_64}"
arch="x86_64"
;;
*i686*)
mingw_dir="mingw32"
mingw_archive="${MINGW_ARCHIVE_32}"
;;
*x86_64*)
mingw_dir="mingw64"
mingw_archive="${MINGW_ARCHIVE_64}"
;;
*aarch64*)
echo "AArch64 Windows is not supported by GNU tools"
exit 1
;;
*)
echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
echo "please tweak it to recognize the builder named '${CI_JOB_NAME}'"
exit 1
;;
esac

# Stop /msys64/bin from being prepended to PATH by adding the bin directory manually.
Expand All @@ -54,22 +54,24 @@ if isWindows && isKnownToBeMingwBuild; then
ciCommandAddPath "${msys2Path}/usr/bin"

case "${mingw_archive}" in
*.7z)
curl -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
7z x -y mingw.7z > /dev/null
;;
*.zip)
curl -o mingw.zip "${MIRRORS_BASE}/${mingw_archive}"
unzip -q mingw.zip
mv llvm-mingw-20251104-ucrt-$arch $mingw_dir
# Temporary workaround: https://github.com/mstorsjo/llvm-mingw/issues/493
mkdir -p $mingw_dir/bin
ln -s $arch-w64-windows-gnu.cfg $mingw_dir/bin/$arch-pc-windows-gnu.cfg
;;
*)
echo "Unrecognized archive type"
exit 1
;;
*.7z)
foo="https://github.com/niXman/mingw-builds-binaries"
MIRRORS_BASE="$foo/releases/download/14.2.0-rt_v12-rev2"
curl -L -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
7z x -y mingw.7z >/dev/null
;;
*.zip)
curl -o mingw.zip "${MIRRORS_BASE}/${mingw_archive}"
unzip -q mingw.zip
mv llvm-mingw-20251104-ucrt-$arch $mingw_dir
# Temporary workaround: https://github.com/mstorsjo/llvm-mingw/issues/493
mkdir -p $mingw_dir/bin
ln -s $arch-w64-windows-gnu.cfg $mingw_dir/bin/$arch-pc-windows-gnu.cfg
;;
*)
echo "Unrecognized archive type"
exit 1
;;
esac

ciCommandAddPath "$(cygpath -m "$(pwd)/${mingw_dir}/bin")"
Expand Down
Loading