Skip to content
Draft
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
11 changes: 10 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2136,7 +2136,16 @@ fn add_late_link_args(
|| crate_info.dependency_formats.iter().any(|(ty, list)| {
*ty == crate_type && list.iter().any(|&linkage| linkage == Linkage::Dynamic)
});
if any_dynamic_crate {
let (override_static, override_dynamic) = if sess.target.crt_static_respected {
// borrowed from https://github.com/rust-lang/rust/blob/40557f6225e337d68c8d4f086557ce54135f5dd9/compiler/rustc_session/src/session.rs#L390
let requested_features = sess.opts.cg.target_feature.split(',');
let found_negative = requested_features.clone().any(|r| r == "-crt-static");
let found_positive = requested_features.clone().any(|r| r == "+crt-static");
(found_positive, found_negative)
} else {
(false, false)
};
if (any_dynamic_crate && !override_static) || override_dynamic {
if let Some(args) = sess.target.late_link_args_dynamic.get(&flavor) {
cmd.verbatim_args(args.iter().map(Deref::deref));
}
Expand Down
20 changes: 20 additions & 0 deletions compiler/rustc_target/src/spec/base/windows_gnullvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ pub(crate) fn opts() -> TargetOptions {
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), mingw_libs);
add_link_args(&mut late_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), mingw_libs);

// LLD doesn't support push/pop
let dynamic_unwind_libs = &["-lunwind"];
let mut late_link_args_dynamic =
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), dynamic_unwind_libs);
add_link_args(
&mut late_link_args_dynamic,
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
dynamic_unwind_libs,
);
let static_unwind_libs = &["-l:libunwind.a"];
let mut late_link_args_static =
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), static_unwind_libs);
add_link_args(
&mut late_link_args_static,
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
static_unwind_libs,
);

TargetOptions {
os: Os::Windows,
env: Env::Gnu,
Expand All @@ -40,6 +58,8 @@ pub(crate) fn opts() -> TargetOptions {
pre_link_objects_self_contained: pre_mingw_self_contained(),
link_self_contained: LinkSelfContainedDefault::InferredForMingw,
late_link_args,
late_link_args_dynamic,
late_link_args_static,
abi_return_struct_as_int: true,
emit_debug_gdb_scripts: false,
requires_uwtable: true,
Expand Down
5 changes: 0 additions & 5 deletions library/unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,3 @@ cfg_select! {
#[cfg(target_os = "hurd")]
#[link(name = "gcc_s")]
unsafe extern "C" {}

#[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
unsafe extern "C" {}
4 changes: 2 additions & 2 deletions src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ ci-msvc: ci-msvc-py ci-msvc-ps1
# Used to split tests across multiple CI runners.
# Test both x and bootstrap entrypoints.
ci-mingw-x:
$(Q)$(CFG_SRC_DIR)/x test --stage 2 $(TEST_SET1)
$(Q)$(CFG_SRC_DIR)/x test --stage 2 --no-fail-fast $(TEST_SET1)
ci-mingw-bootstrap:
$(Q)$(BOOTSTRAP) test --stage 2 $(TEST_SET2)
$(Q)$(BOOTSTRAP) test --stage 2 --no-fail-fast $(TEST_SET2)
ci-mingw: ci-mingw-x ci-mingw-bootstrap

.PHONY: dist
19 changes: 14 additions & 5 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ runners:
os: windows-11-arm
<<: *base-job

- &job-aarch64-linux
# Free some disk space to avoid running out of space during the build.
- &job-aarch64-linux # Free some disk space to avoid running out of space during the build.
free_disk: true
os: ubuntu-24.04-arm
<<: *base-job
Expand All @@ -72,8 +71,7 @@ runners:
<<: *base-job

envs:
production:
&production
production: &production
DEPLOY_BUCKET: rust-lang-ci2
# AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
# AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
Expand Down Expand Up @@ -108,7 +106,6 @@ jobs:
DOCKER_SCRIPT: dist.sh
<<: *job-linux-36c-codebuild


# Jobs that run on each push to a pull request (PR).
#
# These jobs automatically inherit envs.pr, to avoid repeating it in each job
Expand Down Expand Up @@ -698,6 +695,18 @@ auto:
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
<<: *job-windows

- name: x86_64-llvm-mingw-1
env:
SCRIPT: make ci-mingw-x
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-llvm
<<: *job-windows

- name: x86_64-llvm-mingw-2
env:
SCRIPT: make ci-mingw-bootstrap
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-llvm
<<: *job-windows

- name: dist-x86_64-msvc
env:
RUST_CONFIGURE_ARGS: >-
Expand Down
1 change: 0 additions & 1 deletion tests/codegen-llvm/align-struct.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//@ compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0
// 32bit MSVC does not align things properly so we suppress high alignment annotations (#112480)
//@ ignore-i686-pc-windows-msvc
//@ ignore-i686-pc-windows-gnu

#![crate_type = "lib"]

Expand Down
1 change: 0 additions & 1 deletion tests/codegen-llvm/issues/issue-56927.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//@ compile-flags: -C no-prepopulate-passes
// 32bit MSVC does not align things properly so we suppress high alignment annotations (#112480)
//@ ignore-i686-pc-windows-msvc
//@ ignore-i686-pc-windows-gnu

#![crate_type = "rlib"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//@ compile-flags: -C no-prepopulate-passes
// 32bit MSVC does not align things properly so we suppress high alignment annotations (#112480)
//@ ignore-i686-pc-windows-msvc
//@ ignore-i686-pc-windows-gnu

#![crate_type = "lib"]
#![allow(non_camel_case_types)]
Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/by-value-non-immediate-argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//@ min-gdb-version: 13.0
//@ compile-flags:-g
//@ disable-gdb-pretty-printers
//@ ignore-windows-gnu: #128973
//@ ignore-aarch64-unknown-linux-gnu (gdb tries to read from 0x0; FIXME: #128973)
//@ ignore-powerpc64: #128973 on both -gnu and -musl

Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/embedded-visualizer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//@ compile-flags:-g
//@ ignore-lldb
//@ ignore-windows-gnu: #128981

// === CDB TESTS ==================================================================================

Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/empty-string.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-windows-gnu: #128981
//@ ignore-android: FIXME(#10381)
//@ compile-flags:-g
//@ ignore-backends: gcc
Expand Down
2 changes: 0 additions & 2 deletions tests/debuginfo/method-on-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//@ compile-flags:-g
//@ disable-gdb-pretty-printers

//@ ignore-windows-gnu: #128973

// === GDB TESTS ===================================================================================

//@ gdb-command:run
Expand Down
2 changes: 0 additions & 2 deletions tests/debuginfo/numeric-types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//@ compile-flags:-g

//@ ignore-windows-gnu: #128981

// Note: u128 visualization was not supported in 10.0.22621.3233 but was fixed in 10.0.26100.2161.

// FIXME(#133107): this is temporarily marked as `only-64bit` because of course 32-bit msvc has
Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/pretty-huge-vec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-windows-gnu: #128981
//@ ignore-android: FIXME(#10381)
//@ ignore-aix: FIXME(#137965)
//@ compile-flags:-g
Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/pretty-slices.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ ignore-android: FIXME(#10381)
//@ ignore-windows-gnu: #128981
//@ compile-flags:-g
//@ ignore-backends: gcc

Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/pretty-std-collections.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ ignore-android: FIXME(#10381)
//@ ignore-windows-gnu: #128981
//@ compile-flags:-g
//@ ignore-backends: gcc

Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/pretty-std.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// ignore-tidy-linelength
//@ ignore-windows-gnu: #128981
//@ ignore-android: FIXME(#10381)
//@ compile-flags:-g
// LLDB 1800+ tests were not tested in CI, broke, and now are disabled
Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/pretty-uninitialized-vec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-windows-gnu: #128981
//@ ignore-android: FIXME(#10381)
//@ compile-flags:-g
//@ ignore-backends: gcc
Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/rc_arc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ ignore-windows-gnu: #128981
//@ compile-flags:-g

//@ min-cdb-version: 10.0.18317.1001
Expand Down
1 change: 0 additions & 1 deletion tests/debuginfo/thread-names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//@[macos] only-macos
//@[win] only-windows
//@ ignore-sgx
//@ ignore-windows-gnu: gdb on windows-gnu does not print thread names

// === GDB TESTS ==================================================================================
//
Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/avr-rjmp-offset/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
//! "emit-asm" is used, as described in the issue description of #129301:
//! https://github.com/rust-lang/rust/issues/129301#issue-2475070770

// FIXME(#133480): this has been randomly failing on `x86_64-mingw` due to linker hangs or
// crashes... so I'm going to disable this test for windows for now.
//@ ignore-windows-gnu

use run_make_support::{llvm_objdump, path, rustc, rustc_minicore};

fn main() {
Expand Down
1 change: 0 additions & 1 deletion tests/run-make/dump-ice-to-disk/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
//! backtrace becomes `<unknown>`.

//@ ignore-cross-compile (exercising ICE dump on host)
//@ ignore-i686-pc-windows-gnu (unwind mechanism produces unpredictable backtraces)
//@ ignore-i686-pc-windows-msvc (sometimes partial backtrace becomes `<unknown>`)

use std::cell::OnceCell;
Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/foreign-rust-exceptions/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
//@ needs-unwind
// Reason: unwinding panics is exercised in this test

//@ ignore-i686-pc-windows-gnu
// Reason: This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder
// so cross-DLL unwinding does not work.

use run_make_support::{run_fail, rustc};

fn main() {
Expand Down
6 changes: 0 additions & 6 deletions tests/run-make/lto-long-filenames_cn/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
//@ ignore-cross-compile
// gnu ld is confused with intermediate files having multibytes characters in their names:
// = note: ld.exe: cannot find f0d5ff18d6510ebc-???_???_??????????_?_?????_?_???????.d50c2 \
// 4c0c4ea93cc-cgu.0.rcgu.o: Invalid argument
// as this is not something rustc can fix by itself,
// we just skip the test on windows-gnu for now. Hence:
//@ ignore-windows-gnu

use run_make_support::{rfs, rustc};

Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/panic-abort-eh_frame/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
// See https://github.com/rust-lang/rust/pull/112403 and
// https://github.com/rust-lang/rust/pull/143613.

//@ only-linux
// FIXME(Oneirical): the DW_CFA symbol appears on Windows-gnu, because uwtable
// is forced to true on Windows targets (see #128136).

use run_make_support::{llvm_objdump, rustc};

fn main() {
Expand Down
2 changes: 0 additions & 2 deletions tests/run-make/prune-link-args/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// See https://github.com/rust-lang/rust/pull/10749

//@ ignore-cross-compile
//@ ignore-windows-gnu
// Reason: The space is parsed as an empty linker argument on windows-gnu.

use run_make_support::rustc;

Expand Down
76 changes: 35 additions & 41 deletions tests/run-make/raw-dylib-alt-calling-convention/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern "fastcall" {
fn fastcall_fn_10_renamed(i: i32);
}

#[cfg(target_env = "msvc")]
#[cfg(any(target_env = "msvc", all(target_env = "gnu", target_abi = "llvm")))]
#[link(name = "extern", kind = "raw-dylib")]
extern "vectorcall" {
fn vectorcall_fn_1(i: i32);
Expand All @@ -66,49 +66,43 @@ extern "vectorcall" {
fn vectorcall_fn_10_renamed(i: i32);
}

pub fn library_function(run_msvc_only: bool) {
pub fn library_function(_run_msvc_only: bool) {
unsafe {
if !run_msvc_only {
stdcall_fn_1(14);
stdcall_fn_2(16, 3.5);
stdcall_fn_3(3.5);
stdcall_fn_4(1, 2, 3.0);
stdcall_fn_5(S { x: 1, y: 2 }, 16);
stdcall_fn_6(Some(&S { x: 10, y: 12 }));
stdcall_fn_7(S2 { x: 15, y: 16 }, 3);
stdcall_fn_8(S3 { x: [1, 2, 3, 4, 5] }, S3 { x: [6, 7, 8, 9, 10] });
stdcall_fn_9(1, 3.0);
stdcall_fn_10_renamed(19);
stdcall_fn_1(14);
stdcall_fn_2(16, 3.5);
stdcall_fn_3(3.5);
stdcall_fn_4(1, 2, 3.0);
stdcall_fn_5(S { x: 1, y: 2 }, 16);
stdcall_fn_6(Some(&S { x: 10, y: 12 }));
stdcall_fn_7(S2 { x: 15, y: 16 }, 3);
stdcall_fn_8(S3 { x: [1, 2, 3, 4, 5] }, S3 { x: [6, 7, 8, 9, 10] });
stdcall_fn_9(1, 3.0);
stdcall_fn_10_renamed(19);

fastcall_fn_1(14);
fastcall_fn_2(16, 3.5);
fastcall_fn_3(3.5);
fastcall_fn_4(1, 2, 3.0);
fastcall_fn_6(Some(&S { x: 10, y: 12 }));
fastcall_fn_8(S3 { x: [1, 2, 3, 4, 5] }, S3 { x: [6, 7, 8, 9, 10] });
fastcall_fn_9(1, 3.0);
fastcall_fn_10_renamed(19);
} else {
// FIXME: 91167
// rustc generates incorrect code for the calls to fastcall_fn_5 and fastcall_fn_7
// on i686-pc-windows-gnu; disabling these until the indicated issue is fixed.
fastcall_fn_5(S { x: 1, y: 2 }, 16);
fastcall_fn_7(S2 { x: 15, y: 16 }, 3);
fastcall_fn_1(14);
fastcall_fn_2(16, 3.5);
fastcall_fn_3(3.5);
fastcall_fn_4(1, 2, 3.0);
fastcall_fn_6(Some(&S { x: 10, y: 12 }));
fastcall_fn_8(S3 { x: [1, 2, 3, 4, 5] }, S3 { x: [6, 7, 8, 9, 10] });
fastcall_fn_9(1, 3.0);
fastcall_fn_10_renamed(19);
fastcall_fn_5(S { x: 1, y: 2 }, 16);
fastcall_fn_7(S2 { x: 15, y: 16 }, 3);

// GCC doesn't support vectorcall: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89485
#[cfg(target_env = "msvc")]
{
vectorcall_fn_1(14);
vectorcall_fn_2(16, 3.5);
vectorcall_fn_3(3.5);
vectorcall_fn_4(1, 2, 3.0);
vectorcall_fn_5(S { x: 1, y: 2 }, 16);
vectorcall_fn_6(Some(&S { x: 10, y: 12 }));
vectorcall_fn_7(S2 { x: 15, y: 16 }, 3);
vectorcall_fn_8(S3 { x: [1, 2, 3, 4, 5] }, S3 { x: [6, 7, 8, 9, 10] });
vectorcall_fn_9(1, 3.0);
vectorcall_fn_10_renamed(19);
}
// GCC doesn't support vectorcall: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89485
#[cfg(any(target_env = "msvc", all(target_env = "gnu", target_abi = "llvm")))]
{
vectorcall_fn_1(14);
vectorcall_fn_2(16, 3.5);
vectorcall_fn_3(3.5);
vectorcall_fn_4(1, 2, 3.0);
vectorcall_fn_5(S { x: 1, y: 2 }, 16);
vectorcall_fn_6(Some(&S { x: 10, y: 12 }));
vectorcall_fn_7(S2 { x: 15, y: 16 }, 3);
vectorcall_fn_8(S3 { x: [1, 2, 3, 4, 5] }, S3 { x: [6, 7, 8, 9, 10] });
vectorcall_fn_9(1, 3.0);
vectorcall_fn_10_renamed(19);
}
}
}
3 changes: 0 additions & 3 deletions tests/run-make/reproducible-build-2/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

//@ ignore-cross-compile

//@ ignore-windows-gnu
// GNU Linker for Windows is non-deterministic.

use run_make_support::{bin_name, is_windows_msvc, rfs, rust_lib_name, rustc};

fn main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
//! `i686-pc-windows-gnu`.

//@ ignore-cross-compile (exercises metrics incremental on host)
//@ ignore-i686-pc-windows-gnu (unwind mechanism produces unpredictable backtraces)

use std::path::{Path, PathBuf};

Expand Down
Loading
Loading