diff --git a/.gitignore b/.gitignore index f306e10..61d9a93 100644 --- a/.gitignore +++ b/.gitignore @@ -441,3 +441,5 @@ /rustc-1.80.1-src.tar.xz /wasi-libc-3f43ea9abb24ed8d24d760989e1d87ea385f8eaa.tar.gz /rustc-1.81.0-src.tar.xz +/wasi-libc-b9ef79d7dbd47c6c5bafdae760823467c2f60b70.tar.gz +/rustc-1.82.0-src.tar.xz diff --git a/0001-Drop-debug-info-that-would-conflict-and-trigger-1319.patch b/0001-Drop-debug-info-that-would-conflict-and-trigger-1319.patch new file mode 100644 index 0000000..548dcf5 --- /dev/null +++ b/0001-Drop-debug-info-that-would-conflict-and-trigger-1319.patch @@ -0,0 +1,69 @@ +From b4b8777b049f7394fff8eefaaa3b4cb3a8f16ff4 Mon Sep 17 00:00:00 2001 +From: Kyle Huey +Date: Tue, 22 Oct 2024 10:58:56 -0700 +Subject: [PATCH] Drop debug info that would conflict and trigger #131944 + +--- + .../rustc_codegen_ssa/src/mir/debuginfo.rs | 25 +++++++++++++------ + 1 file changed, 18 insertions(+), 7 deletions(-) + +diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs +index 75692540c034..35cb0e25b6cc 100644 +--- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs ++++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs +@@ -448,7 +448,8 @@ pub fn compute_per_local_var_debug_info( + } + + let mut per_local = IndexVec::from_elem(vec![], &self.mir.local_decls); +- let mut params_seen: FxHashMap<_, Bx::DIVariable> = Default::default(); ++ let mut params_seen: FxHashMap<_, (Bx::DIVariable, Span, mir::SourceScope)> = ++ Default::default(); + for var in &self.mir.var_debug_info { + let dbg_scope_and_span = if full_debug_info { + self.adjusted_span_and_dbg_scope(var.source_info) +@@ -467,7 +468,7 @@ pub fn compute_per_local_var_debug_info( + } + }; + +- let dbg_var = dbg_scope_and_span.map(|(dbg_scope, _, span)| { ++ let dbg_var = dbg_scope_and_span.and_then(|(dbg_scope, _, span)| { + let var_kind = if let Some(arg_index) = var.argument_index + && var.composite.is_none() + && let mir::VarDebugInfoContents::Place(place) = var.value +@@ -493,18 +494,28 @@ pub fn compute_per_local_var_debug_info( + VariableKind::LocalVariable + }; + +- if let VariableKind::ArgumentVariable(arg_index) = var_kind { ++ Some(if let VariableKind::ArgumentVariable(arg_index) = var_kind { + match params_seen.entry((dbg_scope, arg_index)) { +- Entry::Occupied(o) => o.get().clone(), ++ Entry::Occupied(o) => { ++ let (seen_var, seen_span, seen_source_scope) = o.get(); ++ if *seen_span == span && *seen_source_scope != var.source_info.scope { ++ return None; ++ } else { ++ seen_var.clone() ++ } ++ } + Entry::Vacant(v) => v +- .insert( ++ .insert(( + self.cx.create_dbg_var(var.name, var_ty, dbg_scope, var_kind, span), +- ) ++ span, ++ var.source_info.scope, ++ )) ++ .0 + .clone(), + } + } else { + self.cx.create_dbg_var(var.name, var_ty, dbg_scope, var_kind, span) +- } ++ }) + }); + + let fragment = if let Some(ref fragment) = var.composite { +-- +2.47.0 + diff --git a/0001-Fix-enabling-wasm-component-ld-to-match-other-tools.patch b/0001-Fix-enabling-wasm-component-ld-to-match-other-tools.patch new file mode 100644 index 0000000..5364012 --- /dev/null +++ b/0001-Fix-enabling-wasm-component-ld-to-match-other-tools.patch @@ -0,0 +1,147 @@ +From c15469a7fec811d1a4f69ff26e18c6f383df41d2 Mon Sep 17 00:00:00 2001 +From: Alex Crichton +Date: Fri, 6 Sep 2024 09:21:33 -0700 +Subject: [PATCH] Fix enabling wasm-component-ld to match other tools + +It was [pointed out recently][comment] that enabling `wasm-component-ld` +as a host tool is different from other host tools. This commit refactors +the logic to match by deduplicating selection of when to build other +tools and then using the same logic for `wasm-component-ld`. + +[comment]: https://github.com/rust-lang/rust/pull/127866#issuecomment-2333434720 +--- + src/bootstrap/src/core/build_steps/compile.rs | 2 +- + src/bootstrap/src/core/build_steps/dist.rs | 2 +- + src/bootstrap/src/core/build_steps/tool.rs | 38 +++---------------- + src/bootstrap/src/lib.rs | 17 +++++---- + 4 files changed, 17 insertions(+), 42 deletions(-) + +diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs +index 1936c91ef83c..102c9fd25543 100644 +--- a/src/bootstrap/src/core/build_steps/compile.rs ++++ b/src/bootstrap/src/core/build_steps/compile.rs +@@ -1912,7 +1912,7 @@ fn run(self, builder: &Builder<'_>) -> Compiler { + // delegates to the `rust-lld` binary for linking and then runs + // logic to create the final binary. This is used by the + // `wasm32-wasip2` target of Rust. +- if builder.build_wasm_component_ld() { ++ if builder.tool_enabled("wasm-component-ld") { + let wasm_component_ld_exe = + builder.ensure(crate::core::build_steps::tool::WasmComponentLd { + compiler: build_compiler, +diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs +index 4957de2e1b79..ccb5656d6716 100644 +--- a/src/bootstrap/src/core/build_steps/dist.rs ++++ b/src/bootstrap/src/core/build_steps/dist.rs +@@ -473,7 +473,7 @@ fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) { + ); + } + } +- if builder.build_wasm_component_ld() { ++ if builder.tool_enabled("wasm-component-ld") { + let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin"); + let ld = exe("wasm-component-ld", compiler.host); + builder.copy_link(&src_dir.join(&ld), &dst_dir.join(&ld)); +diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs +index 3a1eb43b801f..3c2d791c2090 100644 +--- a/src/bootstrap/src/core/build_steps/tool.rs ++++ b/src/bootstrap/src/core/build_steps/tool.rs +@@ -693,14 +693,7 @@ impl Step for Cargo { + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + let builder = run.builder; +- run.path("src/tools/cargo").default_condition( +- builder.config.extended +- && builder.config.tools.as_ref().map_or( +- true, +- // If `tools` is set, search list for this tool. +- |tools| tools.iter().any(|tool| tool == "cargo"), +- ), +- ) ++ run.path("src/tools/cargo").default_condition(builder.tool_enabled("cargo")) + } + + fn make_run(run: RunConfig<'_>) { +@@ -772,14 +765,7 @@ impl Step for RustAnalyzer { + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + let builder = run.builder; +- run.path("src/tools/rust-analyzer").default_condition( +- builder.config.extended +- && builder +- .config +- .tools +- .as_ref() +- .map_or(true, |tools| tools.iter().any(|tool| tool == "rust-analyzer")), +- ) ++ run.path("src/tools/rust-analyzer").default_condition(builder.tool_enabled("rust-analyzer")) + } + + fn make_run(run: RunConfig<'_>) { +@@ -821,12 +807,8 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/tools/rust-analyzer") + .path("src/tools/rust-analyzer/crates/proc-macro-srv-cli") + .default_condition( +- builder.config.extended +- && builder.config.tools.as_ref().map_or(true, |tools| { +- tools.iter().any(|tool| { +- tool == "rust-analyzer" || tool == "rust-analyzer-proc-macro-srv" +- }) +- }), ++ builder.tool_enabled("rust-analyzer") ++ || builder.tool_enabled("rust-analyzer-proc-macro-srv"), + ) + } + +@@ -874,16 +856,8 @@ impl Step for LlvmBitcodeLinker { + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + let builder = run.builder; +- run.path("src/tools/llvm-bitcode-linker").default_condition( +- builder.config.extended +- && builder +- .config +- .tools +- .as_ref() +- .map_or(builder.build.unstable_features(), |tools| { +- tools.iter().any(|tool| tool == "llvm-bitcode-linker") +- }), +- ) ++ run.path("src/tools/llvm-bitcode-linker") ++ .default_condition(builder.tool_enabled("llvm-bitcode-linker")) + } + + fn make_run(run: RunConfig<'_>) { +diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs +index c76ce3409562..780024e307ed 100644 +--- a/src/bootstrap/src/lib.rs ++++ b/src/bootstrap/src/lib.rs +@@ -1407,16 +1407,17 @@ fn default_wasi_runner(&self) -> Option { + None + } + +- /// Returns whether it's requested that `wasm-component-ld` is built as part +- /// of the sysroot. This is done either with the `extended` key in +- /// `config.toml` or with the `tools` set. +- fn build_wasm_component_ld(&self) -> bool { +- if self.config.extended { +- return true; ++ /// Returns whether the specified tool is configured as part of this build. ++ /// ++ /// This requires that both the `extended` key is set and the `tools` key is ++ /// either unset or specifically contains the specified tool. ++ fn tool_enabled(&self, tool: &str) -> bool { ++ if !self.config.extended { ++ return false; + } + match &self.config.tools { +- Some(set) => set.contains("wasm-component-ld"), +- None => false, ++ Some(set) => set.contains(tool), ++ None => true, + } + } + +-- +2.46.0 + diff --git a/0001-bootstrap-allow-disabling-target-self-contained.patch b/0001-bootstrap-allow-disabling-target-self-contained.patch index 4913cd8..428f354 100644 --- a/0001-bootstrap-allow-disabling-target-self-contained.patch +++ b/0001-bootstrap-allow-disabling-target-self-contained.patch @@ -1,4 +1,4 @@ -From 937b23ef51b1d2f3d12adc9bd90dfd27936326dd Mon Sep 17 00:00:00 2001 +From babdaf8354098399ec98c96eb3a3627664d6ba03 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 28 Sep 2023 18:14:28 -0700 Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained @@ -11,10 +11,10 @@ Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained 4 files changed, 22 insertions(+) diff --git a/config.example.toml b/config.example.toml -index 26687bcfb370..381a23f9cead 100644 +index f1dc32234ccf..82207f19d471 100644 --- a/config.example.toml +++ b/config.example.toml -@@ -872,6 +872,11 @@ +@@ -880,6 +880,11 @@ # argument as the test binary. #runner = (string) @@ -27,10 +27,10 @@ index 26687bcfb370..381a23f9cead 100644 # Distribution options # diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs -index 3e79acad1c4b..525b6e956405 100644 +index edf18e2ebf33..d48d027f329c 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs -@@ -357,6 +357,10 @@ fn copy_self_contained_objects( +@@ -367,6 +367,10 @@ fn copy_self_contained_objects( compiler: &Compiler, target: TargetSelection, ) -> Vec<(PathBuf, DependencyType)> { @@ -42,10 +42,10 @@ index 3e79acad1c4b..525b6e956405 100644 t!(fs::create_dir_all(&libdir_self_contained)); let mut target_deps = vec![]; diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs -index 9d5aa795c6c0..720dc53514d3 100644 +index bdfee55d8d18..47fcd50e7e03 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs -@@ -565,6 +565,7 @@ pub struct Target { +@@ -589,6 +589,7 @@ pub struct Target { pub runner: Option, pub no_std: bool, pub codegen_backends: Option>, @@ -53,7 +53,7 @@ index 9d5aa795c6c0..720dc53514d3 100644 } impl Target { -@@ -573,6 +574,9 @@ pub fn from_triple(triple: &str) -> Self { +@@ -597,6 +598,9 @@ pub fn from_triple(triple: &str) -> Self { if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") { target.no_std = true; } @@ -63,7 +63,7 @@ index 9d5aa795c6c0..720dc53514d3 100644 target } } -@@ -1140,6 +1144,7 @@ struct TomlTarget { +@@ -1165,6 +1169,7 @@ struct TomlTarget { no_std: Option = "no-std", codegen_backends: Option> = "codegen-backends", runner: Option = "runner", @@ -71,7 +71,7 @@ index 9d5aa795c6c0..720dc53514d3 100644 } } -@@ -1900,6 +1905,9 @@ fn get_table(option: &str) -> Result { +@@ -1967,6 +1972,9 @@ fn get_table(option: &str) -> Result { if let Some(s) = cfg.no_std { target.no_std = s; } @@ -82,10 +82,10 @@ index 9d5aa795c6c0..720dc53514d3 100644 target.cxx = cfg.cxx.map(PathBuf::from); target.ar = cfg.ar.map(PathBuf::from); diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs -index a8555b2c3673..70c41b51eb96 100644 +index 82b640f54234..f724aba50241 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs -@@ -1361,6 +1361,11 @@ fn no_std(&self, target: TargetSelection) -> Option { +@@ -1326,6 +1326,11 @@ fn no_std(&self, target: TargetSelection) -> Option { self.config.target_config.get(&target).map(|t| t.no_std) } diff --git a/0001-handle-no_std-targets-on-std-builds.patch b/0001-handle-no_std-targets-on-std-builds.patch deleted file mode 100644 index 964b030..0000000 --- a/0001-handle-no_std-targets-on-std-builds.patch +++ /dev/null @@ -1,103 +0,0 @@ -From c41f254ad192a4ab402b40f8bdad169a8163140a Mon Sep 17 00:00:00 2001 -From: onur-ozkan -Date: Thu, 25 Jul 2024 15:59:25 +0300 -Subject: [PATCH] handle no_std targets on std builds - -This change unifies the `Step::run_make` logic and improves it by skipping -std specific crates for no_std targets. - -Signed-off-by: onur-ozkan -(cherry picked from commit 6e247195c644aa924a10c98cc8eb3a28e1a87929) ---- - src/bootstrap/src/core/build_steps/check.rs | 4 ++-- - src/bootstrap/src/core/build_steps/clippy.rs | 3 ++- - src/bootstrap/src/core/build_steps/compile.rs | 23 +++++++++++++++---- - 3 files changed, 22 insertions(+), 8 deletions(-) - -diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs -index 8235d4634b75..bbad3f179ac7 100644 ---- a/src/bootstrap/src/core/build_steps/check.rs -+++ b/src/bootstrap/src/core/build_steps/check.rs -@@ -1,7 +1,7 @@ - //! Implementation of compiling the compiler and standard library, in "check"-based modes. - - use crate::core::build_steps::compile::{ -- add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo, -+ add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo, std_crates_for_run_make, - }; - use crate::core::build_steps::tool::{prepare_tool_cargo, SourceType}; - use crate::core::builder::{ -@@ -47,7 +47,7 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - } - - fn make_run(run: RunConfig<'_>) { -- let crates = run.make_run_crates(Alias::Library); -+ let crates = std_crates_for_run_make(&run); - run.builder.ensure(Std { target: run.target, crates }); - } - -diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs -index 40a2112b1925..a3ab094d799d 100644 ---- a/src/bootstrap/src/core/build_steps/clippy.rs -+++ b/src/bootstrap/src/core/build_steps/clippy.rs -@@ -4,6 +4,7 @@ - - use crate::builder::Builder; - use crate::builder::ShouldRun; -+use crate::core::build_steps::compile::std_crates_for_run_make; - use crate::core::builder; - use crate::core::builder::crate_description; - use crate::core::builder::Alias; -@@ -122,7 +123,7 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - } - - fn make_run(run: RunConfig<'_>) { -- let crates = run.make_run_crates(Alias::Library); -+ let crates = std_crates_for_run_make(&run); - run.builder.ensure(Std { target: run.target, crates }); - } - -diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs -index 525b6e956405..19c8cbc54080 100644 ---- a/src/bootstrap/src/core/build_steps/compile.rs -+++ b/src/bootstrap/src/core/build_steps/compile.rs -@@ -127,11 +127,7 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - } - - fn make_run(run: RunConfig<'_>) { -- // If the paths include "library", build the entire standard library. -- let has_alias = -- run.paths.iter().any(|set| set.assert_single_path().path.ends_with("library")); -- let crates = if has_alias { Default::default() } else { run.cargo_crates_in_set() }; -- -+ let crates = std_crates_for_run_make(&run); - run.builder.ensure(Std { - compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()), - target: run.target, -@@ -428,6 +424,23 @@ fn copy_self_contained_objects( - target_deps - } - -+/// Resolves standard library crates for `Std::run_make` for any build kind (like check, build, clippy, etc.). -+pub fn std_crates_for_run_make(run: &RunConfig<'_>) -> Vec { -+ let has_alias = run.paths.iter().any(|set| set.assert_single_path().path.ends_with("library")); -+ let target_is_no_std = run.builder.no_std(run.target).unwrap_or(false); -+ -+ // For no_std targets, do not add any additional crates to the compilation other than what `compile::std_cargo` already adds for no_std targets. -+ if target_is_no_std { -+ vec![] -+ } -+ // If the paths include "library", build the entire standard library. -+ else if has_alias { -+ run.make_run_crates(builder::Alias::Library) -+ } else { -+ run.cargo_crates_in_set() -+ } -+} -+ - /// Configure cargo to compile the standard library, adding appropriate env vars - /// and such. - pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, cargo: &mut Cargo) { --- -2.46.0 - diff --git a/0002-set-an-external-library-path-for-wasm32-wasi.patch b/0002-set-an-external-library-path-for-wasm32-wasi.patch index 5d8c836..feeb0f3 100644 --- a/0002-set-an-external-library-path-for-wasm32-wasi.patch +++ b/0002-set-an-external-library-path-for-wasm32-wasi.patch @@ -1,19 +1,19 @@ -From 348b03695d916ab23a9d66c4ceed2ecbecfc68e7 Mon Sep 17 00:00:00 2001 +From 3fdce19416e80a48c5b2b77b2cdec697d0b5e225 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 28 Sep 2023 18:18:16 -0700 Subject: [PATCH 2/2] set an external library path for wasm32-wasi --- - compiler/rustc_codegen_ssa/src/back/link.rs | 9 +++++++++ - compiler/rustc_target/src/spec/mod.rs | 4 ++++ - compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++--- - 3 files changed, 17 insertions(+), 3 deletions(-) + compiler/rustc_codegen_ssa/src/back/link.rs | 10 ++++++++++ + compiler/rustc_target/src/spec/mod.rs | 4 ++++ + .../rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++--- + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs -index 8c582fac0d82..169d86cd6224 100644 +index e8143b9a5f38..5a928a18b3ea 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs -@@ -1586,6 +1586,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat +@@ -1621,6 +1621,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat return file_path; } } @@ -23,13 +23,14 @@ index 8c582fac0d82..169d86cd6224 100644 + return file_path; + } + } - for search_path in fs.search_paths() { + for search_path in sess.target_filesearch(PathKind::Native).search_paths() { let file_path = search_path.dir.join(name); if file_path.exists() { -@@ -2076,6 +2082,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained: - let lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path(); - cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); - } +@@ -2123,6 +2129,10 @@ fn add_library_search_dirs( + ControlFlow::<()>::Continue(()) + }, + ); ++ + if let Some(lib_path) = &sess.target.options.external_lib_path { + cmd.include_path(Path::new(lib_path.as_ref())); + } @@ -37,10 +38,10 @@ index 8c582fac0d82..169d86cd6224 100644 /// Add options making relocation sections in the produced ELF files read-only diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs -index 607eeac7ccdc..63070622502e 100644 +index d5f227a84a4c..54c22c8ebed6 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs -@@ -2033,6 +2033,7 @@ pub struct TargetOptions { +@@ -2053,6 +2053,7 @@ pub struct TargetOptions { /// Objects to link before and after all other object code. pub pre_link_objects: CrtObjects, pub post_link_objects: CrtObjects, @@ -48,7 +49,7 @@ index 607eeac7ccdc..63070622502e 100644 /// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled. pub pre_link_objects_self_contained: CrtObjects, pub post_link_objects_self_contained: CrtObjects, -@@ -2520,6 +2521,7 @@ fn default() -> TargetOptions { +@@ -2540,6 +2541,7 @@ fn default() -> TargetOptions { relro_level: RelroLevel::None, pre_link_objects: Default::default(), post_link_objects: Default::default(), @@ -56,7 +57,7 @@ index 607eeac7ccdc..63070622502e 100644 pre_link_objects_self_contained: Default::default(), post_link_objects_self_contained: Default::default(), link_self_contained: LinkSelfContainedDefault::False, -@@ -3202,6 +3204,7 @@ macro_rules! key { +@@ -3221,6 +3223,7 @@ macro_rules! key { key!(linker_is_gnu_json = "linker-is-gnu", bool); key!(pre_link_objects = "pre-link-objects", link_objects); key!(post_link_objects = "post-link-objects", link_objects); @@ -64,7 +65,7 @@ index 607eeac7ccdc..63070622502e 100644 key!(pre_link_objects_self_contained = "pre-link-objects-fallback", link_objects); key!(post_link_objects_self_contained = "post-link-objects-fallback", link_objects); // Deserializes the backwards-compatible variants of `-Clink-self-contained` -@@ -3464,6 +3467,7 @@ macro_rules! target_option_val { +@@ -3482,6 +3485,7 @@ macro_rules! target_option_val { target_option_val!(linker_is_gnu_json, "linker-is-gnu"); target_option_val!(pre_link_objects); target_option_val!(post_link_objects); @@ -73,10 +74,10 @@ index 607eeac7ccdc..63070622502e 100644 target_option_val!(post_link_objects_self_contained, "post-link-objects-fallback"); target_option_val!(link_args - pre_link_args_json, "pre-link-args"); diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs -index a8e7f22c0689..55949557d6bb 100644 +index 29e6dff2068f..dbe021ef064c 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs -@@ -21,11 +21,12 @@ pub fn target() -> Target { +@@ -19,11 +19,12 @@ pub fn target() -> Target { options.env = "p1".into(); options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasi"]); diff --git a/rust.spec b/rust.spec index 29c67ef..99f425f 100644 --- a/rust.spec +++ b/rust.spec @@ -1,6 +1,6 @@ Name: rust -Version: 1.81.0 -Release: %autorelease +Version: 1.82.0 +Release: 1%{?dist} Summary: The Rust Programming Language License: (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-DFS-2016) # ^ written as: (rust itself) and (bundled libraries) @@ -14,9 +14,9 @@ ExclusiveArch: %{rust_arches} # To bootstrap from scratch, set the channel and date from src/stage0.json # e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13 # or nightly wants some beta-YYYY-MM-DD -%global bootstrap_version 1.80.1 -%global bootstrap_channel 1.80.1 -%global bootstrap_date 2024-08-08 +%global bootstrap_version 1.81.0 +%global bootstrap_channel 1.81.0 +%global bootstrap_date 2024-09-05 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -46,6 +46,9 @@ ExclusiveArch: %{rust_arches} %if 0%{?fedora} %global extra_targets aarch64-unknown-none-softfloat aarch64-unknown-uefi %endif +%if 0%{?rhel} >= 10 +%global extra_targets aarch64-unknown-none-softfloat +%endif %endif %global all_targets %{?mingw_targets} %{?wasm_targets} %{?extra_targets} %define target_enabled() %{lua: @@ -55,8 +58,8 @@ ExclusiveArch: %{rust_arches} # We need CRT files for *-wasi targets, at least as new as the commit in # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh %global wasi_libc_url https://github.com/WebAssembly/wasi-libc -#global wasi_libc_ref wasi-sdk-23 -%global wasi_libc_ref 3f43ea9abb24ed8d24d760989e1d87ea385f8eaa +#global wasi_libc_ref wasi-sdk-24 +%global wasi_libc_ref b9ef79d7dbd47c6c5bafdae760823467c2f60b70 %global wasi_libc_name wasi-libc-%{wasi_libc_ref} %global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_ref}/%{wasi_libc_name}.tar.gz %global wasi_libc_dir %{_builddir}/%{wasi_libc_name} @@ -72,17 +75,17 @@ ExclusiveArch: %{rust_arches} # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 17.0+. %global min_llvm_version 17.0.0 -%global bundled_llvm_version 18.1.7 +%global bundled_llvm_version 19.1.1 #global llvm_compat_version 17 %global llvm llvm%{?llvm_compat_version} %bcond_with bundled_llvm -# Requires stable libgit2 1.7, and not the next minor soname change. +# Requires stable libgit2 1.8, and not the next minor soname change. # This needs to be consistent with the bindings in vendor/libgit2-sys. %global min_libgit2_version 1.8.1 %global next_libgit2_version 1.9.0~ %global bundled_libgit2_version 1.8.1 -%if 0%{?fedora} >= 42 +%if 0%{?fedora} >= 41 %bcond_with bundled_libgit2 %else %bcond_without bundled_libgit2 @@ -90,7 +93,7 @@ ExclusiveArch: %{rust_arches} # Cargo uses UPSERTs with omitted conflict targets %global min_sqlite3_version 3.35 -%global bundled_sqlite3_version 3.45.0 +%global bundled_sqlite3_version 3.46.0 %if 0%{?rhel} && 0%{?rhel} < 10 %bcond_without bundled_sqlite3 %else @@ -156,11 +159,13 @@ Patch4: 0001-bootstrap-allow-disabling-target-self-contained.patch Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch # We don't want to use the bundled library in libsqlite3-sys -Patch6: rustc-1.81.0-unbundle-sqlite.patch +Patch6: rustc-1.82.0-unbundle-sqlite.patch -# handle no_std targets on std builds -# https://github.com/rust-lang/rust/pull/128182 -Patch7: 0001-handle-no_std-targets-on-std-builds.patch +# https://github.com/rust-lang/rust/pull/130034 +Patch7: 0001-Fix-enabling-wasm-component-ld-to-match-other-tools.patch + +# https://github.com/rust-lang/rust/issues/131944#issuecomment-2428361518 +Patch8: 0001-Drop-debug-info-that-would-conflict-and-trigger-1319.patch ### RHEL-specific patches below ### @@ -171,7 +176,7 @@ Source102: cargo_vendor.attr Source103: cargo_vendor.prov # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.81.0-disable-libssh2.patch +Patch100: rustc-1.82.0-disable-libssh2.patch # Get the Rust triple for any arch. %{lua: function rust_triple(arch) @@ -566,6 +571,9 @@ A tool for formatting Rust code according to style guidelines. %package analyzer Summary: Rust implementation of the Language Server Protocol +# /usr/bin/rust-analyzer is dynamically linked against internal rustc libs +Requires: %{name}%{?_isa} = %{version}-%{release} + # The standard library sources are needed for most functionality. Recommends: %{name}-src @@ -666,6 +674,7 @@ rm -rf %{wasi_libc_dir}/dlmalloc/ %patch -P6 -p1 %endif %patch -P7 -p1 +%patch -P8 -p1 %if %with disabled_libssh2 %patch -P100 -p1 @@ -761,9 +770,9 @@ end} %{export_rust_env} # Some builders have relatively little memory for their CPU count. -# At least 2GB per CPU is a good rule of thumb for building rustc. +# At least 4GB per CPU is a good rule of thumb for building rustc. ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN) -max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 2 )) +max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 4 )) if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then ncpus="$max_cpus" fi @@ -854,6 +863,7 @@ test -r "%{profiler}" %global __x %{__python3} ./x.py +%ifnarch ppc64le %if %with rustc_pgo # Build the compiler with profile instrumentation %define profraw $PWD/build/profiles @@ -869,6 +879,7 @@ rm -r "%{profraw}" build/%{rust_triple}/stage2*/ # Redefine the macro to use that profile data from now on %global __x %{__x} --rust-profile-use="%{profdata}" %endif +%endif # Build the compiler normally (with or without PGO) %{__x} build -j "$ncpus" sysroot @@ -998,9 +1009,12 @@ rm -rf "$TMP_HELLO" # The results are not stable on koji, so mask errors and just log it. # Some of the larger test artifacts are manually cleaned to save space. -# Bootstrap is excluded because it's not something we ship, and a lot of its -# tests are geared toward the upstream CI environment. -%{__x} test --no-fail-fast --skip src/bootstrap || : +# - Bootstrap is excluded because it's not something we ship, and a lot of its +# tests are geared toward the upstream CI environment. +# - Crashes are excluded because they are less reliable, especially stuff like +# SIGSEGV across different arches -- UB can do all kinds of weird things. +# They're only meant to notice "accidental" fixes anyway, not *should* crash. +%{__x} test --no-fail-fast --skip={src/bootstrap,tests/crashes} || : rm -rf "./build/%{rust_triple}/test/" %ifarch aarch64 diff --git a/rustc-1.81.0-unbundle-sqlite.patch b/rustc-1.81.0-unbundle-sqlite.patch deleted file mode 100644 index ec3ed1e..0000000 --- a/rustc-1.81.0-unbundle-sqlite.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock ---- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-08-15 09:53:53.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-08-16 10:20:52.394575295 -0700 -@@ -2195,7 +2195,6 @@ version = "0.28.0" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" - dependencies = [ -- "cc", - "pkg-config", - "vcpkg", - ] -diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-08-16 10:20:52.394575295 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-08-16 10:21:50.535122479 -0700 -@@ -77,7 +77,7 @@ proptest = "1.4.0" - pulldown-cmark = { version = "0.11.0", default-features = false, features = ["html"] } - rand = "0.8.5" - regex = "1.10.4" --rusqlite = { version = "0.31.0", features = ["bundled"] } -+rusqlite = { version = "0.31.0", features = [] } - rustfix = { version = "0.8.2", path = "crates/rustfix" } - same-file = "1.0.6" - security-framework = "2.10.0" diff --git a/rustc-1.81.0-disable-libssh2.patch b/rustc-1.82.0-disable-libssh2.patch similarity index 69% rename from rustc-1.81.0-disable-libssh2.patch rename to rustc-1.82.0-disable-libssh2.patch index abee3c3..69f5704 100644 --- a/rustc-1.81.0-disable-libssh2.patch +++ b/rustc-1.82.0-disable-libssh2.patch @@ -1,7 +1,7 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock ---- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-08-26 09:03:52.769956890 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-08-26 09:03:52.773956573 -0700 -@@ -2155,7 +2155,6 @@ checksum = "10472326a8a6477c3c20a64547b0 +--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-09-06 10:36:55.743405666 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-09-06 10:36:55.745405652 -0700 +@@ -2156,7 +2156,6 @@ checksum = "10472326a8a6477c3c20a64547b0 dependencies = [ "cc", "libc", @@ -9,7 +9,7 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools "libz-sys", "openssl-sys", "pkg-config", -@@ -2196,20 +2195,6 @@ dependencies = [ +@@ -2197,20 +2196,6 @@ dependencies = [ "pkg-config", "vcpkg", ] @@ -31,10 +31,10 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools [[package]] name = "libz-sys" diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-08-26 09:03:52.773956573 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-08-26 09:05:08.595934397 -0700 +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-09-06 10:36:55.746405645 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-09-06 10:37:13.849280464 -0700 @@ -44,7 +44,7 @@ curl = "0.4.46" - curl-sys = "0.4.72" + curl-sys = "0.4.73" filetime = "0.2.23" flate2 = { version = "1.0.30", default-features = false, features = ["zlib"] } -git2 = "0.19.0" diff --git a/rustc-1.82.0-unbundle-sqlite.patch b/rustc-1.82.0-unbundle-sqlite.patch new file mode 100644 index 0000000..f01397a --- /dev/null +++ b/rustc-1.82.0-unbundle-sqlite.patch @@ -0,0 +1,23 @@ +diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock +--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-09-06 10:30:29.435107742 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-09-06 10:31:57.168492758 -0700 +@@ -2194,7 +2194,6 @@ version = "0.30.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" + dependencies = [ +- "cc", + "pkg-config", + "vcpkg", + ] +diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-09-06 10:30:29.435107742 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-09-06 10:31:27.942697616 -0700 +@@ -77,7 +77,7 @@ proptest = "1.5.0" + pulldown-cmark = { version = "0.11.0", default-features = false, features = ["html"] } + rand = "0.8.5" + regex = "1.10.5" +-rusqlite = { version = "0.32.0", features = ["bundled"] } ++rusqlite = { version = "0.32.0", features = [] } + rustfix = { version = "0.8.2", path = "crates/rustfix" } + same-file = "1.0.6" + security-framework = "2.11.1" diff --git a/sources b/sources index 6e100e8..2f35a76 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.81.0-src.tar.xz) = b8a837ced521d2ca2c7f228a0640da591384519e4dbc1ae768524d50616da6abbd2f7bdae3777caebc0447dac91bf76481282ce5a2264d7f30e173caa6321a51 -SHA512 (wasi-libc-3f43ea9abb24ed8d24d760989e1d87ea385f8eaa.tar.gz) = 845380a421bd002f0ccbbbf49cb16f36b4fb6401f98c9ccfa54d3a75832ca547f2823eedc3788be0a99cd582d9eb8ef5f16d828a6116ded133908ec9a7f20cf7 +SHA512 (rustc-1.82.0-src.tar.xz) = d158c7c71c1814bde2a3ec3cbeabe34949bd3201b730c0d7ec6baad4158bb28dd13696c430a6b99dc38b9d23ad7ddf8dde7d2487cbfbbbe9c3473016994210f0 +SHA512 (wasi-libc-b9ef79d7dbd47c6c5bafdae760823467c2f60b70.tar.gz) = 089ee1f9faeccae85697823d415e34aac56df28cd9db99952a148cb9f91532edbae4ea78f8cd9a223903caadeeb17cbc31d55ea65b020692e4841ddf3914821e