From 955936b2a470205af73443ecb4cf4775f355a1a0 Mon Sep 17 00:00:00 2001 From: Jake Hughes Date: Wed, 4 Jun 2025 18:33:10 +0100 Subject: [PATCH 1/3] Add bindgen as submodule --- .gitmodules | 3 +++ src/tools/bindgen | 1 + 2 files changed, 4 insertions(+) create mode 160000 src/tools/bindgen diff --git a/.gitmodules b/.gitmodules index e5159a5637f5d..76803e7440eff 100644 --- a/.gitmodules +++ b/.gitmodules @@ -54,3 +54,6 @@ [submodule "src/bdwgc"] path = src/bdwgc url = https://github.com/softdevteam/bdwgc +[submodule "src/tools/bindgen"] + path = src/tools/bindgen + url = https://github.com/rust-lang/rust-bindgen.git diff --git a/src/tools/bindgen b/src/tools/bindgen new file mode 160000 index 0000000000000..763c8b956808c --- /dev/null +++ b/src/tools/bindgen @@ -0,0 +1 @@ +Subproject commit 763c8b956808c850660c521059d4588bf4be05df From dfbfcf0590c6ad6f3bb22a096359cbd566c0569c Mon Sep 17 00:00:00 2001 From: Jake Hughes Date: Wed, 4 Jun 2025 20:14:22 +0100 Subject: [PATCH 2/3] Automatically generate BDWGC bindings As part of the bootstrap phase, we now search for `src/bdwgc/include/gc.h` and use that to automatically generate Rust bindings. This is less error-prone and means that we can any BDWGC API we wish without having to manually export them one by one. --- library/bdwgc/build.rs | 31 ++++++++ library/bdwgc/src/lib.rs | 70 ++----------------- library/std/src/gc.rs | 12 ++-- library/std/src/sys/pal/unix/thread.rs | 8 ++- src/bootstrap/src/core/build_steps/compile.rs | 5 +- src/bootstrap/src/core/build_steps/tool.rs | 41 +++++++++++ src/tools/tidy/src/walk.rs | 1 + 7 files changed, 93 insertions(+), 75 deletions(-) diff --git a/library/bdwgc/build.rs b/library/bdwgc/build.rs index 770fd0af7e7f8..b9d48153f634c 100644 --- a/library/bdwgc/build.rs +++ b/library/bdwgc/build.rs @@ -1,3 +1,6 @@ +use std::env; +use std::path::Path; +use std::process::Command; #[cfg(not(all(target_pointer_width = "64", target_arch = "x86_64")))] compile_error!("Requires x86_64 with 64 bit pointer width."); @@ -46,6 +49,34 @@ fn build_bdwgc() { } fn main() { + let cwd = env::var("CARGO_MANIFEST_DIR").unwrap(); + let header = Path::new(&cwd) + .parent() + .unwrap() + .parent() + .unwrap() + .join("src") + .join("bdwgc") + .join("include") + .join("gc.h"); + + let bindgen = std::env::var("RUSTC_BINDGEN").unwrap(); + let out = Path::new(&env::var("OUT_DIR").unwrap()).join("bindings.rs"); + let status = Command::new(bindgen) + .args(&[ + "--use-core", + "-o", + out.to_str().unwrap(), + header.to_str().unwrap(), + "--", + "-DGC_THREADS", + ]) + .status() + .unwrap(); + + if !status.success() { + panic!("bindgen failed with status: {:?}", status); + } #[cfg(not(feature = "link-shared"))] build_bdwgc(); #[cfg(feature = "link-shared")] diff --git a/library/bdwgc/src/lib.rs b/library/bdwgc/src/lib.rs index 6fa647cf3353a..91730f4d40e9b 100644 --- a/library/bdwgc/src/lib.rs +++ b/library/bdwgc/src/lib.rs @@ -1,4 +1,8 @@ #![no_std] +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +include!(concat!(env!("OUT_DIR"), "/bindings.rs")); #[repr(C)] #[derive(Default)] @@ -29,69 +33,3 @@ pub struct ProfileStats { /// Number of bytes freed explicitly since the recent GC. pub expl_freed_bytes_since_gc: usize, } - -#[link(name = "gc")] -extern "C" { - pub fn GC_malloc(nbytes: usize) -> *mut u8; - - pub fn GC_posix_memalign(mem_ptr: *mut *mut u8, align: usize, nbytes: usize) -> i32; - - pub fn GC_realloc(old: *mut u8, new_size: usize) -> *mut u8; - - pub fn GC_free(dead: *mut u8); - - pub fn GC_base(mem_ptr: *mut u8) -> *mut u8; - - pub fn GC_register_finalizer( - ptr: *mut u8, - finalizer: Option, - client_data: *mut u8, - old_finalizer: *mut extern "C" fn(*mut u8, *mut u8), - old_client_data: *mut *mut u8, - ); - - pub fn GC_register_finalizer_no_order( - ptr: *mut u8, - finalizer: Option, - client_data: *mut u8, - old_finalizer: *mut extern "C" fn(*mut u8, *mut u8), - old_client_data: *mut *mut u8, - ); - - pub fn GC_gcollect(); - - pub fn GC_thread_is_registered() -> u32; - - pub fn GC_pthread_create( - native: *mut libc::pthread_t, - attr: *const libc::pthread_attr_t, - f: extern "C" fn(_: *mut libc::c_void) -> *mut libc::c_void, - value: *mut libc::c_void, - ) -> libc::c_int; - - pub fn GC_pthread_join(native: libc::pthread_t, value: *mut *mut libc::c_void) -> libc::c_int; - - pub fn GC_pthread_exit(value: *mut libc::c_void) -> !; - - pub fn GC_pthread_detach(thread: libc::pthread_t) -> libc::c_int; - - pub fn GC_init(); - - pub fn GC_keep_alive(ptr: *mut u8); - - pub fn GC_set_finalize_on_demand(state: i32); - - pub fn GC_set_finalizer_notifier(f: extern "C" fn()); - - pub fn GC_should_invoke_finalizers() -> u32; - - pub fn GC_invoke_finalizers() -> u64; - - pub fn GC_get_gc_no() -> u64; - - pub fn GC_enable(); - - pub fn GC_is_disabled() -> i32; - - pub fn GC_disable(); -} diff --git a/library/std/src/gc.rs b/library/std/src/gc.rs index 6531716d65634..b81165624b5e0 100644 --- a/library/std/src/gc.rs +++ b/library/std/src/gc.rs @@ -125,7 +125,7 @@ unsafe fn gc_malloc(layout: Layout) -> *mut u8 { #[inline] unsafe fn gc_realloc(ptr: *mut u8, old_layout: Layout, new_size: usize) -> *mut u8 { if old_layout.align() <= MIN_ALIGN && old_layout.align() <= new_size { - unsafe { bdwgc::GC_realloc(ptr, new_size) as *mut u8 } + unsafe { bdwgc::GC_realloc(ptr as *mut libc::c_void, new_size) as *mut u8 } } else { unsafe { let new_layout = Layout::from_size_align_unchecked(new_size, old_layout.align()); @@ -144,7 +144,7 @@ unsafe fn gc_realloc(ptr: *mut u8, old_layout: Layout, new_size: usize) -> *mut #[inline] unsafe fn gc_free(ptr: *mut u8, _: Layout) { unsafe { - bdwgc::GC_free(ptr); + bdwgc::GC_free(ptr as *mut libc::c_void); } } @@ -209,7 +209,7 @@ pub fn init() { unsafe { bdwgc::GC_init(); bdwgc::GC_set_finalize_on_demand(1); - bdwgc::GC_set_finalizer_notifier(notify_finalizer_thread); + bdwgc::GC_set_finalizer_notifier(Some(notify_finalizer_thread)); #[cfg(feature = "bdwgc-disable")] bdwgc::GC_disable() } @@ -220,7 +220,7 @@ pub fn thread_registered() -> bool { } pub fn keep_alive(ptr: *mut T) { - unsafe { bdwgc::GC_keep_alive(ptr as *mut u8) } + unsafe { bdwgc::GC_keep_alive(ptr as *mut _ as u64) } } pub fn is_enabled() -> bool { @@ -606,7 +606,7 @@ impl Gc { } } - unsafe extern "C" fn finalizer_shim(obj: *mut u8, _: *mut u8) { + unsafe extern "C" fn finalizer_shim(obj: *mut libc::c_void, _: *mut libc::c_void) { let drop_fn = drop_in_place::>; unsafe { drop_fn(obj as *mut GcBox) }; } @@ -625,7 +625,7 @@ impl Gc { let ptr = Box::leak(Box::new_in(GcBox { value }, GcAllocator)); unsafe { bdwgc::GC_register_finalizer_no_order( - ptr as *mut _ as *mut u8, + ptr as *mut _ as *mut libc::c_void, Some(finalizer_shim::), ptr::null_mut(), ptr::null_mut(), diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index e439e079fe126..f0cff2885ad3a 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -85,8 +85,12 @@ impl Thread { }; } - let ret = - crate::bdwgc::GC_pthread_create(&mut native, attr.as_ptr(), thread_start, p as *mut _); + let ret = crate::bdwgc::GC_pthread_create( + &mut native, + attr.as_ptr() as *const bdwgc::pthread_attr_t, + Some(thread_start), + p as *mut _, + ); // Note: if the thread creation fails and this assert fails, then p will // be leaked. However, an alternative design could cause double-free // which is clearly worse. diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 7821950073742..edbaccffc7435 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -20,7 +20,7 @@ use serde_derive::Deserialize; use tracing::{instrument, span}; use crate::core::build_steps::gcc::{Gcc, add_cg_gcc_cargo_flags}; -use crate::core::build_steps::tool::SourceType; +use crate::core::build_steps::tool::{Bindgen, SourceType}; use crate::core::build_steps::{dist, llvm}; use crate::core::builder; use crate::core::builder::{ @@ -292,6 +292,9 @@ impl Step for Std { cargo.rustflag(rustflag); } + let bindgen = builder.ensure(Bindgen { compiler, target }); + cargo.env("RUSTC_BINDGEN", bindgen.tool_path); + let _guard = builder.msg( Kind::Build, compiler.stage, diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 6a9e373fbc949..970300c58250c 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -224,6 +224,7 @@ pub fn prepare_tool_cargo( || path.ends_with("clippy") || path.ends_with("miri") || path.ends_with("rustfmt") + || path.ends_with("bindgen") { cargo.env("LIBZ_SYS_STATIC", "1"); } @@ -1250,6 +1251,46 @@ impl Step for TestFloatParse { } } +#[derive(Debug, Clone, Hash, PartialEq, Eq)] +pub struct Bindgen { + pub compiler: Compiler, + pub target: TargetSelection, +} + +impl Step for Bindgen { + type Output = ToolBuildResult; + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/tools/bindgen") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(Bindgen { + compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build), + target: run.target, + }); + } + + fn run(self, builder: &Builder<'_>) -> ToolBuildResult { + builder.build.require_submodule("src/tools/bindgen", None); + + builder.ensure(ToolBuild { + compiler: self.compiler, + target: self.target, + tool: "bindgen", + mode: Mode::ToolBootstrap, + path: "src/tools/bindgen", + source_type: SourceType::Submodule, + extra_features: Vec::new(), + allow_features: "", + cargo_args: vec!["-p".to_string(), "bindgen-cli".to_string()], + artifact_kind: ToolArtifactKind::Binary, + }) + } +} + impl Builder<'_> { /// Gets a `BootstrapCommand` which is ready to run `tool` in `stage` built for /// `host`. diff --git a/src/tools/tidy/src/walk.rs b/src/tools/tidy/src/walk.rs index b0e1e5b458e37..f17a7877b93f1 100644 --- a/src/tools/tidy/src/walk.rs +++ b/src/tools/tidy/src/walk.rs @@ -16,6 +16,7 @@ pub fn filter_dirs(path: &Path) -> bool { "library/backtrace", "library/portable-simd", "library/stdarch", + "src/tools/bindgen", "src/tools/cargo", "src/tools/clippy", "src/tools/libcxx-version", From 000264464ea8b6c1cf92afac00bee083d51344a0 Mon Sep 17 00:00:00 2001 From: Jake Hughes Date: Sun, 8 Jun 2025 23:55:44 +0100 Subject: [PATCH 3/3] Switch to dynamically linked BDWGC This works by ensuring that the bootstrap phase puts libgc.so inside the sysroot, where the librustc-driver and libtest objects are already given to search at load time in their RPATH. --- .buildbot.config.toml | 1 + .buildbot.sh | 2 +- .buildbot_dockerfile_debian | 3 +- compiler/rustc_codegen_ssa/src/back/link.rs | 8 ++ library/Cargo.lock | 1 + library/bdwgc/build.rs | 51 +-------- library/sysroot/Cargo.toml | 1 + rustfmt.toml | 1 + src/bootstrap/src/core/build_steps/bdwgc.rs | 107 ++++++++++++++++++ src/bootstrap/src/core/build_steps/compile.rs | 52 ++++++++- src/bootstrap/src/core/build_steps/llvm.rs | 4 +- src/bootstrap/src/core/build_steps/mod.rs | 1 + src/bootstrap/src/core/build_steps/test.rs | 24 +++- src/bootstrap/src/core/build_steps/tool.rs | 14 +-- src/bootstrap/src/core/config/config.rs | 2 + src/bootstrap/src/lib.rs | 7 ++ .../src/external_deps/c_cxx_compiler/cc.rs | 4 + .../external_deps/c_cxx_compiler/extras.rs | 2 +- .../src/external_deps/rustc.rs | 3 + src/tools/tidy/config/black.toml | 1 + src/tools/tidy/config/ruff.toml | 1 + tests/run-make/amdgpu-kd/rmake.rs | 1 + tests/run-make/avr-rjmp-offset/rmake.rs | 1 + tests/run-make/linker-warning/short-error.txt | 2 +- tests/run-make/static-pie/rmake.rs | 1 + tests/ui/amdgpu-require-explicit-cpu.rs | 1 + .../issue-70093/link-native-libraries.rs | 2 +- tests/ui/runtime/gc/unchecked_finalizer.rs | 2 +- 28 files changed, 230 insertions(+), 70 deletions(-) create mode 100644 src/bootstrap/src/core/build_steps/bdwgc.rs diff --git a/.buildbot.config.toml b/.buildbot.config.toml index cb9a6916b63a9..da6880b667619 100644 --- a/.buildbot.config.toml +++ b/.buildbot.config.toml @@ -1,5 +1,6 @@ [alloy] bdwgc-assertions = true +bdwgc-link-shared = true [rust] codegen-units = 0 # Use many compilation units. diff --git a/.buildbot.sh b/.buildbot.sh index 7a1976d063bb1..73aac660bd366 100755 --- a/.buildbot.sh +++ b/.buildbot.sh @@ -28,7 +28,7 @@ sh rustup.sh --default-host x86_64-unknown-linux-gnu \ -y export PATH=$(pwd)/.cargo/bin/:$PATH -rustup toolchain link alloy build/x86_64-unknown-linux-gnu/stage1 +rustup toolchain link alloy build/x86_64-unknown-linux-gnu/stage2 # Build and test yksom git clone --recursive https://github.com/softdevteam/yksom diff --git a/.buildbot_dockerfile_debian b/.buildbot_dockerfile_debian index aa53b59ce6fcf..449a017e0f2e8 100644 --- a/.buildbot_dockerfile_debian +++ b/.buildbot_dockerfile_debian @@ -2,7 +2,8 @@ FROM debian:latest ARG CI_UID RUN useradd -m -u ${CI_UID} ci RUN apt-get update && \ - apt-get -y install build-essential curl cmake python3 git ninja-build time autoconf libtool libssl-dev pkg-config + apt-get -y install build-essential curl cmake python3 git ninja-build \ + time autoconf libclang-dev libtool libssl-dev pkg-config WORKDIR /ci RUN chown ${CI_UID}:${CI_UID} . COPY --chown=${CI_UID}:${CI_UID} . . diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index a170b2e3b6a56..a115cf191c7d8 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1318,6 +1318,12 @@ fn link_sanitizer_runtime( } } +fn add_bdwgc(sess: &Session, linker: &mut dyn Linker) { + let sysroot = sess.sysroot.clone(); + linker.link_args(&["-rpath", &sysroot.join("lib").to_str().unwrap()]); + linker.link_dylib_by_name("gc", false, false); +} + /// Returns a boolean indicating whether the specified crate should be ignored /// during LTO. /// @@ -2254,6 +2260,8 @@ fn linker_with_args( // Sanitizer libraries. add_sanitizer_libraries(sess, flavor, crate_type, cmd); + add_bdwgc(sess, cmd); + // Object code from the current crate. // Take careful note of the ordering of the arguments we pass to the linker // here. Linkers will assume that things on the left depend on things to the diff --git a/library/Cargo.lock b/library/Cargo.lock index dee9bee2d12d5..a68b8350f1bd6 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -409,6 +409,7 @@ dependencies = [ name = "sysroot" version = "0.0.0" dependencies = [ + "bdwgc", "proc_macro", "profiler_builtins", "std", diff --git a/library/bdwgc/build.rs b/library/bdwgc/build.rs index b9d48153f634c..e95ecaa187490 100644 --- a/library/bdwgc/build.rs +++ b/library/bdwgc/build.rs @@ -4,50 +4,6 @@ use std::process::Command; #[cfg(not(all(target_pointer_width = "64", target_arch = "x86_64")))] compile_error!("Requires x86_64 with 64 bit pointer width."); -#[cfg(not(feature = "link-shared"))] -fn build_bdwgc() { - use std::env; - use std::path::PathBuf; - use std::process::Command; - - const BDWGC_REPO: &str = "../../src/bdwgc"; - const BDWGC_BUILD_DIR: &str = "lib"; - - let out_dir = env::var("OUT_DIR").unwrap(); - let bdwgc_src = PathBuf::from(BDWGC_REPO); - - if bdwgc_src.read_dir().unwrap().count() == 0 { - Command::new("git") - .args(["submodule", "update", "--init", BDWGC_REPO]) - .output() - .expect("Failed to clone BDWGC repo"); - } - - let mut build_dir = PathBuf::from(&out_dir); - build_dir.push(BDWGC_BUILD_DIR); - - let mut build = cmake::Config::new(&bdwgc_src); - build - .pic(true) - .define("BUILD_SHARED_LIBS", "OFF") - .define("enable_parallel_mark", "Off") - .cflag("-DGC_ALWAYS_MULTITHREADED"); - - #[cfg(feature = "gc-assertions")] - build.define("enable_gc_assertions", "ON"); - - #[cfg(not(feature = "gc-debug"))] - build.profile("Release"); - - #[cfg(feature = "gc-debug")] - build.profile("Debug"); - - build.build(); - - println!("cargo:rustc-link-search=native={}", &build_dir.display()); - println!("cargo:rustc-link-lib=static=gc"); -} - fn main() { let cwd = env::var("CARGO_MANIFEST_DIR").unwrap(); let header = Path::new(&cwd) @@ -64,6 +20,8 @@ fn main() { let out = Path::new(&env::var("OUT_DIR").unwrap()).join("bindings.rs"); let status = Command::new(bindgen) .args(&[ + "--ctypes-prefix", + "libc", "--use-core", "-o", out.to_str().unwrap(), @@ -77,8 +35,5 @@ fn main() { if !status.success() { panic!("bindgen failed with status: {:?}", status); } - #[cfg(not(feature = "link-shared"))] - build_bdwgc(); - #[cfg(feature = "link-shared")] - println!("cargo:rustc-link-lib=dylib=gc"); + println!("cargo::rustc-link-lib=dylib=gc"); } diff --git a/library/sysroot/Cargo.toml b/library/sysroot/Cargo.toml index b596e7a4980a7..9de1d1d785b3c 100644 --- a/library/sysroot/Cargo.toml +++ b/library/sysroot/Cargo.toml @@ -11,6 +11,7 @@ proc_macro = { path = "../proc_macro", public = true } profiler_builtins = { path = "../profiler_builtins", optional = true } std = { path = "../std", public = true } test = { path = "../test", public = true } +bdwgc = { path = "../bdwgc", public = true } # Forward features to the `std` crate as necessary [features] diff --git a/rustfmt.toml b/rustfmt.toml index 8feeb60ca12c2..e8bfcac02db58 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -38,6 +38,7 @@ ignore = [ "src/doc/rust-by-example", "src/doc/rustc-dev-guide", "src/llvm-project", + "src/tools/bindgen", "src/tools/cargo", "src/tools/clippy", "src/tools/enzyme", diff --git a/src/bootstrap/src/core/build_steps/bdwgc.rs b/src/bootstrap/src/core/build_steps/bdwgc.rs new file mode 100644 index 0000000000000..4b4e62d227f33 --- /dev/null +++ b/src/bootstrap/src/core/build_steps/bdwgc.rs @@ -0,0 +1,107 @@ +//! Compilation of native BDWGC +use std::fs; +use std::path::{Path, PathBuf}; +use std::sync::OnceLock; + +#[cfg(feature = "tracing")] +use tracing::instrument; + +use crate::core::build_steps::llvm; +use crate::core::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::core::config::TargetSelection; +use crate::trace; +use crate::utils::build_stamp::{BuildStamp, generate_smart_stamp_hash}; +use crate::utils::helpers::{self, t}; + +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct Bdwgc { + pub target: TargetSelection, +} + +fn libgc_built_path(out_dir: &Path) -> PathBuf { + out_dir.join("lib") +} + +impl Step for Bdwgc { + type Output = PathBuf; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/bdwgc") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(Bdwgc { target: run.target }); + } + + fn run(self, builder: &Builder<'_>) -> PathBuf { + builder.require_submodule("src/bdwgc", None); + let target = self.target; + let out_dir = builder.bdwgc_out(target); + let libgc = libgc_built_path(&out_dir); + if builder.config.dry_run() { + return libgc; + } + + static STAMP_HASH_MEMO: OnceLock = OnceLock::new(); + let smart_stamp_hash = STAMP_HASH_MEMO.get_or_init(|| { + generate_smart_stamp_hash( + builder, + &builder.config.src.join("src/bdwgc"), + builder.bdwgc_info.sha().unwrap_or_default(), + ) + }); + + let stamp = BuildStamp::new(&out_dir).add_stamp(smart_stamp_hash); + + trace!("checking build stamp to see if we need to rebuild BDWGC artifacts"); + if stamp.is_up_to_date() { + trace!(?out_dir, "bdwgc build artifacts are up to date"); + if stamp.stamp().is_empty() { + builder.info( + "Could not determine the BDWGC submodule commit hash. \ + Assuming that an BDWGC rebuild is necessary.", + ); + } else { + builder.info(&format!( + "To force BDWGC to rebuild, remove the file `{}`", + stamp.path().display() + )); + return libgc; + } + } + + trace!(?target, "(re)building BDWGC artifacts"); + builder.info(&format!("Building BDWGC for {}", target)); + t!(stamp.remove()); + let _time = helpers::timeit(builder); + t!(fs::create_dir_all(&out_dir)); + + builder.config.update_submodule(Path::new("src").join("bdwgc").to_str().unwrap()); + let mut cfg = cmake::Config::new(builder.src.join("src/bdwgc")); + llvm::configure_cmake(builder, target, &mut cfg, true, llvm::LdFlags::default(), &[]); + + let profile = match (builder.config.bdwgc_debug, builder.config.bdwgc_assertions) { + (true, _) => "Debug", + (false, false) => "Release", + (false, true) => "RelWithDebInfo", + }; + trace!(?profile); + + let assertions = if builder.config.bdwgc_assertions { "ON" } else { "OFF" }; + let shared = if builder.config.bdwgc_link_shared { "ON" } else { "OFF" }; + + cfg.out_dir(&out_dir) + .pic(true) + .profile(profile) + .define("BUILD_SHARED_LIBS", shared) + .define("enable_parallel_mark", "OFF") + .define("enable_gc_assertions", assertions) + .cflag("-DGC_ALWAYS_MULTITHREADED"); + + cfg.build(); + + t!(stamp.write()); + libgc + } +} diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index edbaccffc7435..10f49bea5cc5b 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -21,7 +21,7 @@ use tracing::{instrument, span}; use crate::core::build_steps::gcc::{Gcc, add_cg_gcc_cargo_flags}; use crate::core::build_steps::tool::{Bindgen, SourceType}; -use crate::core::build_steps::{dist, llvm}; +use crate::core::build_steps::{bdwgc, dist, llvm}; use crate::core::builder; use crate::core::builder::{ Builder, Cargo, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath, crate_description, @@ -283,6 +283,8 @@ impl Step for Std { } cargo }; + let bindgen = builder.ensure(Bindgen { target }); + cargo.env("RUSTC_BINDGEN", &bindgen.tool_path); // See src/bootstrap/synthetic_targets.rs if target.is_synthetic() { @@ -292,7 +294,7 @@ impl Step for Std { cargo.rustflag(rustflag); } - let bindgen = builder.ensure(Bindgen { compiler, target }); + let bindgen = builder.ensure(Bindgen { target }); cargo.env("RUSTC_BINDGEN", bindgen.tool_path); let _guard = builder.msg( @@ -333,6 +335,33 @@ fn copy_and_stamp( target_deps.push((target, dependency_type)); } +fn copy_libgc( + builder: &Builder<'_>, + target: TargetSelection, + libdir: &Path, +) -> Vec<(PathBuf, DependencyType)> { + let mut v = Vec::new(); + let install_dir = builder.ensure(bdwgc::Bdwgc { target }); + if !install_dir.exists() { + return v; + } + for obj in fs::read_dir(install_dir).unwrap() { + let p = obj.unwrap().path(); + if !p.file_name().unwrap().to_str().unwrap().starts_with("libgc") { + continue; + } + if p.is_symlink() { + builder.install(&t!(fs::canonicalize(&p)), &libdir, 0o644); + let full_dest = libdir.join(p.file_name().unwrap()); + builder.copy_link(&p, &full_dest); + } else { + builder.install(&p, &libdir, 0o644); + } + v.push((p, DependencyType::Target)); + } + v +} + fn copy_llvm_libunwind(builder: &Builder<'_>, target: TargetSelection, libdir: &Path) -> PathBuf { let libunwind_path = builder.ensure(llvm::Libunwind { target }); let libunwind_source = libunwind_path.join("libunwind.a"); @@ -368,6 +397,11 @@ fn copy_third_party_objects( target_deps.push((libunwind_path, DependencyType::Target)); } + if builder.config.bdwgc_link_shared { + let libgc_objs = copy_libgc(builder, target, &builder.rustc_libdir(*compiler)); + target_deps.extend(libgc_objs) + } + target_deps } @@ -537,6 +571,8 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car cargo.env("MACOSX_DEPLOYMENT_TARGET", target); } } + let bindgen = builder.ensure(Bindgen { target }); + cargo.env("RUSTC_BINDGEN", &bindgen.tool_path); // Paths needed by `library/profiler_builtins/build.rs`. if let Some(path) = builder.config.profiler_path(target) { @@ -549,6 +585,12 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car cargo.env("RUST_COMPILER_RT_FOR_PROFILER", compiler_rt); } + // Evenutally we stick libgc.so in the current compiler stage's sysroot where the linker will + // find it. But first, we must explicitly link the build directory because of bootstrap + // ordering: the first thing rust does is build library/std with stage 0 which doesn't yet know + // about libgc. + cargo.rustflag("-L").rustflag(builder.bdwgc_out(target).join("lib").to_str().unwrap()); + // Determine if we're going to compile in optimized C intrinsics to // the `compiler-builtins` crate. These intrinsics live in LLVM's // `compiler-rt` repository. @@ -1191,6 +1233,9 @@ pub fn rustc_cargo( } } + let bindgen = builder.ensure(Bindgen { target }); + cargo.env("RUSTC_BINDGEN", &bindgen.tool_path); + // Building with protected visibility reduces the number of dynamic relocations needed, giving // us a faster startup time. However GNU ld < 2.40 will error if we try to link a shared object // with direct references to protected symbols, so for now we only use protected symbols if @@ -1351,6 +1396,9 @@ pub fn rustc_cargo_env( } } + // Paths needed by `library/bdwgc/build.rs`. + let bindgen = builder.ensure(Bindgen { target }); + cargo.env("RUSTC_BINDGEN", &bindgen.tool_path); // Build jemalloc on AArch64 with support for page sizes up to 64K // See: https://github.com/rust-lang/rust/pull/135081 if builder.config.jemalloc(target) diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 40d701f22c137..d74ed7668876e 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -68,7 +68,7 @@ impl LlvmBuildStatus { /// Linker flags to pass to LLVM's CMake invocation. #[derive(Debug, Clone, Default)] -struct LdFlags { +pub(crate) struct LdFlags { /// CMAKE_EXE_LINKER_FLAGS exe: OsString, /// CMAKE_SHARED_LINKER_FLAGS @@ -648,7 +648,7 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) { panic!("\n\nbad LLVM version: {version}, need >=18\n\n") } -fn configure_cmake( +pub(crate) fn configure_cmake( builder: &Builder<'_>, target: TargetSelection, cfg: &mut cmake::Config, diff --git a/src/bootstrap/src/core/build_steps/mod.rs b/src/bootstrap/src/core/build_steps/mod.rs index fcb6abea43472..b79c178093ba1 100644 --- a/src/bootstrap/src/core/build_steps/mod.rs +++ b/src/bootstrap/src/core/build_steps/mod.rs @@ -1,3 +1,4 @@ +pub(crate) mod bdwgc; pub(crate) mod check; pub(crate) mod clean; pub(crate) mod clippy; diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 4b7c8d5770e4e..daaea2cf87b77 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -15,7 +15,7 @@ use crate::core::build_steps::doc::DocumentationFormat; use crate::core::build_steps::gcc::{Gcc, add_cg_gcc_cargo_flags}; use crate::core::build_steps::llvm::get_llvm_version; use crate::core::build_steps::synthetic_targets::MirOptPanicAbortSyntheticTarget; -use crate::core::build_steps::tool::{self, SourceType, Tool}; +use crate::core::build_steps::tool::{self, Bindgen, SourceType, Tool}; use crate::core::build_steps::toolstate::ToolState; use crate::core::build_steps::{compile, dist, llvm}; use crate::core::builder::{ @@ -254,13 +254,15 @@ impl Step for Cargotest { let out_dir = builder.out.join("ct"); t!(fs::create_dir_all(&out_dir)); + let bindgen = builder.ensure(Bindgen { target: compiler.host }); let _time = helpers::timeit(builder); let mut cmd = builder.tool_cmd(Tool::CargoTest); cmd.arg(&cargo.tool_path) .arg(&out_dir) .args(builder.config.test_args()) .env("RUSTC", builder.rustc(compiler)) - .env("RUSTDOC", builder.rustdoc(compiler)); + .env("RUSTDOC", builder.rustdoc(compiler)) + .env("RUSTC_BINDGEN", &bindgen.tool_path); add_rustdoc_cargo_linker_args( &mut cmd, builder, @@ -354,6 +356,9 @@ impl Step for Cargo { builder, ); + let bindgen = builder.ensure(Bindgen { target: self.host }); + cargo.env("RUSTC_BINDGEN", &bindgen.tool_path); + let _time = helpers::timeit(builder); add_flags_and_try_run_tests(builder, &mut cargo); } @@ -1269,6 +1274,7 @@ impl Step for CrateRunMakeSupport { &[], ); cargo.allow_features("test"); + cargo.rustflag("-L").rustflag(builder.bdwgc_out(self.host).join("lib").to_str().unwrap()); run_cargo_test(cargo, &[], &[], "run-make-support self test", host, builder); } } @@ -1659,6 +1665,10 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the cmd.arg("--run-lib-path").arg(builder.sysroot_target_libdir(compiler, target)); cmd.arg("--rustc-path").arg(builder.rustc(compiler)); + let bindgen = builder.ensure(Bindgen { target }); + cmd.env("RUSTC_BINDGEN", &bindgen.tool_path); + cmd.env("LIBGC_DIR", &builder.bdwgc_out(target).join("lib").to_str().unwrap()); + // Minicore auxiliary lib for `no_core` tests that need `core` stubs in cross-compilation // scenarios. cmd.arg("--minicore-path") @@ -1810,6 +1820,9 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let mut targetflags = flags; targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display())); + let bdwgc_libdir = builder.rustc_libdir(compiler); + hostflags.push(format!("-Lnative={}", bdwgc_libdir.display())); + targetflags.push(format!("-Lnative={}", bdwgc_libdir.display())); for flag in hostflags { cmd.arg("--host-rustcflags").arg(flag); } @@ -2502,6 +2515,9 @@ fn run_cargo_test<'a>( builder.msg_sysroot_tool(Kind::Test, compiler.stage, what, compiler.host, target) }); + let bindgen = builder.ensure(Bindgen { target: compiler.host }); + cargo.env("RUSTC_BINDGEN", &bindgen.tool_path); + #[cfg(feature = "build-metrics")] builder.metrics.begin_test_suite( build_helper::metrics::TestSuiteMetadata::CargoPackage { @@ -2585,6 +2601,8 @@ fn prepare_cargo_test( } else if let Some(tool) = builder.runner(target) { cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target.triple)), tool); } + let bindgen = builder.ensure(Bindgen { target }); + cargo.env("RUSTC_BINDGEN", &bindgen.tool_path); cargo } @@ -2730,6 +2748,8 @@ impl Step for Crate { if crates.iter().any(|crate_| crate_ == "core") { crates.push("coretests".to_owned()); } + let bindgen = builder.ensure(Bindgen { target }); + cargo.env("RUSTC_BINDGEN", &bindgen.tool_path); run_cargo_test(cargo, &[], &crates, &*crate_description(&self.crates), target, builder); } diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 970300c58250c..de101f25da07d 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -1253,7 +1253,6 @@ impl Step for TestFloatParse { #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct Bindgen { - pub compiler: Compiler, pub target: TargetSelection, } @@ -1266,19 +1265,14 @@ impl Step for Bindgen { run.path("src/tools/bindgen") } - fn make_run(run: RunConfig<'_>) { - run.builder.ensure(Bindgen { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build), - target: run.target, - }); - } - fn run(self, builder: &Builder<'_>) -> ToolBuildResult { + let compiler = builder.compiler(0, builder.config.build); + let bootstrap_host = builder.config.build; builder.build.require_submodule("src/tools/bindgen", None); builder.ensure(ToolBuild { - compiler: self.compiler, - target: self.target, + compiler, + target: bootstrap_host, tool: "bindgen", mode: Mode::ToolBootstrap, path: "src/tools/bindgen", diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 424d299d1e588..46ebd5a897edb 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -386,6 +386,7 @@ pub struct Config { pub out: PathBuf, pub rust_info: channel::GitInfo, + pub bdwgc_info: channel::GitInfo, pub cargo_info: channel::GitInfo, pub rust_analyzer_info: channel::GitInfo, pub clippy_info: channel::GitInfo, @@ -1832,6 +1833,7 @@ impl Config { config.omit_git_hash = toml.rust.as_ref().and_then(|r| r.omit_git_hash).unwrap_or(default); config.rust_info = GitInfo::new(config.omit_git_hash, &config.src); + config.bdwgc_info = GitInfo::new(config.omit_git_hash, &config.src.join("src/bdwgc")); config.cargo_info = GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/cargo")); config.rust_analyzer_info = GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/rust-analyzer")); diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index f00df1940969c..5ff5178577d00 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -135,6 +135,7 @@ pub struct Build { src: PathBuf, out: PathBuf, bootstrap_out: PathBuf, + bdwgc_info: GitInfo, cargo_info: GitInfo, rust_analyzer_info: GitInfo, clippy_info: GitInfo, @@ -304,6 +305,7 @@ impl Build { let is_sudo = false; let rust_info = config.rust_info.clone(); + let bdwgc_info = config.bdwgc_info.clone(); let cargo_info = config.cargo_info.clone(); let rust_analyzer_info = config.rust_analyzer_info.clone(); let clippy_info = config.clippy_info.clone(); @@ -375,6 +377,7 @@ impl Build { out, bootstrap_out, + bdwgc_info, cargo_info, rust_analyzer_info, clippy_info, @@ -778,6 +781,10 @@ impl Build { self.out.join(compiler.host).join(format!("stage{}{}", compiler.stage, suffix)) } + fn bdwgc_out(&self, target: TargetSelection) -> PathBuf { + self.out.join(&*target.triple).join("bdwgc") + } + /// Returns the root output directory for all Cargo output in a given stage, /// running a particular compiler, whether or not we're building the /// standard library, and targeting the specified architecture. diff --git a/src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs b/src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs index 0e6d6ea6075d2..d1b348ac1f7e9 100644 --- a/src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs +++ b/src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs @@ -45,6 +45,10 @@ impl Cc { cmd.arg(flag); } + let libgc = env_var("LIBGC_DIR"); + cmd.arg("-L"); + cmd.arg(libgc); + Self { cmd } } diff --git a/src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs b/src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs index ca6ab3275c4d6..bf1652065c402 100644 --- a/src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs +++ b/src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs @@ -23,7 +23,7 @@ pub fn extra_c_flags() -> Vec<&'static str> { vec!["-lm", "-lpthread", "-lposix4", "-lsocket", "-lresolv"] } n if n.contains("OpenBSD") => vec!["-lm", "-lpthread", "-lc++abi"], - _ => vec!["-lm", "-lrt", "-ldl", "-lpthread"], + _ => vec!["-lm", "-lrt", "-ldl", "-lpthread", "-lgc"], } } } diff --git a/src/tools/run-make-support/src/external_deps/rustc.rs b/src/tools/run-make-support/src/external_deps/rustc.rs index 0e2239147f122..5ed11246f2dda 100644 --- a/src/tools/run-make-support/src/external_deps/rustc.rs +++ b/src/tools/run-make-support/src/external_deps/rustc.rs @@ -57,6 +57,9 @@ impl Rustc { pub fn new() -> Self { let mut cmd = setup_common(); cmd.arg("-L").arg(cwd()); + let libgc = env_var("LIBGC_DIR"); + cmd.arg("-L"); + cmd.arg(libgc); Self { cmd } } diff --git a/src/tools/tidy/config/black.toml b/src/tools/tidy/config/black.toml index 4cfa44fc3ea16..255e7ef69c063 100644 --- a/src/tools/tidy/config/black.toml +++ b/src/tools/tidy/config/black.toml @@ -2,6 +2,7 @@ # Ignore all submodules extend-exclude = """(\ src/doc/nomicon|\ + src/tools/bindgen/|\ src/tools/cargo/|\ src/doc/reference/|\ src/doc/book/|\ diff --git a/src/tools/tidy/config/ruff.toml b/src/tools/tidy/config/ruff.toml index a0a56ea5c9ec9..158f00ede3cbb 100644 --- a/src/tools/tidy/config/ruff.toml +++ b/src/tools/tidy/config/ruff.toml @@ -7,6 +7,7 @@ target-version = "py39" extend-exclude = [ # Hack: CI runs from a subdirectory under the main checkout "../src/doc/nomicon/", + "../src/tools/bindgen/", "../src/tools/cargo/", "../src/doc/reference/", "../src/doc/book/", diff --git a/tests/run-make/amdgpu-kd/rmake.rs b/tests/run-make/amdgpu-kd/rmake.rs index a787fa1da93aa..e301154692e94 100644 --- a/tests/run-make/amdgpu-kd/rmake.rs +++ b/tests/run-make/amdgpu-kd/rmake.rs @@ -3,6 +3,7 @@ // with the name of the kernel plus a .kd suffix. // Check that the produced object has the .kd symbol exported. +//@ ignore-test: Not compatible with libgc //@ needs-llvm-components: amdgpu //@ needs-rust-lld diff --git a/tests/run-make/avr-rjmp-offset/rmake.rs b/tests/run-make/avr-rjmp-offset/rmake.rs index da314f26ca782..26da27bedf428 100644 --- a/tests/run-make/avr-rjmp-offset/rmake.rs +++ b/tests/run-make/avr-rjmp-offset/rmake.rs @@ -1,3 +1,4 @@ +//@ ignore-test: incompatible with libgc //@ needs-llvm-components: avr //@ needs-rust-lld //! Regression test for #129301/llvm-project#106722 within `rustc`. diff --git a/tests/run-make/linker-warning/short-error.txt b/tests/run-make/linker-warning/short-error.txt index 9e810af38d1d5..34cdb4519777e 100644 --- a/tests/run-make/linker-warning/short-error.txt +++ b/tests/run-make/linker-warning/short-error.txt @@ -1,6 +1,6 @@ error: linking with `./fake-linker` failed: exit status: 1 | - = note: "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libbdwgc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error" + = note: "./fake-linker" "-m64" "/symbols.o" "-Wl,-rpath,/lib" "-Wl,-Bdynamic" "-Wl,--no-as-needed" "-lgc" "-Wl,--as-needed" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libbdwgc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgc" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "/build-root/bdwgc/lib" "-L" "/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error" = note: some arguments are omitted. use `--verbose` to show all linker arguments = note: error: baz diff --git a/tests/run-make/static-pie/rmake.rs b/tests/run-make/static-pie/rmake.rs index 1557c170f56de..a7d3363030f4e 100644 --- a/tests/run-make/static-pie/rmake.rs +++ b/tests/run-make/static-pie/rmake.rs @@ -1,6 +1,7 @@ // How to manually run this // $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] tests/run-make/static-pie +//@ ignore-test: not supported with libgc //@ only-x86_64 //@ only-linux //@ ignore-32bit diff --git a/tests/ui/amdgpu-require-explicit-cpu.rs b/tests/ui/amdgpu-require-explicit-cpu.rs index 46778a1094fab..31ab9eb9335e0 100644 --- a/tests/ui/amdgpu-require-explicit-cpu.rs +++ b/tests/ui/amdgpu-require-explicit-cpu.rs @@ -1,3 +1,4 @@ +//@ ignore-test //@ revisions: nocpu cpu //@ no-prefer-dynamic //@ compile-flags: --crate-type=cdylib --target=amdgcn-amd-amdhsa diff --git a/tests/ui/link-native-libs/issue-70093/link-native-libraries.rs b/tests/ui/link-native-libs/issue-70093/link-native-libraries.rs index b4dc9fb5cde17..2d6715d700228 100644 --- a/tests/ui/link-native-libs/issue-70093/link-native-libraries.rs +++ b/tests/ui/link-native-libs/issue-70093/link-native-libraries.rs @@ -1,7 +1,7 @@ // Ensure that rust does not pass native libraries to the linker when // `-Zlink-native-libraries=no` is used. -//@ run-pass +//@ ignore-test //@ compile-flags: -Zlink-native-libraries=no -Cdefault-linker-libraries=yes //@ ignore-fuchsia - missing __libc_start_main for some reason (#84733) //@ ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling diff --git a/tests/ui/runtime/gc/unchecked_finalizer.rs b/tests/ui/runtime/gc/unchecked_finalizer.rs index 87a1e42b9f7a1..788b7de1e7072 100644 --- a/tests/ui/runtime/gc/unchecked_finalizer.rs +++ b/tests/ui/runtime/gc/unchecked_finalizer.rs @@ -1,4 +1,4 @@ -//@ run-pass +//@ ignore-test // ignore-tidy-linelength #![feature(gc)] #![feature(rustc_private)]