From fbf19ab00e07cba408d3c2d5856b3c21b3d35acb Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 22 Sep 2022 13:06:42 -0700 Subject: [PATCH 01/45] Update to 1.64.0. Add rust-analyzer. --- .gitignore | 1 + ...ansmute-fix-big-endian-discriminants.patch | 53 +++++++++++++++ rust.spec | 64 +++++++++++++------ ...patch => rustc-1.64.0-no-default-pie.patch | 9 +-- sources | 2 +- 5 files changed, 105 insertions(+), 24 deletions(-) create mode 100644 0001-rustc_transmute-fix-big-endian-discriminants.patch rename rustc-1.58.0-no-default-pie.patch => rustc-1.64.0-no-default-pie.patch (90%) diff --git a/.gitignore b/.gitignore index a82d7cc..28ca26f 100644 --- a/.gitignore +++ b/.gitignore @@ -404,3 +404,4 @@ /rustc-1.62.0-src.tar.xz /rustc-1.62.1-src.tar.xz /rustc-1.63.0-src.tar.xz +/rustc-1.64.0-src.tar.xz diff --git a/0001-rustc_transmute-fix-big-endian-discriminants.patch b/0001-rustc_transmute-fix-big-endian-discriminants.patch new file mode 100644 index 0000000..372852d --- /dev/null +++ b/0001-rustc_transmute-fix-big-endian-discriminants.patch @@ -0,0 +1,53 @@ +From 2946828fcb8e2e68a16839dfcf4319bf119f8acd Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Tue, 20 Sep 2022 13:03:43 -0700 +Subject: [PATCH] rustc_transmute: fix big-endian discriminants + +(cherry picked from commit a72666ed56ec5f1b6d254c7020cf86143edc6dbd) +--- + compiler/rustc_transmute/src/layout/tree.rs | 22 +++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs +index 70b3ba02b05b..e4fcde35ed37 100644 +--- a/compiler/rustc_transmute/src/layout/tree.rs ++++ b/compiler/rustc_transmute/src/layout/tree.rs +@@ -402,7 +402,7 @@ fn from_repr_c_variant( + .unwrap(); + tracing::trace!(?discr_layout, "computed discriminant layout"); + variant_layout = variant_layout.extend(discr_layout).unwrap().0; +- tree = tree.then(Self::from_disr(discr, tcx, layout_summary.discriminant_size)); ++ tree = tree.then(Self::from_discr(discr, tcx, layout_summary.discriminant_size)); + } + + // Next come fields. +@@ -442,11 +442,21 @@ fn from_repr_c_variant( + Ok(tree) + } + +- pub fn from_disr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self { +- // FIXME(@jswrenn): I'm certain this is missing needed endian nuance. +- let bytes = discr.val.to_ne_bytes(); +- let bytes = &bytes[..size]; +- Self::Seq(bytes.into_iter().copied().map(|b| Self::from_bits(b)).collect()) ++ pub fn from_discr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self { ++ use rustc_target::abi::Endian; ++ ++ let bytes: [u8; 16]; ++ let bytes = match tcx.data_layout.endian { ++ Endian::Little => { ++ bytes = discr.val.to_le_bytes(); ++ &bytes[..size] ++ } ++ Endian::Big => { ++ bytes = discr.val.to_be_bytes(); ++ &bytes[bytes.len() - size..] ++ } ++ }; ++ Self::Seq(bytes.iter().map(|&b| Self::from_bits(b)).collect()) + } + } + +-- +2.37.3 + diff --git a/rust.spec b/rust.spec index 9f4aa26..a0953ba 100644 --- a/rust.spec +++ b/rust.spec @@ -8,9 +8,9 @@ # 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.62.0 -%global bootstrap_channel 1.62.0 -%global bootstrap_date 2022-06-30 +%global bootstrap_version 1.63.0 +%global bootstrap_channel 1.63.0 +%global bootstrap_date 2022-08-11 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -46,7 +46,7 @@ # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 12.0+. %global min_llvm_version 12.0.0 -%global bundled_llvm_version 14.0.5 +%global bundled_llvm_version 14.0.6 %bcond_with bundled_llvm # Requires stable libgit2 1.4, and not the next minor soname change. @@ -83,7 +83,7 @@ %endif Name: rust -Version: 1.63.0 +Version: 1.64.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -106,6 +106,9 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch +# https://github.com/rust-lang/rust/pull/102076 +Patch3: 0001-rustc_transmute-fix-big-endian-discriminants.patch + ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) @@ -120,7 +123,7 @@ Patch101: rustc-1.63.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) -Patch102: rustc-1.58.0-no-default-pie.patch +Patch102: rustc-1.64.0-no-default-pie.patch # Get the Rust triple for any arch. @@ -486,7 +489,7 @@ A tool for formatting Rust code according to style guidelines. %package -n rls -Summary: Rust Language Server for IDE integration +Summary: Rust Language Server for IDE integration (deprecated) %if %with bundled_libgit2 Provides: bundled(libgit2) = %{bundled_libgit2_version} %endif @@ -501,8 +504,17 @@ Provides: rls-preview = %{version}-%{release} %description -n rls The Rust Language Server provides a server that runs in the background, providing IDEs, editors, and other tools with information about Rust programs. -It supports functionality such as 'goto definition', symbol search, -reformatting, and code completion, and enables renaming and refactorings. +RLS is being deprecated in favor of rust-analyzer, and may be removed in the future. +https://blog.rust-lang.org/2022/07/01/RLS-deprecation.html + + +%package analyzer +Summary: Rust implementation of the Language Server Protocol + +%description analyzer +rust-analyzer is an implementation of Language Server Protocol for the Rust +programming language. It provides features like completion and goto definition +for many code editors, including VS Code, Emacs and Vim. %package -n clippy @@ -574,6 +586,7 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 +%patch3 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -736,7 +749,7 @@ end} %{enable_debuginfo} \ --set rust.codegen-units-std=1 \ --enable-extended \ - --tools=analysis,cargo,clippy,rls,rustfmt,src \ + --tools=analysis,cargo,clippy,rls,rust-analyzer,rustfmt,src \ --enable-vendor \ --enable-verbose-tests \ --dist-compression-formats=gz \ @@ -776,15 +789,15 @@ find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \ # The libdir libraries are identical to those under rustlib/. It's easier on # library loading if we keep them in libdir, but we do need them in rustlib/ # to support dynamic linking for compiler plugins, so we'll symlink. -(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && - find ../../../../%{_lib} -maxdepth 1 -name '*.so' | - while read lib; do - if [ -f "${lib##*/}" ]; then - # make sure they're actually identical! - cmp "$lib" "${lib##*/}" - ln -v -f -s -t . "$lib" - fi - done) +find %{buildroot}%{rustlibdir}/%{rust_triple}/lib/ -maxdepth 1 -type f -name '*.so' | +while read lib; do + lib2="%{buildroot}%{_libdir}/${lib##*/}" + if [ -f "$lib2" ]; then + # make sure they're actually identical! + cmp "$lib" "$lib2" + ln -v -f -r -s -T "$lib2" "$lib" + fi +done # Remove installer artifacts (manifests, uninstall scripts, etc.) find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+' @@ -863,6 +876,8 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" env RLS_TEST_WAIT_FOR_AGES=1 \ %{__python3} ./x.py test --no-fail-fast --stage 2 rls || : +%{__python3} ./x.py test --no-fail-fast --stage 2 rust-analyzer || : + %{__python3} ./x.py test --no-fail-fast --stage 2 rustfmt || : @@ -875,6 +890,7 @@ env RLS_TEST_WAIT_FOR_AGES=1 \ %{_bindir}/rustc %{_bindir}/rustdoc %{_libdir}/*.so +%{_libexecdir}/rust-analyzer-proc-macro-srv %{_mandir}/man1/rustc.1* %{_mandir}/man1/rustdoc.1* %dir %{rustlibdir} @@ -1009,6 +1025,12 @@ end} %license src/tools/rls/LICENSE-{APACHE,MIT} +%files analyzer +%{_bindir}/rust-analyzer +%doc src/tools/rust-analyzer/README.md +%license src/tools/rust-analyzer/LICENSE-{APACHE,MIT} + + %files -n clippy %{_bindir}/cargo-clippy %{_bindir}/clippy-driver @@ -1032,6 +1054,10 @@ end} %changelog +* Thu Sep 22 2022 Josh Stone - 1.64.0-1 +- Update to 1.64.0. +- Add rust-analyzer. + * Thu Aug 11 2022 Josh Stone - 1.63.0-1 - Update to 1.63.0. diff --git a/rustc-1.58.0-no-default-pie.patch b/rustc-1.64.0-no-default-pie.patch similarity index 90% rename from rustc-1.58.0-no-default-pie.patch rename to rustc-1.64.0-no-default-pie.patch index 67fb0c6..c9dd827 100644 --- a/rustc-1.58.0-no-default-pie.patch +++ b/rustc-1.64.0-no-default-pie.patch @@ -1,8 +1,8 @@ diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs -index 638b2a7b5a9f..79d4ecf4cb91 100644 +index 63207803e327..f5757760c409 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs -@@ -763,7 +763,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( +@@ -741,7 +741,7 @@ fn link_natively<'a>( && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie") { info!("linker output: {:?}", out); @@ -11,7 +11,7 @@ index 638b2a7b5a9f..79d4ecf4cb91 100644 for arg in cmd.take_args() { if arg.to_string_lossy() != "-no-pie" { cmd.arg(arg); -@@ -782,7 +782,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( +@@ -760,7 +760,7 @@ fn link_natively<'a>( && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie") { info!("linker output: {:?}", out); @@ -20,12 +20,13 @@ index 638b2a7b5a9f..79d4ecf4cb91 100644 "Linker does not support -static-pie command line option. Retrying with -static instead." ); // Mirror `add_(pre,post)_link_objects` to replace CRT objects. -@@ -1507,15 +1507,14 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +@@ -1507,15 +1507,15 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { } fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind { - let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) { + // Only use PIE if explicitly specified. ++ #[cfg_attr(not(bootstrap), allow(rustc::bad_opt_access))] + let explicit_pic = + matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic | RelocModel::Pie)); + let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) { diff --git a/sources b/sources index 88d8af1..ce4b974 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.63.0-src.tar.xz) = 0dd3cd1546bd9c1438afe0c4694e1ed80507f6b437674682c0474e13f83457e9ced4560ddeee58602e01837140f9e34a9e24c6828643dd6f613e07755af6997c +SHA512 (rustc-1.64.0-src.tar.xz) = 919f40acd8c6eaaef399aa3248503bea19feb96697ab221aaede9ee789ce340b47cb899d1e0e41a31e5d7756653968a10d2faaa4aee83294c9f1243949b43516 SHA512 (wasi-libc-9886d3d6200fcc3726329966860fc058707406cd.tar.gz) = 5b6af0f7133d31c2c068606737eff957126a3045e09c1e95bd2650e0c5637d4797d7036b9beb167829d38d58f6d4199852832f61b0c8836f05e945cd0cf68132 From f5bf4afaf13e3522766392cd9e5c237b6f47c5bf Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 3 Nov 2022 10:40:06 -0700 Subject: [PATCH 02/45] Update to 1.65.0. rust-analyzer now obsoletes rls. --- .gitignore | 2 + ...the-dylib-path-when-gathering-target.patch | 182 ++++++++++++++++++ ...ansmute-fix-big-endian-discriminants.patch | 11 +- rust.spec | 146 +++++++------- rustc-1.59.0-disable-libssh2.patch | 42 ---- ....patch => rustc-1.65.0-disable-http2.patch | 24 +-- rustc-1.65.0-disable-libssh2.patch | 43 +++++ ...patch => rustc-1.65.0-no-default-pie.patch | 14 +- sources | 4 +- 9 files changed, 326 insertions(+), 142 deletions(-) create mode 100644 0001-compiletest-set-the-dylib-path-when-gathering-target.patch delete mode 100644 rustc-1.59.0-disable-libssh2.patch rename rustc-1.63.0-disable-http2.patch => rustc-1.65.0-disable-http2.patch (76%) create mode 100644 rustc-1.65.0-disable-libssh2.patch rename rustc-1.64.0-no-default-pie.patch => rustc-1.65.0-no-default-pie.patch (81%) diff --git a/.gitignore b/.gitignore index 28ca26f..7cce16d 100644 --- a/.gitignore +++ b/.gitignore @@ -405,3 +405,5 @@ /rustc-1.62.1-src.tar.xz /rustc-1.63.0-src.tar.xz /rustc-1.64.0-src.tar.xz +/rustc-1.65.0-src.tar.xz +/wasi-libc-wasi-sdk-16.tar.gz diff --git a/0001-compiletest-set-the-dylib-path-when-gathering-target.patch b/0001-compiletest-set-the-dylib-path-when-gathering-target.patch new file mode 100644 index 0000000..9fcfb3f --- /dev/null +++ b/0001-compiletest-set-the-dylib-path-when-gathering-target.patch @@ -0,0 +1,182 @@ +From 92b0b20e4119241aaeabb4b91189a9fca8ff8b5d Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 14 Oct 2022 16:11:28 -0700 +Subject: [PATCH] compiletest: set the dylib path when gathering target cfg + +If the compiler is built with `rpath = false`, then it won't find its +own libraries unless the library search path is set. We already do that +while running the actual compiletests, but #100260 added another rustc +command for getting the target cfg. + + Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) + thread 'main' panicked at 'error: failed to get cfg info from "[...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" + --- stdout + + --- stderr + [...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-a2a76dc626cd02d2.so: cannot open shared object file: No such file or directory + ', src/tools/compiletest/src/common.rs:476:13 + +Now the library path is set here as well, so it works without rpath. + +(cherry picked from commit 97c3608326d123f5462e3504409a3a069611c0fb) +--- + src/tools/compiletest/src/common.rs | 17 ++++++++++------- + src/tools/compiletest/src/runtest.rs | 27 +++------------------------ + src/tools/compiletest/src/util.rs | 23 +++++++++++++++++++++++ + 3 files changed, 36 insertions(+), 31 deletions(-) + +diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs +index 64df76e27720..53b64e7d1fc3 100644 +--- a/src/tools/compiletest/src/common.rs ++++ b/src/tools/compiletest/src/common.rs +@@ -2,11 +2,12 @@ + + use std::ffi::OsString; + use std::fmt; ++use std::iter; + use std::path::{Path, PathBuf}; + use std::process::Command; + use std::str::FromStr; + +-use crate::util::PathBufExt; ++use crate::util::{add_dylib_path, PathBufExt}; + use lazycell::LazyCell; + use test::ColorConfig; + +@@ -389,7 +390,7 @@ pub fn run_enabled(&self) -> bool { + } + + fn target_cfg(&self) -> &TargetCfg { +- self.target_cfg.borrow_with(|| TargetCfg::new(&self.rustc_path, &self.target)) ++ self.target_cfg.borrow_with(|| TargetCfg::new(self)) + } + + pub fn matches_arch(&self, arch: &str) -> bool { +@@ -455,20 +456,22 @@ pub enum Endian { + } + + impl TargetCfg { +- fn new(rustc_path: &Path, target: &str) -> TargetCfg { +- let output = match Command::new(rustc_path) ++ fn new(config: &Config) -> TargetCfg { ++ let mut command = Command::new(&config.rustc_path); ++ add_dylib_path(&mut command, iter::once(&config.compile_lib_path)); ++ let output = match command + .arg("--print=cfg") + .arg("--target") +- .arg(target) ++ .arg(&config.target) + .output() + { + Ok(output) => output, +- Err(e) => panic!("error: failed to get cfg info from {:?}: {e}", rustc_path), ++ Err(e) => panic!("error: failed to get cfg info from {:?}: {e}", config.rustc_path), + }; + if !output.status.success() { + panic!( + "error: failed to get cfg info from {:?}\n--- stdout\n{}\n--- stderr\n{}", +- rustc_path, ++ config.rustc_path, + String::from_utf8(output.stdout).unwrap(), + String::from_utf8(output.stderr).unwrap(), + ); +diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs +index 8f289876f730..eb467170249d 100644 +--- a/src/tools/compiletest/src/runtest.rs ++++ b/src/tools/compiletest/src/runtest.rs +@@ -13,7 +13,7 @@ + use crate::header::TestProps; + use crate::json; + use crate::read2::read2_abbreviated; +-use crate::util::{logv, PathBufExt}; ++use crate::util::{add_dylib_path, dylib_env_var, logv, PathBufExt}; + use crate::ColorConfig; + use regex::{Captures, Regex}; + use rustfix::{apply_suggestions, get_suggestions_from_json, Filter}; +@@ -26,6 +26,7 @@ + use std::hash::{Hash, Hasher}; + use std::io::prelude::*; + use std::io::{self, BufReader}; ++use std::iter; + use std::path::{Path, PathBuf}; + use std::process::{Child, Command, ExitStatus, Output, Stdio}; + use std::str; +@@ -72,19 +73,6 @@ fn disable_error_reporting R, R>(f: F) -> R { + f() + } + +-/// The name of the environment variable that holds dynamic library locations. +-pub fn dylib_env_var() -> &'static str { +- if cfg!(windows) { +- "PATH" +- } else if cfg!(target_os = "macos") { +- "DYLD_LIBRARY_PATH" +- } else if cfg!(target_os = "haiku") { +- "LIBRARY_PATH" +- } else { +- "LD_LIBRARY_PATH" +- } +-} +- + /// The platform-specific library name + pub fn get_lib_name(lib: &str, dylib: bool) -> String { + // In some casess (e.g. MUSL), we build a static +@@ -1826,16 +1814,7 @@ fn compose_and_run( + + // Need to be sure to put both the lib_path and the aux path in the dylib + // search path for the child. +- let mut path = +- env::split_paths(&env::var_os(dylib_env_var()).unwrap_or_default()).collect::>(); +- if let Some(p) = aux_path { +- path.insert(0, PathBuf::from(p)) +- } +- path.insert(0, PathBuf::from(lib_path)); +- +- // Add the new dylib search path var +- let newpath = env::join_paths(&path).unwrap(); +- command.env(dylib_env_var(), newpath); ++ add_dylib_path(&mut command, iter::once(lib_path).chain(aux_path)); + + let mut child = disable_error_reporting(|| command.spawn()) + .unwrap_or_else(|_| panic!("failed to exec `{:?}`", &command)); +diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs +index 9d047b63c859..4b73be0fbb90 100644 +--- a/src/tools/compiletest/src/util.rs ++++ b/src/tools/compiletest/src/util.rs +@@ -2,6 +2,7 @@ + use std::env; + use std::ffi::OsStr; + use std::path::PathBuf; ++use std::process::Command; + + use tracing::*; + +@@ -105,3 +106,25 @@ fn with_extra_extension>(&self, extension: S) -> PathBuf { + } + } + } ++ ++/// The name of the environment variable that holds dynamic library locations. ++pub fn dylib_env_var() -> &'static str { ++ if cfg!(windows) { ++ "PATH" ++ } else if cfg!(target_os = "macos") { ++ "DYLD_LIBRARY_PATH" ++ } else if cfg!(target_os = "haiku") { ++ "LIBRARY_PATH" ++ } else { ++ "LD_LIBRARY_PATH" ++ } ++} ++ ++/// Adds a list of lookup paths to `cmd`'s dynamic library lookup path. ++/// If the dylib_path_var is already set for this cmd, the old value will be overwritten! ++pub fn add_dylib_path(cmd: &mut Command, paths: impl Iterator>) { ++ let path_env = env::var_os(dylib_env_var()); ++ let old_paths = path_env.as_ref().map(env::split_paths); ++ let new_paths = paths.map(Into::into).chain(old_paths.into_iter().flatten()); ++ cmd.env(dylib_env_var(), env::join_paths(new_paths).unwrap()); ++} +-- +2.37.3 + diff --git a/0001-rustc_transmute-fix-big-endian-discriminants.patch b/0001-rustc_transmute-fix-big-endian-discriminants.patch index 372852d..aa4fa94 100644 --- a/0001-rustc_transmute-fix-big-endian-discriminants.patch +++ b/0001-rustc_transmute-fix-big-endian-discriminants.patch @@ -1,27 +1,26 @@ -From 2946828fcb8e2e68a16839dfcf4319bf119f8acd Mon Sep 17 00:00:00 2001 +From a72666ed56ec5f1b6d254c7020cf86143edc6dbd Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 20 Sep 2022 13:03:43 -0700 Subject: [PATCH] rustc_transmute: fix big-endian discriminants -(cherry picked from commit a72666ed56ec5f1b6d254c7020cf86143edc6dbd) --- compiler/rustc_transmute/src/layout/tree.rs | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs -index 70b3ba02b05b..e4fcde35ed37 100644 +index 211c813b8001..acd4fa63d782 100644 --- a/compiler/rustc_transmute/src/layout/tree.rs +++ b/compiler/rustc_transmute/src/layout/tree.rs -@@ -402,7 +402,7 @@ fn from_repr_c_variant( +@@ -404,7 +404,7 @@ fn from_repr_c_variant( .unwrap(); - tracing::trace!(?discr_layout, "computed discriminant layout"); + trace!(?discr_layout, "computed discriminant layout"); variant_layout = variant_layout.extend(discr_layout).unwrap().0; - tree = tree.then(Self::from_disr(discr, tcx, layout_summary.discriminant_size)); + tree = tree.then(Self::from_discr(discr, tcx, layout_summary.discriminant_size)); } // Next come fields. -@@ -442,11 +442,21 @@ fn from_repr_c_variant( +@@ -444,11 +444,21 @@ fn from_repr_c_variant( Ok(tree) } diff --git a/rust.spec b/rust.spec index a0953ba..1a1492d 100644 --- a/rust.spec +++ b/rust.spec @@ -8,9 +8,9 @@ # 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.63.0 -%global bootstrap_channel 1.63.0 -%global bootstrap_date 2022-08-11 +%global bootstrap_version 1.64.0 +%global bootstrap_channel 1.64.0 +%global bootstrap_date 2022-09-22 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -35,9 +35,9 @@ # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh # (updated per https://github.com/rust-lang/rust/pull/96907) %global wasi_libc_url https://github.com/WebAssembly/wasi-libc -%global wasi_libc_commit 9886d3d6200fcc3726329966860fc058707406cd -%global wasi_libc_name wasi-libc-%{wasi_libc_commit} -%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_commit}/%{wasi_libc_name}.tar.gz +%global wasi_libc_ref wasi-sdk-16 +%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} # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. @@ -45,15 +45,15 @@ # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 12.0+. -%global min_llvm_version 12.0.0 -%global bundled_llvm_version 14.0.6 +%global min_llvm_version 13.0.0 +%global bundled_llvm_version 15.0.0 %bcond_with bundled_llvm -# Requires stable libgit2 1.4, and not the next minor soname change. +# Requires stable libgit2 1.5, and not the next minor soname change. # This needs to be consistent with the bindings in vendor/libgit2-sys. -%global min_libgit2_version 1.4.0 -%global next_libgit2_version 1.5.0~ -%global bundled_libgit2_version 1.4.2 +%global min_libgit2_version 1.5.0 +%global next_libgit2_version 1.6.0~ +%global bundled_libgit2_version 1.5.0 %if 0%{?fedora} >= 99 %bcond_with bundled_libgit2 %else @@ -83,7 +83,7 @@ %endif Name: rust -Version: 1.64.0 +Version: 1.65.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -109,21 +109,24 @@ Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch # https://github.com/rust-lang/rust/pull/102076 Patch3: 0001-rustc_transmute-fix-big-endian-discriminants.patch +# https://github.com/rust-lang/rust/pull/103072 +Patch4: 0001-compiletest-set-the-dylib-path-when-gathering-target.patch + ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) Source100: macros.rust-toolset # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.59.0-disable-libssh2.patch +Patch100: rustc-1.65.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.63.0-disable-http2.patch +Patch101: rustc-1.65.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) -Patch102: rustc-1.64.0-no-default-pie.patch +Patch102: rustc-1.65.0-no-default-pie.patch # Get the Rust triple for any arch. @@ -440,6 +443,12 @@ Summary: Documentation for Rust # Koji will fail the build in rpmdiff if two architectures build a noarch # subpackage differently, so instead we have to keep its arch. +# Cargo no longer builds its own documentation +# https://github.com/rust-lang/cargo/pull/4904 +# We used to keep a shim cargo-doc package, but now that's merged too. +Obsoletes: cargo-doc < 1.65.0~ +Provides: cargo-doc = %{version}-%{release} + %description doc This package includes HTML documentation for the Rust programming language and its standard library. @@ -465,17 +474,6 @@ Cargo is a tool that allows Rust projects to declare their various dependencies and ensure that you'll always get a repeatable build. -%package -n cargo-doc -Summary: Documentation for Cargo -BuildArch: noarch -# Cargo no longer builds its own documentation -# https://github.com/rust-lang/cargo/pull/4904 -Requires: %{name}-doc = %{version}-%{release} - -%description -n cargo-doc -This package includes HTML documentation for Cargo. - - %package -n rustfmt Summary: Tool to find and fix Rust formatting issues Requires: cargo @@ -488,29 +486,22 @@ Provides: rustfmt-preview = %{version}-%{release} A tool for formatting Rust code according to style guidelines. -%package -n rls -Summary: Rust Language Server for IDE integration (deprecated) -%if %with bundled_libgit2 -Provides: bundled(libgit2) = %{bundled_libgit2_version} -%endif -Requires: %{name}-analysis -# /usr/bin/rls is dynamically linked against internal rustc libs -Requires: %{name}%{?_isa} = %{version}-%{release} - -# The component/package was rls-preview until Rust 1.31. -Obsoletes: rls-preview < 1.31.6 -Provides: rls-preview = %{version}-%{release} - -%description -n rls -The Rust Language Server provides a server that runs in the background, -providing IDEs, editors, and other tools with information about Rust programs. -RLS is being deprecated in favor of rust-analyzer, and may be removed in the future. -https://blog.rust-lang.org/2022/07/01/RLS-deprecation.html - - %package analyzer Summary: Rust implementation of the Language Server Protocol +# The standard library sources are needed for most functionality. +%if 0%{?rhel} && 0%{?rhel} < 8 +Requires: %{name}-src +%else +Recommends: %{name}-src +%endif + +# RLS is no longer available as of Rust 1.65, but we're including the stub +# binary that implements LSP just enough to recommend rust-analyzer. +Obsoletes: rls < 1.65.0~ +# The component/package was rls-preview until Rust 1.31. +Obsoletes: rls-preview < 1.31.6 + %description analyzer rust-analyzer is an implementation of Language Server Protocol for the Rust programming language. It provides features like completion and goto definition @@ -534,6 +525,11 @@ A collection of lints to catch common mistakes and improve your Rust code. %package src Summary: Sources for the Rust standard library BuildArch: noarch +%if 0%{?rhel} && 0%{?rhel} < 8 +Requires: %{name}-std-static = %{version}-%{release} +%else +Supplements: %{name}-std-static = %{version}-%{release} +%endif %description src This package includes source files for the Rust standard library. It may be @@ -542,7 +538,11 @@ useful as a reference for code completion tools in various editors. %package analysis Summary: Compiler analysis data for the Rust standard library +%if 0%{?rhel} && 0%{?rhel} < 8 Requires: %{name}-std-static%{?_isa} = %{version}-%{release} +%else +Supplements: %{name}-std-static%{?_isa} = %{version}-%{release} +%endif %description analysis This package contains analysis data files produced with rustc's -Zsave-analysis @@ -587,6 +587,7 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -671,7 +672,7 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' %build %{export_rust_env} -%ifarch %{arm} %{ix86} s390x +%ifarch %{arm} %{ix86} # full debuginfo is exhausting memory; just do libstd for now # https://github.com/rust-lang/rust/issues/45854 %if 0%{?rhel} && 0%{?rhel} < 8 @@ -748,6 +749,10 @@ end} --disable-rpath \ %{enable_debuginfo} \ --set rust.codegen-units-std=1 \ + --set build.build-stage=2 \ + --set build.doc-stage=2 \ + --set build.install-stage=2 \ + --set build.test-stage=2 \ --enable-extended \ --tools=analysis,cargo,clippy,rls,rust-analyzer,rustfmt,src \ --enable-vendor \ @@ -756,11 +761,11 @@ end} --release-channel=%{channel} \ --release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}" -%{__python3} ./x.py build -j "$ncpus" --stage 2 -%{__python3} ./x.py doc --stage 2 +%{__python3} ./x.py build -j "$ncpus" +%{__python3} ./x.py doc for triple in %{?mingw_targets} %{?wasm_targets}; do - %{__python3} ./x.py build --stage 2 --target=$triple std + %{__python3} ./x.py build --target=$triple std done %install @@ -772,6 +777,9 @@ for triple in %{?mingw_targets} %{?wasm_targets}; do DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std done +# The rls stub doesn't have an install target, but we can just copy it. +%{__install} -t %{buildroot}%{_bindir} build/%{rust_triple}/stage2-tools-bin/rls + # These are transient files used by x.py dist and install rm -rf ./build/dist/ ./build/tmp/ @@ -865,20 +873,17 @@ done # 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. -%{__python3} ./x.py test --no-fail-fast --stage 2 || : +%{__python3} ./x.py test --no-fail-fast || : rm -rf "./build/%{rust_triple}/test/" -%{__python3} ./x.py test --no-fail-fast --stage 2 cargo || : +%{__python3} ./x.py test --no-fail-fast cargo || : rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" -%{__python3} ./x.py test --no-fail-fast --stage 2 clippy || : +%{__python3} ./x.py test --no-fail-fast clippy || : -env RLS_TEST_WAIT_FOR_AGES=1 \ -%{__python3} ./x.py test --no-fail-fast --stage 2 rls || : +%{__python3} ./x.py test --no-fail-fast rust-analyzer || : -%{__python3} ./x.py test --no-fail-fast --stage 2 rust-analyzer || : - -%{__python3} ./x.py test --no-fail-fast --stage 2 rustfmt || : +%{__python3} ./x.py test --no-fail-fast rustfmt || : %ldconfig_scriptlets @@ -992,10 +997,14 @@ end} %{_docdir}/%{name}/html/*.woff2 %license %{_docdir}/%{name}/html/*.txt %license %{_docdir}/%{name}/html/*.md +# former cargo-doc +%docdir %{_docdir}/cargo +%dir %{_docdir}/cargo +%{_docdir}/cargo/html %files -n cargo -%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY +%license src/tools/cargo/LICENSE-{APACHE,MIT,THIRD-PARTY} %doc src/tools/cargo/README.md %{_bindir}/cargo %{_libexecdir}/cargo* @@ -1006,12 +1015,6 @@ end} %dir %{_datadir}/cargo/registry -%files -n cargo-doc -%docdir %{_docdir}/cargo -%dir %{_docdir}/cargo -%{_docdir}/cargo/html - - %files -n rustfmt %{_bindir}/rustfmt %{_bindir}/cargo-fmt @@ -1019,13 +1022,8 @@ end} %license src/tools/rustfmt/LICENSE-{APACHE,MIT} -%files -n rls -%{_bindir}/rls -%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md} -%license src/tools/rls/LICENSE-{APACHE,MIT} - - %files analyzer +%{_bindir}/rls %{_bindir}/rust-analyzer %doc src/tools/rust-analyzer/README.md %license src/tools/rust-analyzer/LICENSE-{APACHE,MIT} @@ -1054,6 +1052,10 @@ end} %changelog +* Thu Nov 03 2022 Josh Stone - 1.65.0-1 +- Update to 1.65.0. +- rust-analyzer now obsoletes rls. + * Thu Sep 22 2022 Josh Stone - 1.64.0-1 - Update to 1.64.0. - Add rust-analyzer. diff --git a/rustc-1.59.0-disable-libssh2.patch b/rustc-1.59.0-disable-libssh2.patch deleted file mode 100644 index 4afd67c..0000000 --- a/rustc-1.59.0-disable-libssh2.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- rustc-1.59.0-src/Cargo.lock.orig 2022-02-21 18:48:37.000000000 -0800 -+++ rustc-1.59.0-src/Cargo.lock 2022-02-22 10:16:10.381962862 -0800 -@@ -1935,7 +1935,6 @@ - dependencies = [ - "cc", - "libc", -- "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -@@ -1968,20 +1967,6 @@ - ] - - [[package]] --name = "libssh2-sys" --version = "0.2.23" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" --dependencies = [ -- "cc", -- "libc", -- "libz-sys", -- "openssl-sys", -- "pkg-config", -- "vcpkg", --] -- --[[package]] - name = "libz-sys" - version = "1.1.3" - source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-1.59.0-src/vendor/git2/Cargo.toml.orig 2022-02-21 20:14:37.000000000 -0800 -+++ rustc-1.59.0-src/vendor/git2/Cargo.toml 2022-02-22 10:12:23.021772490 -0800 -@@ -51,7 +51,7 @@ - version = "0.1.39" - - [features] --default = ["ssh", "https", "ssh_key_from_memory"] -+default = ["https"] - https = ["libgit2-sys/https", "openssl-sys", "openssl-probe"] - ssh = ["libgit2-sys/ssh"] - ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"] diff --git a/rustc-1.63.0-disable-http2.patch b/rustc-1.65.0-disable-http2.patch similarity index 76% rename from rustc-1.63.0-disable-http2.patch rename to rustc-1.65.0-disable-http2.patch index 2e0c8f2..99e33c7 100644 --- a/rustc-1.63.0-disable-http2.patch +++ b/rustc-1.65.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-1.63.0-src/Cargo.lock.orig 2022-08-10 12:25:16.512185135 -0700 -+++ rustc-1.63.0-src/Cargo.lock 2022-08-10 12:25:16.513185114 -0700 -@@ -1054,7 +1054,6 @@ +--- rustc-beta-src/Cargo.lock.orig 2022-10-04 10:55:48.797517289 -0700 ++++ rustc-beta-src/Cargo.lock 2022-10-04 10:55:48.799517248 -0700 +@@ -1026,7 +1026,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -2160,16 +2159,6 @@ +@@ -1993,16 +1992,6 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] @@ -25,19 +25,19 @@ name = "libz-sys" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-1.63.0-src/src/tools/cargo/Cargo.toml.orig 2022-08-10 12:25:16.514185093 -0700 -+++ rustc-1.63.0-src/src/tools/cargo/Cargo.toml 2022-08-10 12:25:51.441455282 -0700 -@@ -22,7 +22,7 @@ +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2022-10-04 10:55:48.799517248 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2022-10-04 11:00:55.057162743 -0700 +@@ -21,7 +21,7 @@ + cargo-platform = { path = "crates/cargo-platform", version = "0.1.2" } cargo-util = { path = "crates/cargo-util", version = "0.2.1" } crates-io = { path = "crates/crates-io", version = "0.34.0" } - crossbeam-utils = "0.8" -curl = { version = "0.4.43", features = ["http2"] } +curl = { version = "0.4.43", features = [] } curl-sys = "0.4.55" env_logger = "0.9.0" pretty_env_logger = { version = "0.4", optional = true } ---- rustc-1.63.0-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2022-08-08 15:47:35.000000000 -0700 -+++ rustc-1.63.0-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2022-08-10 12:25:16.514185093 -0700 +--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2022-09-24 10:23:17.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2022-10-04 10:55:48.799517248 -0700 @@ -192,16 +192,8 @@ } self.fetch_started = true; @@ -57,8 +57,8 @@ self.config .shell() ---- rustc-1.63.0-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-08-08 15:47:35.000000000 -0700 -+++ rustc-1.63.0-src/src/tools/cargo/src/cargo/core/package.rs 2022-08-10 12:25:16.514185093 -0700 +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-09-24 10:23:17.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2022-10-04 10:55:48.800517227 -0700 @@ -403,16 +403,9 @@ sources: SourceMap<'cfg>, config: &'cfg Config, diff --git a/rustc-1.65.0-disable-libssh2.patch b/rustc-1.65.0-disable-libssh2.patch new file mode 100644 index 0000000..24be1f3 --- /dev/null +++ b/rustc-1.65.0-disable-libssh2.patch @@ -0,0 +1,43 @@ +--- rustc-beta-src/Cargo.lock.orig 2022-09-24 10:20:14.000000000 -0700 ++++ rustc-beta-src/Cargo.lock 2022-10-04 10:26:35.490270607 -0700 +@@ -1971,7 +1971,6 @@ + dependencies = [ + "cc", + "libc", +- "libssh2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", +@@ -2004,20 +2003,6 @@ + ] + + [[package]] +-name = "libssh2-sys" +-version = "0.2.23" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" +-dependencies = [ +- "cc", +- "libc", +- "libz-sys", +- "openssl-sys", +- "pkg-config", +- "vcpkg", +-] +- +-[[package]] + name = "libz-sys" + version = "1.1.3" + source = "registry+https://github.com/rust-lang/crates.io-index" +--- rustc-beta-src/vendor/git2/Cargo.toml.orig 2022-10-04 10:26:35.490270607 -0700 ++++ rustc-beta-src/vendor/git2/Cargo.toml 2022-10-04 10:28:14.002187686 -0700 +@@ -58,9 +58,7 @@ + + [features] + default = [ +- "ssh", + "https", +- "ssh_key_from_memory", + ] + https = [ + "libgit2-sys/https", diff --git a/rustc-1.64.0-no-default-pie.patch b/rustc-1.65.0-no-default-pie.patch similarity index 81% rename from rustc-1.64.0-no-default-pie.patch rename to rustc-1.65.0-no-default-pie.patch index c9dd827..2a69611 100644 --- a/rustc-1.64.0-no-default-pie.patch +++ b/rustc-1.65.0-no-default-pie.patch @@ -1,8 +1,6 @@ -diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs -index 63207803e327..f5757760c409 100644 ---- a/compiler/rustc_codegen_ssa/src/back/link.rs -+++ b/compiler/rustc_codegen_ssa/src/back/link.rs -@@ -741,7 +741,7 @@ fn link_natively<'a>( +--- rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs.orig 2022-09-24 10:20:14.000000000 -0700 ++++ rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs 2022-10-05 11:24:21.759564185 -0700 +@@ -755,7 +755,7 @@ && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie") { info!("linker output: {:?}", out); @@ -11,7 +9,7 @@ index 63207803e327..f5757760c409 100644 for arg in cmd.take_args() { if arg.to_string_lossy() != "-no-pie" { cmd.arg(arg); -@@ -760,7 +760,7 @@ fn link_natively<'a>( +@@ -774,7 +774,7 @@ && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie") { info!("linker output: {:?}", out); @@ -20,13 +18,13 @@ index 63207803e327..f5757760c409 100644 "Linker does not support -static-pie command line option. Retrying with -static instead." ); // Mirror `add_(pre,post)_link_objects` to replace CRT objects. -@@ -1507,15 +1507,15 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +@@ -1520,15 +1520,15 @@ } fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind { - let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) { + // Only use PIE if explicitly specified. -+ #[cfg_attr(not(bootstrap), allow(rustc::bad_opt_access))] ++ #[allow(rustc::bad_opt_access)] + let explicit_pic = + matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic | RelocModel::Pie)); + let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) { diff --git a/sources b/sources index ce4b974..ae1d088 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.64.0-src.tar.xz) = 919f40acd8c6eaaef399aa3248503bea19feb96697ab221aaede9ee789ce340b47cb899d1e0e41a31e5d7756653968a10d2faaa4aee83294c9f1243949b43516 -SHA512 (wasi-libc-9886d3d6200fcc3726329966860fc058707406cd.tar.gz) = 5b6af0f7133d31c2c068606737eff957126a3045e09c1e95bd2650e0c5637d4797d7036b9beb167829d38d58f6d4199852832f61b0c8836f05e945cd0cf68132 +SHA512 (rustc-1.65.0-src.tar.xz) = 3d0369ed3028209c4ecb9b9e7b5f5e3a20be8cc05199675df4f091d62a96c0734bc1dbd7630928fe162792392ec6d0daf9ceed10771531ce022200c7b631e3be +SHA512 (wasi-libc-wasi-sdk-16.tar.gz) = 4d3d12e233b2b3321e5287c0851a950d744208e05ed2c6d995dd2e7ff51452c7cfe62451589ed6d3ac58065f8cc87fc5c74a1853ed798e108662d1b0d3ad8a0e From 5379ac25ac84118a6fa60bb950566889dcf3e1ea Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 15 Dec 2022 09:12:22 -0800 Subject: [PATCH 03/45] Update to 1.66.0. --- .gitignore | 2 + ...ove-generating-Custom-entry-function.patch | 302 ++++++++++++++++++ ...e-main-as-__main_void-on-wasm32-wasi.patch | 34 ++ ...-Use-lld-provided-by-system-for-wasm.patch | 12 +- ...the-dylib-path-when-gathering-target.patch | 31 +- ...ansmute-fix-big-endian-discriminants.patch | 52 --- rust.spec | 31 +- sources | 4 +- 8 files changed, 382 insertions(+), 86 deletions(-) create mode 100644 0001-Improve-generating-Custom-entry-function.patch create mode 100644 0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch delete mode 100644 0001-rustc_transmute-fix-big-endian-discriminants.patch diff --git a/.gitignore b/.gitignore index 7cce16d..9c352d2 100644 --- a/.gitignore +++ b/.gitignore @@ -407,3 +407,5 @@ /rustc-1.64.0-src.tar.xz /rustc-1.65.0-src.tar.xz /wasi-libc-wasi-sdk-16.tar.gz +/rustc-1.66.0-src.tar.xz +/wasi-libc-wasi-sdk-17.tar.gz diff --git a/0001-Improve-generating-Custom-entry-function.patch b/0001-Improve-generating-Custom-entry-function.patch new file mode 100644 index 0000000..77cb30e --- /dev/null +++ b/0001-Improve-generating-Custom-entry-function.patch @@ -0,0 +1,302 @@ +From 9f0a8620bd7d325e6d42417b08daff3e55cb88f6 Mon Sep 17 00:00:00 2001 +From: Ayush Singh +Date: Sat, 5 Nov 2022 14:36:38 +0530 +Subject: [PATCH] Improve generating Custom entry function + +This commit is aimed at making compiler generated entry functions +(Basically just C `main` right now) more generic so other targets can do +similar things for custom entry. This was initially implemented as part +of https://github.com/rust-lang/rust/pull/100316. + +Currently, this moves the entry function name and Call convention to the +target spec. + +Signed-off-by: Ayush Singh +--- + compiler/rustc_codegen_llvm/src/abi.rs | 40 +++++++++++-------- + compiler/rustc_codegen_llvm/src/context.rs | 10 ++++- + compiler/rustc_codegen_llvm/src/declare.rs | 22 ++++++++++ + .../src/back/symbol_export.rs | 3 +- + compiler/rustc_target/src/abi/call/mod.rs | 28 +++++++++++++ + compiler/rustc_target/src/json.rs | 25 ++++++++++++ + compiler/rustc_target/src/spec/mod.rs | 27 +++++++++++++ + 7 files changed, 135 insertions(+), 20 deletions(-) + +diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs +index d478efc863a9..a6fd2a7de6bd 100644 +--- a/compiler/rustc_codegen_llvm/src/abi.rs ++++ b/compiler/rustc_codegen_llvm/src/abi.rs +@@ -398,23 +398,7 @@ fn ptr_to_llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type { + } + + fn llvm_cconv(&self) -> llvm::CallConv { +- match self.conv { +- Conv::C | Conv::Rust | Conv::CCmseNonSecureCall => llvm::CCallConv, +- Conv::RustCold => llvm::ColdCallConv, +- Conv::AmdGpuKernel => llvm::AmdGpuKernel, +- Conv::AvrInterrupt => llvm::AvrInterrupt, +- Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt, +- Conv::ArmAapcs => llvm::ArmAapcsCallConv, +- Conv::Msp430Intr => llvm::Msp430Intr, +- Conv::PtxKernel => llvm::PtxKernel, +- Conv::X86Fastcall => llvm::X86FastcallCallConv, +- Conv::X86Intr => llvm::X86_Intr, +- Conv::X86Stdcall => llvm::X86StdcallCallConv, +- Conv::X86ThisCall => llvm::X86_ThisCall, +- Conv::X86VectorCall => llvm::X86_VectorCall, +- Conv::X86_64SysV => llvm::X86_64_SysV, +- Conv::X86_64Win64 => llvm::X86_64_Win64, +- } ++ self.conv.into() + } + + fn apply_attrs_llfn(&self, cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value) { +@@ -596,3 +580,25 @@ fn get_param(&mut self, index: usize) -> Self::Value { + llvm::get_param(self.llfn(), index as c_uint) + } + } ++ ++impl From for llvm::CallConv { ++ fn from(conv: Conv) -> Self { ++ match conv { ++ Conv::C | Conv::Rust | Conv::CCmseNonSecureCall => llvm::CCallConv, ++ Conv::RustCold => llvm::ColdCallConv, ++ Conv::AmdGpuKernel => llvm::AmdGpuKernel, ++ Conv::AvrInterrupt => llvm::AvrInterrupt, ++ Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt, ++ Conv::ArmAapcs => llvm::ArmAapcsCallConv, ++ Conv::Msp430Intr => llvm::Msp430Intr, ++ Conv::PtxKernel => llvm::PtxKernel, ++ Conv::X86Fastcall => llvm::X86FastcallCallConv, ++ Conv::X86Intr => llvm::X86_Intr, ++ Conv::X86Stdcall => llvm::X86StdcallCallConv, ++ Conv::X86ThisCall => llvm::X86_ThisCall, ++ Conv::X86VectorCall => llvm::X86_VectorCall, ++ Conv::X86_64SysV => llvm::X86_64_SysV, ++ Conv::X86_64Win64 => llvm::X86_64_Win64, ++ } ++ } ++} +diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs +index 79ddfd884dfa..f3ef618fff54 100644 +--- a/compiler/rustc_codegen_llvm/src/context.rs ++++ b/compiler/rustc_codegen_llvm/src/context.rs +@@ -570,8 +570,14 @@ fn apply_target_cpu_attr(&self, llfn: &'ll Value) { + } + + fn declare_c_main(&self, fn_type: Self::Type) -> Option { +- if self.get_declared_value("main").is_none() { +- Some(self.declare_cfn("main", llvm::UnnamedAddr::Global, fn_type)) ++ let entry_name = self.sess().target.entry_name.as_ref(); ++ if self.get_declared_value(entry_name).is_none() { ++ Some(self.declare_entry_fn( ++ entry_name, ++ self.sess().target.entry_abi.into(), ++ llvm::UnnamedAddr::Global, ++ fn_type, ++ )) + } else { + // If the symbol already exists, it is an error: for example, the user wrote + // #[no_mangle] extern "C" fn main(..) {..} +diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs +index f79ef11720df..dc21a02cec44 100644 +--- a/compiler/rustc_codegen_llvm/src/declare.rs ++++ b/compiler/rustc_codegen_llvm/src/declare.rs +@@ -90,6 +90,28 @@ pub fn declare_cfn( + declare_raw_fn(self, name, llvm::CCallConv, unnamed, visibility, fn_type) + } + ++ /// Declare an entry Function ++ /// ++ /// The ABI of this function can change depending on the target (although for now the same as ++ /// `declare_cfn`) ++ /// ++ /// If there’s a value with the same name already declared, the function will ++ /// update the declaration and return existing Value instead. ++ pub fn declare_entry_fn( ++ &self, ++ name: &str, ++ callconv: llvm::CallConv, ++ unnamed: llvm::UnnamedAddr, ++ fn_type: &'ll Type, ++ ) -> &'ll Value { ++ let visibility = if self.tcx.sess.target.default_hidden_visibility { ++ llvm::Visibility::Hidden ++ } else { ++ llvm::Visibility::Default ++ }; ++ declare_raw_fn(self, name, callconv, unnamed, visibility, fn_type) ++ } ++ + /// Declare a Rust function. + /// + /// If there’s a value with the same name already declared, the function will +diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +index 752f6b1ef40c..22f534d909ab 100644 +--- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs ++++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +@@ -180,7 +180,8 @@ fn exported_symbols_provider_local<'tcx>( + .collect(); + + if tcx.entry_fn(()).is_some() { +- let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, "main")); ++ let exported_symbol = ++ ExportedSymbol::NoDefId(SymbolName::new(tcx, tcx.sess.target.entry_name.as_ref())); + + symbols.push(( + exported_symbol, +diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs +index 9e5f0e4d158b..c622bd36b00c 100644 +--- a/compiler/rustc_target/src/abi/call/mod.rs ++++ b/compiler/rustc_target/src/abi/call/mod.rs +@@ -3,6 +3,7 @@ + use crate::spec::{self, HasTargetSpec}; + use rustc_span::Symbol; + use std::fmt; ++use std::str::FromStr; + + mod aarch64; + mod amdgpu; +@@ -735,6 +736,33 @@ pub fn adjust_for_foreign_abi( + } + } + ++impl FromStr for Conv { ++ type Err = String; ++ ++ fn from_str(s: &str) -> Result { ++ match s { ++ "C" => Ok(Conv::C), ++ "Rust" => Ok(Conv::Rust), ++ "RustCold" => Ok(Conv::Rust), ++ "ArmAapcs" => Ok(Conv::ArmAapcs), ++ "CCmseNonSecureCall" => Ok(Conv::CCmseNonSecureCall), ++ "Msp430Intr" => Ok(Conv::Msp430Intr), ++ "PtxKernel" => Ok(Conv::PtxKernel), ++ "X86Fastcall" => Ok(Conv::X86Fastcall), ++ "X86Intr" => Ok(Conv::X86Intr), ++ "X86Stdcall" => Ok(Conv::X86Stdcall), ++ "X86ThisCall" => Ok(Conv::X86ThisCall), ++ "X86VectorCall" => Ok(Conv::X86VectorCall), ++ "X86_64SysV" => Ok(Conv::X86_64SysV), ++ "X86_64Win64" => Ok(Conv::X86_64Win64), ++ "AmdGpuKernel" => Ok(Conv::AmdGpuKernel), ++ "AvrInterrupt" => Ok(Conv::AvrInterrupt), ++ "AvrNonBlockingInterrupt" => Ok(Conv::AvrNonBlockingInterrupt), ++ _ => Err(format!("'{}' is not a valid value for entry function call convetion.", s)), ++ } ++ } ++} ++ + // Some types are used a lot. Make sure they don't unintentionally get bigger. + #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] + mod size_asserts { +diff --git a/compiler/rustc_target/src/json.rs b/compiler/rustc_target/src/json.rs +index b5d926352122..75bb76a9de08 100644 +--- a/compiler/rustc_target/src/json.rs ++++ b/compiler/rustc_target/src/json.rs +@@ -89,3 +89,28 @@ fn to_json(&self) -> Json { + } + } + } ++ ++impl ToJson for crate::abi::call::Conv { ++ fn to_json(&self) -> Json { ++ let s = match self { ++ Self::C => "C", ++ Self::Rust => "Rust", ++ Self::RustCold => "RustCold", ++ Self::ArmAapcs => "ArmAapcs", ++ Self::CCmseNonSecureCall => "CCmseNonSecureCall", ++ Self::Msp430Intr => "Msp430Intr", ++ Self::PtxKernel => "PtxKernel", ++ Self::X86Fastcall => "X86Fastcall", ++ Self::X86Intr => "X86Intr", ++ Self::X86Stdcall => "X86Stdcall", ++ Self::X86ThisCall => "X86ThisCall", ++ Self::X86VectorCall => "X86VectorCall", ++ Self::X86_64SysV => "X86_64SysV", ++ Self::X86_64Win64 => "X86_64Win64", ++ Self::AmdGpuKernel => "AmdGpuKernel", ++ Self::AvrInterrupt => "AvrInterrupt", ++ Self::AvrNonBlockingInterrupt => "AvrNonBlockingInterrupt", ++ }; ++ Json::String(s.to_owned()) ++ } ++} +diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs +index 72b088d663b1..617de46a55aa 100644 +--- a/compiler/rustc_target/src/spec/mod.rs ++++ b/compiler/rustc_target/src/spec/mod.rs +@@ -34,6 +34,7 @@ + //! the target's settings, though `target-feature` and `link-args` will *add* + //! to the list specified by the target, rather than replace. + ++use crate::abi::call::Conv; + use crate::abi::Endian; + use crate::json::{Json, ToJson}; + use crate::spec::abi::{lookup as lookup_abi, Abi}; +@@ -1668,6 +1669,14 @@ pub struct TargetOptions { + /// Whether the target supports stack canary checks. `true` by default, + /// since this is most common among tier 1 and tier 2 targets. + pub supports_stack_protector: bool, ++ ++ // The name of entry function. ++ // Default value is "main" ++ pub entry_name: StaticCow, ++ ++ // The ABI of entry function. ++ // Default value is `Conv::C`, i.e. C call convention ++ pub entry_abi: Conv, + } + + /// Add arguments for the given flavor and also for its "twin" flavors +@@ -1884,6 +1893,8 @@ fn default() -> TargetOptions { + c_enum_min_bits: 32, + generate_arange_section: true, + supports_stack_protector: true, ++ entry_name: "main".into(), ++ entry_abi: Conv::C, + } + } + } +@@ -2401,6 +2412,18 @@ macro_rules! key { + } + } + } ); ++ ($key_name:ident, Conv) => ( { ++ let name = (stringify!($key_name)).replace("_", "-"); ++ obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { ++ match Conv::from_str(s) { ++ Ok(c) => { ++ base.$key_name = c; ++ Some(Ok(())) ++ } ++ Err(e) => Some(Err(e)) ++ } ++ })).unwrap_or(Ok(())) ++ } ); + } + + if let Some(j) = obj.remove("target-endian") { +@@ -2520,6 +2543,8 @@ macro_rules! key { + key!(c_enum_min_bits, u64); + key!(generate_arange_section, bool); + key!(supports_stack_protector, bool); ++ key!(entry_name); ++ key!(entry_abi, Conv)?; + + if base.is_builtin { + // This can cause unfortunate ICEs later down the line. +@@ -2770,6 +2795,8 @@ macro_rules! target_option_val { + target_option_val!(c_enum_min_bits); + target_option_val!(generate_arange_section); + target_option_val!(supports_stack_protector); ++ target_option_val!(entry_name); ++ target_option_val!(entry_abi); + + if let Some(abi) = self.default_adjusted_cabi { + d.insert("default-adjusted-cabi".into(), Abi::name(abi).to_json()); +-- +2.38.1 + diff --git a/0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch b/0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch new file mode 100644 index 0000000..3f087ef --- /dev/null +++ b/0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch @@ -0,0 +1,34 @@ +From 98ae83daae67e9e7663b8345eced1de8c667271f Mon Sep 17 00:00:00 2001 +From: Dan Gohman +Date: Thu, 8 Dec 2022 10:35:46 -0800 +Subject: [PATCH] Mangle "main" as "__main_void" on wasm32-wasi + +On wasm, the age-old C trick of having a main function which can either have +no arguments or argc+argv doesn't work, because wasm requires caller and +callee signatures to match. WASI's current strategy is to have compilers +mangle main's name to indicate which signature they're using. Rust uses the +no-argument form, which should be mangled as `__main_void`. + +This is needed on wasm32-wasi as of #105395. +--- + compiler/rustc_target/src/spec/wasm32_wasi.rs | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/compiler/rustc_target/src/spec/wasm32_wasi.rs b/compiler/rustc_target/src/spec/wasm32_wasi.rs +index 6f0bbf0672d4..a0476d542e64 100644 +--- a/compiler/rustc_target/src/spec/wasm32_wasi.rs ++++ b/compiler/rustc_target/src/spec/wasm32_wasi.rs +@@ -104,6 +104,10 @@ pub fn target() -> Target { + // `args::args()` makes the WASI API calls itself. + options.main_needs_argc_argv = false; + ++ // And, WASI mangles the name of "main" to distinguish between different ++ // signatures. ++ options.entry_name = "__main_void".into(); ++ + Target { + llvm_target: "wasm32-wasi".into(), + pointer_width: 32, +-- +2.38.1 + diff --git a/0001-Use-lld-provided-by-system-for-wasm.patch b/0001-Use-lld-provided-by-system-for-wasm.patch index fa75ad3..5fcc245 100644 --- a/0001-Use-lld-provided-by-system-for-wasm.patch +++ b/0001-Use-lld-provided-by-system-for-wasm.patch @@ -1,4 +1,4 @@ -From b521511174b1a08dddfac243604d649b71cc7386 Mon Sep 17 00:00:00 2001 +From 37cb177eb53145103ae72b67562884782dde01c3 Mon Sep 17 00:00:00 2001 From: Ivan Mironov Date: Sun, 8 Dec 2019 17:23:08 +0500 Subject: [PATCH] Use lld provided by system for wasm @@ -8,19 +8,19 @@ Subject: [PATCH] Use lld provided by system for wasm 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_target/src/spec/wasm_base.rs b/compiler/rustc_target/src/spec/wasm_base.rs -index de7b7374af31..eebbe616e9b6 100644 +index 528a84a8b37c..353d742161d1 100644 --- a/compiler/rustc_target/src/spec/wasm_base.rs +++ b/compiler/rustc_target/src/spec/wasm_base.rs -@@ -99,8 +99,7 @@ pub fn options() -> TargetOptions { +@@ -89,8 +89,7 @@ macro_rules! args { // arguments just yet limit_rdylib_exports: false, - // we use the LLD shipped with the Rust toolchain by default - linker: Some("rust-lld".into()), + linker: Some("lld".into()), - lld_flavor: LldFlavor::Wasm, - linker_is_gnu: false, + linker_flavor: LinkerFlavor::WasmLld(Cc::No), + pre_link_args, -- -2.35.1 +2.38.1 diff --git a/0001-compiletest-set-the-dylib-path-when-gathering-target.patch b/0001-compiletest-set-the-dylib-path-when-gathering-target.patch index 9fcfb3f..54185a7 100644 --- a/0001-compiletest-set-the-dylib-path-when-gathering-target.patch +++ b/0001-compiletest-set-the-dylib-path-when-gathering-target.patch @@ -1,4 +1,4 @@ -From 92b0b20e4119241aaeabb4b91189a9fca8ff8b5d Mon Sep 17 00:00:00 2001 +From 2bdbc5fbf7f84c62f8c7b1007f3b6fd6d3da06f6 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 14 Oct 2022 16:11:28 -0700 Subject: [PATCH] compiletest: set the dylib path when gathering target cfg @@ -18,15 +18,15 @@ command for getting the target cfg. Now the library path is set here as well, so it works without rpath. -(cherry picked from commit 97c3608326d123f5462e3504409a3a069611c0fb) +(cherry picked from commit f8a0cc2ca8a644ddb63867526711ba17cb7508c8) --- - src/tools/compiletest/src/common.rs | 17 ++++++++++------- + src/tools/compiletest/src/common.rs | 20 +++++++++++--------- src/tools/compiletest/src/runtest.rs | 27 +++------------------------ src/tools/compiletest/src/util.rs | 23 +++++++++++++++++++++++ - 3 files changed, 36 insertions(+), 31 deletions(-) + 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs -index 64df76e27720..53b64e7d1fc3 100644 +index 0260f6848386..9a432f11f82f 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -2,11 +2,12 @@ @@ -43,20 +43,21 @@ index 64df76e27720..53b64e7d1fc3 100644 use lazycell::LazyCell; use test::ColorConfig; -@@ -389,7 +390,7 @@ pub fn run_enabled(&self) -> bool { +@@ -385,8 +386,7 @@ pub fn run_enabled(&self) -> bool { } fn target_cfg(&self) -> &TargetCfg { -- self.target_cfg.borrow_with(|| TargetCfg::new(&self.rustc_path, &self.target)) +- self.target_cfg +- .borrow_with(|| TargetCfg::new(&self.rustc_path, &self.target, &self.target_rustcflags)) + self.target_cfg.borrow_with(|| TargetCfg::new(self)) } pub fn matches_arch(&self, arch: &str) -> bool { -@@ -455,20 +456,22 @@ pub enum Endian { +@@ -457,21 +457,23 @@ pub enum Endian { } impl TargetCfg { -- fn new(rustc_path: &Path, target: &str) -> TargetCfg { +- fn new(rustc_path: &Path, target: &str, target_rustcflags: &Vec) -> TargetCfg { - let output = match Command::new(rustc_path) + fn new(config: &Config) -> TargetCfg { + let mut command = Command::new(&config.rustc_path); @@ -65,7 +66,9 @@ index 64df76e27720..53b64e7d1fc3 100644 .arg("--print=cfg") .arg("--target") - .arg(target) +- .args(target_rustcflags) + .arg(&config.target) ++ .args(&config.target_rustcflags) .output() { Ok(output) => output, @@ -81,7 +84,7 @@ index 64df76e27720..53b64e7d1fc3 100644 String::from_utf8(output.stderr).unwrap(), ); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs -index 8f289876f730..eb467170249d 100644 +index 8af5f1da694b..f8903f754f09 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -13,7 +13,7 @@ @@ -121,7 +124,7 @@ index 8f289876f730..eb467170249d 100644 /// The platform-specific library name pub fn get_lib_name(lib: &str, dylib: bool) -> String { // In some casess (e.g. MUSL), we build a static -@@ -1826,16 +1814,7 @@ fn compose_and_run( +@@ -1811,16 +1799,7 @@ fn compose_and_run( // Need to be sure to put both the lib_path and the aux path in the dylib // search path for the child. @@ -140,7 +143,7 @@ index 8f289876f730..eb467170249d 100644 let mut child = disable_error_reporting(|| command.spawn()) .unwrap_or_else(|_| panic!("failed to exec `{:?}`", &command)); diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs -index 9d047b63c859..4b73be0fbb90 100644 +index e5ff0906be8a..ec36f1e4fb72 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -2,6 +2,7 @@ @@ -151,7 +154,7 @@ index 9d047b63c859..4b73be0fbb90 100644 use tracing::*; -@@ -105,3 +106,25 @@ fn with_extra_extension>(&self, extension: S) -> PathBuf { +@@ -111,3 +112,25 @@ fn with_extra_extension>(&self, extension: S) -> PathBuf { } } } @@ -178,5 +181,5 @@ index 9d047b63c859..4b73be0fbb90 100644 + cmd.env(dylib_env_var(), env::join_paths(new_paths).unwrap()); +} -- -2.37.3 +2.38.1 diff --git a/0001-rustc_transmute-fix-big-endian-discriminants.patch b/0001-rustc_transmute-fix-big-endian-discriminants.patch deleted file mode 100644 index aa4fa94..0000000 --- a/0001-rustc_transmute-fix-big-endian-discriminants.patch +++ /dev/null @@ -1,52 +0,0 @@ -From a72666ed56ec5f1b6d254c7020cf86143edc6dbd Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Tue, 20 Sep 2022 13:03:43 -0700 -Subject: [PATCH] rustc_transmute: fix big-endian discriminants - ---- - compiler/rustc_transmute/src/layout/tree.rs | 22 +++++++++++++++------ - 1 file changed, 16 insertions(+), 6 deletions(-) - -diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs -index 211c813b8001..acd4fa63d782 100644 ---- a/compiler/rustc_transmute/src/layout/tree.rs -+++ b/compiler/rustc_transmute/src/layout/tree.rs -@@ -404,7 +404,7 @@ fn from_repr_c_variant( - .unwrap(); - trace!(?discr_layout, "computed discriminant layout"); - variant_layout = variant_layout.extend(discr_layout).unwrap().0; -- tree = tree.then(Self::from_disr(discr, tcx, layout_summary.discriminant_size)); -+ tree = tree.then(Self::from_discr(discr, tcx, layout_summary.discriminant_size)); - } - - // Next come fields. -@@ -444,11 +444,21 @@ fn from_repr_c_variant( - Ok(tree) - } - -- pub fn from_disr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self { -- // FIXME(@jswrenn): I'm certain this is missing needed endian nuance. -- let bytes = discr.val.to_ne_bytes(); -- let bytes = &bytes[..size]; -- Self::Seq(bytes.into_iter().copied().map(|b| Self::from_bits(b)).collect()) -+ pub fn from_discr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self { -+ use rustc_target::abi::Endian; -+ -+ let bytes: [u8; 16]; -+ let bytes = match tcx.data_layout.endian { -+ Endian::Little => { -+ bytes = discr.val.to_le_bytes(); -+ &bytes[..size] -+ } -+ Endian::Big => { -+ bytes = discr.val.to_be_bytes(); -+ &bytes[bytes.len() - size..] -+ } -+ }; -+ Self::Seq(bytes.iter().map(|&b| Self::from_bits(b)).collect()) - } - } - --- -2.37.3 - diff --git a/rust.spec b/rust.spec index 1a1492d..d4dbb1c 100644 --- a/rust.spec +++ b/rust.spec @@ -8,9 +8,9 @@ # 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.64.0 -%global bootstrap_channel 1.64.0 -%global bootstrap_date 2022-09-22 +%global bootstrap_version 1.65.0 +%global bootstrap_channel 1.65.0 +%global bootstrap_date 2022-11-03 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -35,7 +35,7 @@ # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh # (updated per https://github.com/rust-lang/rust/pull/96907) %global wasi_libc_url https://github.com/WebAssembly/wasi-libc -%global wasi_libc_ref wasi-sdk-16 +%global wasi_libc_ref wasi-sdk-17 %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} @@ -46,7 +46,7 @@ # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 12.0+. %global min_llvm_version 13.0.0 -%global bundled_llvm_version 15.0.0 +%global bundled_llvm_version 15.0.2 %bcond_with bundled_llvm # Requires stable libgit2 1.5, and not the next minor soname change. @@ -83,7 +83,7 @@ %endif Name: rust -Version: 1.65.0 +Version: 1.66.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -106,11 +106,14 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch -# https://github.com/rust-lang/rust/pull/102076 -Patch3: 0001-rustc_transmute-fix-big-endian-discriminants.patch - # https://github.com/rust-lang/rust/pull/103072 -Patch4: 0001-compiletest-set-the-dylib-path-when-gathering-target.patch +Patch3: 0001-compiletest-set-the-dylib-path-when-gathering-target.patch + +# https://github.com/rust-lang/rust/pull/104001 +Patch4: 0001-Improve-generating-Custom-entry-function.patch + +# https://github.com/rust-lang/rust/pull/105468 +Patch5: 0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch ### RHEL-specific patches below ### @@ -528,7 +531,7 @@ BuildArch: noarch %if 0%{?rhel} && 0%{?rhel} < 8 Requires: %{name}-std-static = %{version}-%{release} %else -Supplements: %{name}-std-static = %{version}-%{release} +Recommends: %{name}-std-static = %{version}-%{release} %endif %description src @@ -541,7 +544,7 @@ Summary: Compiler analysis data for the Rust standard library %if 0%{?rhel} && 0%{?rhel} < 8 Requires: %{name}-std-static%{?_isa} = %{version}-%{release} %else -Supplements: %{name}-std-static%{?_isa} = %{version}-%{release} +Recommends: %{name}-std-static%{?_isa} = %{version}-%{release} %endif %description analysis @@ -588,6 +591,7 @@ test -f '%{local_rust_root}/bin/rustc' %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -1052,6 +1056,9 @@ end} %changelog +* Thu Dec 15 2022 Josh Stone - 1.66.0-1 +- Update to 1.66.0. + * Thu Nov 03 2022 Josh Stone - 1.65.0-1 - Update to 1.65.0. - rust-analyzer now obsoletes rls. diff --git a/sources b/sources index ae1d088..608b89d 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.65.0-src.tar.xz) = 3d0369ed3028209c4ecb9b9e7b5f5e3a20be8cc05199675df4f091d62a96c0734bc1dbd7630928fe162792392ec6d0daf9ceed10771531ce022200c7b631e3be -SHA512 (wasi-libc-wasi-sdk-16.tar.gz) = 4d3d12e233b2b3321e5287c0851a950d744208e05ed2c6d995dd2e7ff51452c7cfe62451589ed6d3ac58065f8cc87fc5c74a1853ed798e108662d1b0d3ad8a0e +SHA512 (rustc-1.66.0-src.tar.xz) = df329bcabce309846e44d92a118758dfc65b63f06857226799c75568a2a018a96500fd07cd38c1927e3486d190a6f57340ee794c733bbbb69cf80a99855ced73 +SHA512 (wasi-libc-wasi-sdk-17.tar.gz) = 5870f86d4a8431edefaef41163d1fa7eddeabcfa6bc5794c7bf18b4fd320b6ea43c261a7e41966d0da1490a2d96b9742c82cbcca7c56bb404830722664cab376 From 1f0d4ff0a2ed689373502ecb208f5a3e4622a06f Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 4 Jan 2023 10:51:03 -0800 Subject: [PATCH 04/45] Update CI plan to tmt --- plans/ci.fmf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plans/ci.fmf b/plans/ci.fmf index 1ad2c12..3fd3ab7 100644 --- a/plans/ci.fmf +++ b/plans/ci.fmf @@ -1,6 +1,5 @@ summary: CI Gating Plan discover: how: fmf - directory: tests execute: - how: beakerlib + how: tmt From 5a745388ed7af0edfd3bad1e706c9638d16a996c Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 10 Jan 2023 18:05:07 -0800 Subject: [PATCH 05/45] Update to 1.66.1. Security fix for CVE-2022-46176 --- rust.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rust.spec b/rust.spec index d4dbb1c..ee05662 100644 --- a/rust.spec +++ b/rust.spec @@ -83,7 +83,7 @@ %endif Name: rust -Version: 1.66.0 +Version: 1.66.1 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -1056,6 +1056,10 @@ end} %changelog +* Tue Jan 10 2023 Josh Stone - 1.66.1-1 +- Update to 1.66.1. +- Security fix for CVE-2022-46176 + * Thu Dec 15 2022 Josh Stone - 1.66.0-1 - Update to 1.66.0. From 256f31f182fd3a6deab11cfe1dd01711662852dd Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 10 Jan 2023 18:30:35 -0800 Subject: [PATCH 06/45] fedpkg new-sources --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9c352d2..fd38bd4 100644 --- a/.gitignore +++ b/.gitignore @@ -409,3 +409,4 @@ /wasi-libc-wasi-sdk-16.tar.gz /rustc-1.66.0-src.tar.xz /wasi-libc-wasi-sdk-17.tar.gz +/rustc-1.66.1-src.tar.xz diff --git a/sources b/sources index 608b89d..4fb006d 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.66.0-src.tar.xz) = df329bcabce309846e44d92a118758dfc65b63f06857226799c75568a2a018a96500fd07cd38c1927e3486d190a6f57340ee794c733bbbb69cf80a99855ced73 +SHA512 (rustc-1.66.1-src.tar.xz) = 1944c024c603140d0a9236043a3bd1d0d211dd8d368d6d82a3a620f1ff43b29624755b0943f2b38b40a188c7eee77a840238ea757eaf435e2a3fa6a0e6b82832 SHA512 (wasi-libc-wasi-sdk-17.tar.gz) = 5870f86d4a8431edefaef41163d1fa7eddeabcfa6bc5794c7bf18b4fd320b6ea43c261a7e41966d0da1490a2d96b9742c82cbcca7c56bb404830722664cab376 From dbc2fd6f229f5655bef8091c9cb732c8a6d40644 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 11 Jan 2023 19:28:21 +0100 Subject: [PATCH 07/45] rpmbuild-librsvg2: Get deps from srpm instead spec file to generate the dynamic dependencies --- tests/Sanity/rpmbuild-librsvg2/runtest.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Sanity/rpmbuild-librsvg2/runtest.sh b/tests/Sanity/rpmbuild-librsvg2/runtest.sh index 8965c9e..470ecb5 100755 --- a/tests/Sanity/rpmbuild-librsvg2/runtest.sh +++ b/tests/Sanity/rpmbuild-librsvg2/runtest.sh @@ -48,7 +48,10 @@ rlJournalStart rlRun "rpm -ivh $SRPM" rlRun SPECDIR="$(rpm -E '%{_specdir}')" - rlRun "yum-builddep -y ${SPECDIR}/${PKG_TO_BUILD}.spec ${YUM_SWITCHES}" + # librsvg2 contains dynamic dependencies. builddep needs to be run + # from the srpm (not the spec file) to be able to generate them: + # https://fedoraproject.org/wiki/Changes/DynamicBuildRequires#rpmbuild + rlRun "yum-builddep -y ${SRPM} ${YUM_SWITCHES}" rlPhaseEnd rlPhaseStartTest From 4ee64c64a1984c066da63f8b6f84f293874a6fc3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 20 Jan 2023 21:24:34 +0000 Subject: [PATCH 08/45] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust.spec b/rust.spec index ee05662..249e50b 100644 --- a/rust.spec +++ b/rust.spec @@ -84,7 +84,7 @@ Name: rust Version: 1.66.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -1056,6 +1056,9 @@ end} %changelog +* Fri Jan 20 2023 Fedora Release Engineering - 1.66.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Tue Jan 10 2023 Josh Stone - 1.66.1-1 - Update to 1.66.1. - Security fix for CVE-2022-46176 From d90cdf5795cd3d09751ab593ad6d27f985b42896 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 26 Jan 2023 12:09:44 -0800 Subject: [PATCH 09/45] Update to 1.67.0. --- .gitignore | 1 + ...ove-generating-Custom-entry-function.patch | 302 ------------------ ...e-main-as-__main_void-on-wasm32-wasi.patch | 34 -- ...the-dylib-path-when-gathering-target.patch | 185 ----------- rust.spec | 40 +-- ....patch => rustc-1.67.0-disable-http2.patch | 70 ++-- sources | 2 +- 7 files changed, 48 insertions(+), 586 deletions(-) delete mode 100644 0001-Improve-generating-Custom-entry-function.patch delete mode 100644 0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch delete mode 100644 0001-compiletest-set-the-dylib-path-when-gathering-target.patch rename rustc-1.65.0-disable-http2.patch => rustc-1.67.0-disable-http2.patch (77%) diff --git a/.gitignore b/.gitignore index fd38bd4..3de52c7 100644 --- a/.gitignore +++ b/.gitignore @@ -410,3 +410,4 @@ /rustc-1.66.0-src.tar.xz /wasi-libc-wasi-sdk-17.tar.gz /rustc-1.66.1-src.tar.xz +/rustc-1.67.0-src.tar.xz diff --git a/0001-Improve-generating-Custom-entry-function.patch b/0001-Improve-generating-Custom-entry-function.patch deleted file mode 100644 index 77cb30e..0000000 --- a/0001-Improve-generating-Custom-entry-function.patch +++ /dev/null @@ -1,302 +0,0 @@ -From 9f0a8620bd7d325e6d42417b08daff3e55cb88f6 Mon Sep 17 00:00:00 2001 -From: Ayush Singh -Date: Sat, 5 Nov 2022 14:36:38 +0530 -Subject: [PATCH] Improve generating Custom entry function - -This commit is aimed at making compiler generated entry functions -(Basically just C `main` right now) more generic so other targets can do -similar things for custom entry. This was initially implemented as part -of https://github.com/rust-lang/rust/pull/100316. - -Currently, this moves the entry function name and Call convention to the -target spec. - -Signed-off-by: Ayush Singh ---- - compiler/rustc_codegen_llvm/src/abi.rs | 40 +++++++++++-------- - compiler/rustc_codegen_llvm/src/context.rs | 10 ++++- - compiler/rustc_codegen_llvm/src/declare.rs | 22 ++++++++++ - .../src/back/symbol_export.rs | 3 +- - compiler/rustc_target/src/abi/call/mod.rs | 28 +++++++++++++ - compiler/rustc_target/src/json.rs | 25 ++++++++++++ - compiler/rustc_target/src/spec/mod.rs | 27 +++++++++++++ - 7 files changed, 135 insertions(+), 20 deletions(-) - -diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs -index d478efc863a9..a6fd2a7de6bd 100644 ---- a/compiler/rustc_codegen_llvm/src/abi.rs -+++ b/compiler/rustc_codegen_llvm/src/abi.rs -@@ -398,23 +398,7 @@ fn ptr_to_llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type { - } - - fn llvm_cconv(&self) -> llvm::CallConv { -- match self.conv { -- Conv::C | Conv::Rust | Conv::CCmseNonSecureCall => llvm::CCallConv, -- Conv::RustCold => llvm::ColdCallConv, -- Conv::AmdGpuKernel => llvm::AmdGpuKernel, -- Conv::AvrInterrupt => llvm::AvrInterrupt, -- Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt, -- Conv::ArmAapcs => llvm::ArmAapcsCallConv, -- Conv::Msp430Intr => llvm::Msp430Intr, -- Conv::PtxKernel => llvm::PtxKernel, -- Conv::X86Fastcall => llvm::X86FastcallCallConv, -- Conv::X86Intr => llvm::X86_Intr, -- Conv::X86Stdcall => llvm::X86StdcallCallConv, -- Conv::X86ThisCall => llvm::X86_ThisCall, -- Conv::X86VectorCall => llvm::X86_VectorCall, -- Conv::X86_64SysV => llvm::X86_64_SysV, -- Conv::X86_64Win64 => llvm::X86_64_Win64, -- } -+ self.conv.into() - } - - fn apply_attrs_llfn(&self, cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value) { -@@ -596,3 +580,25 @@ fn get_param(&mut self, index: usize) -> Self::Value { - llvm::get_param(self.llfn(), index as c_uint) - } - } -+ -+impl From for llvm::CallConv { -+ fn from(conv: Conv) -> Self { -+ match conv { -+ Conv::C | Conv::Rust | Conv::CCmseNonSecureCall => llvm::CCallConv, -+ Conv::RustCold => llvm::ColdCallConv, -+ Conv::AmdGpuKernel => llvm::AmdGpuKernel, -+ Conv::AvrInterrupt => llvm::AvrInterrupt, -+ Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt, -+ Conv::ArmAapcs => llvm::ArmAapcsCallConv, -+ Conv::Msp430Intr => llvm::Msp430Intr, -+ Conv::PtxKernel => llvm::PtxKernel, -+ Conv::X86Fastcall => llvm::X86FastcallCallConv, -+ Conv::X86Intr => llvm::X86_Intr, -+ Conv::X86Stdcall => llvm::X86StdcallCallConv, -+ Conv::X86ThisCall => llvm::X86_ThisCall, -+ Conv::X86VectorCall => llvm::X86_VectorCall, -+ Conv::X86_64SysV => llvm::X86_64_SysV, -+ Conv::X86_64Win64 => llvm::X86_64_Win64, -+ } -+ } -+} -diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs -index 79ddfd884dfa..f3ef618fff54 100644 ---- a/compiler/rustc_codegen_llvm/src/context.rs -+++ b/compiler/rustc_codegen_llvm/src/context.rs -@@ -570,8 +570,14 @@ fn apply_target_cpu_attr(&self, llfn: &'ll Value) { - } - - fn declare_c_main(&self, fn_type: Self::Type) -> Option { -- if self.get_declared_value("main").is_none() { -- Some(self.declare_cfn("main", llvm::UnnamedAddr::Global, fn_type)) -+ let entry_name = self.sess().target.entry_name.as_ref(); -+ if self.get_declared_value(entry_name).is_none() { -+ Some(self.declare_entry_fn( -+ entry_name, -+ self.sess().target.entry_abi.into(), -+ llvm::UnnamedAddr::Global, -+ fn_type, -+ )) - } else { - // If the symbol already exists, it is an error: for example, the user wrote - // #[no_mangle] extern "C" fn main(..) {..} -diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs -index f79ef11720df..dc21a02cec44 100644 ---- a/compiler/rustc_codegen_llvm/src/declare.rs -+++ b/compiler/rustc_codegen_llvm/src/declare.rs -@@ -90,6 +90,28 @@ pub fn declare_cfn( - declare_raw_fn(self, name, llvm::CCallConv, unnamed, visibility, fn_type) - } - -+ /// Declare an entry Function -+ /// -+ /// The ABI of this function can change depending on the target (although for now the same as -+ /// `declare_cfn`) -+ /// -+ /// If there’s a value with the same name already declared, the function will -+ /// update the declaration and return existing Value instead. -+ pub fn declare_entry_fn( -+ &self, -+ name: &str, -+ callconv: llvm::CallConv, -+ unnamed: llvm::UnnamedAddr, -+ fn_type: &'ll Type, -+ ) -> &'ll Value { -+ let visibility = if self.tcx.sess.target.default_hidden_visibility { -+ llvm::Visibility::Hidden -+ } else { -+ llvm::Visibility::Default -+ }; -+ declare_raw_fn(self, name, callconv, unnamed, visibility, fn_type) -+ } -+ - /// Declare a Rust function. - /// - /// If there’s a value with the same name already declared, the function will -diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs -index 752f6b1ef40c..22f534d909ab 100644 ---- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs -+++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs -@@ -180,7 +180,8 @@ fn exported_symbols_provider_local<'tcx>( - .collect(); - - if tcx.entry_fn(()).is_some() { -- let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, "main")); -+ let exported_symbol = -+ ExportedSymbol::NoDefId(SymbolName::new(tcx, tcx.sess.target.entry_name.as_ref())); - - symbols.push(( - exported_symbol, -diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs -index 9e5f0e4d158b..c622bd36b00c 100644 ---- a/compiler/rustc_target/src/abi/call/mod.rs -+++ b/compiler/rustc_target/src/abi/call/mod.rs -@@ -3,6 +3,7 @@ - use crate::spec::{self, HasTargetSpec}; - use rustc_span::Symbol; - use std::fmt; -+use std::str::FromStr; - - mod aarch64; - mod amdgpu; -@@ -735,6 +736,33 @@ pub fn adjust_for_foreign_abi( - } - } - -+impl FromStr for Conv { -+ type Err = String; -+ -+ fn from_str(s: &str) -> Result { -+ match s { -+ "C" => Ok(Conv::C), -+ "Rust" => Ok(Conv::Rust), -+ "RustCold" => Ok(Conv::Rust), -+ "ArmAapcs" => Ok(Conv::ArmAapcs), -+ "CCmseNonSecureCall" => Ok(Conv::CCmseNonSecureCall), -+ "Msp430Intr" => Ok(Conv::Msp430Intr), -+ "PtxKernel" => Ok(Conv::PtxKernel), -+ "X86Fastcall" => Ok(Conv::X86Fastcall), -+ "X86Intr" => Ok(Conv::X86Intr), -+ "X86Stdcall" => Ok(Conv::X86Stdcall), -+ "X86ThisCall" => Ok(Conv::X86ThisCall), -+ "X86VectorCall" => Ok(Conv::X86VectorCall), -+ "X86_64SysV" => Ok(Conv::X86_64SysV), -+ "X86_64Win64" => Ok(Conv::X86_64Win64), -+ "AmdGpuKernel" => Ok(Conv::AmdGpuKernel), -+ "AvrInterrupt" => Ok(Conv::AvrInterrupt), -+ "AvrNonBlockingInterrupt" => Ok(Conv::AvrNonBlockingInterrupt), -+ _ => Err(format!("'{}' is not a valid value for entry function call convetion.", s)), -+ } -+ } -+} -+ - // Some types are used a lot. Make sure they don't unintentionally get bigger. - #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] - mod size_asserts { -diff --git a/compiler/rustc_target/src/json.rs b/compiler/rustc_target/src/json.rs -index b5d926352122..75bb76a9de08 100644 ---- a/compiler/rustc_target/src/json.rs -+++ b/compiler/rustc_target/src/json.rs -@@ -89,3 +89,28 @@ fn to_json(&self) -> Json { - } - } - } -+ -+impl ToJson for crate::abi::call::Conv { -+ fn to_json(&self) -> Json { -+ let s = match self { -+ Self::C => "C", -+ Self::Rust => "Rust", -+ Self::RustCold => "RustCold", -+ Self::ArmAapcs => "ArmAapcs", -+ Self::CCmseNonSecureCall => "CCmseNonSecureCall", -+ Self::Msp430Intr => "Msp430Intr", -+ Self::PtxKernel => "PtxKernel", -+ Self::X86Fastcall => "X86Fastcall", -+ Self::X86Intr => "X86Intr", -+ Self::X86Stdcall => "X86Stdcall", -+ Self::X86ThisCall => "X86ThisCall", -+ Self::X86VectorCall => "X86VectorCall", -+ Self::X86_64SysV => "X86_64SysV", -+ Self::X86_64Win64 => "X86_64Win64", -+ Self::AmdGpuKernel => "AmdGpuKernel", -+ Self::AvrInterrupt => "AvrInterrupt", -+ Self::AvrNonBlockingInterrupt => "AvrNonBlockingInterrupt", -+ }; -+ Json::String(s.to_owned()) -+ } -+} -diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs -index 72b088d663b1..617de46a55aa 100644 ---- a/compiler/rustc_target/src/spec/mod.rs -+++ b/compiler/rustc_target/src/spec/mod.rs -@@ -34,6 +34,7 @@ - //! the target's settings, though `target-feature` and `link-args` will *add* - //! to the list specified by the target, rather than replace. - -+use crate::abi::call::Conv; - use crate::abi::Endian; - use crate::json::{Json, ToJson}; - use crate::spec::abi::{lookup as lookup_abi, Abi}; -@@ -1668,6 +1669,14 @@ pub struct TargetOptions { - /// Whether the target supports stack canary checks. `true` by default, - /// since this is most common among tier 1 and tier 2 targets. - pub supports_stack_protector: bool, -+ -+ // The name of entry function. -+ // Default value is "main" -+ pub entry_name: StaticCow, -+ -+ // The ABI of entry function. -+ // Default value is `Conv::C`, i.e. C call convention -+ pub entry_abi: Conv, - } - - /// Add arguments for the given flavor and also for its "twin" flavors -@@ -1884,6 +1893,8 @@ fn default() -> TargetOptions { - c_enum_min_bits: 32, - generate_arange_section: true, - supports_stack_protector: true, -+ entry_name: "main".into(), -+ entry_abi: Conv::C, - } - } - } -@@ -2401,6 +2412,18 @@ macro_rules! key { - } - } - } ); -+ ($key_name:ident, Conv) => ( { -+ let name = (stringify!($key_name)).replace("_", "-"); -+ obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { -+ match Conv::from_str(s) { -+ Ok(c) => { -+ base.$key_name = c; -+ Some(Ok(())) -+ } -+ Err(e) => Some(Err(e)) -+ } -+ })).unwrap_or(Ok(())) -+ } ); - } - - if let Some(j) = obj.remove("target-endian") { -@@ -2520,6 +2543,8 @@ macro_rules! key { - key!(c_enum_min_bits, u64); - key!(generate_arange_section, bool); - key!(supports_stack_protector, bool); -+ key!(entry_name); -+ key!(entry_abi, Conv)?; - - if base.is_builtin { - // This can cause unfortunate ICEs later down the line. -@@ -2770,6 +2795,8 @@ macro_rules! target_option_val { - target_option_val!(c_enum_min_bits); - target_option_val!(generate_arange_section); - target_option_val!(supports_stack_protector); -+ target_option_val!(entry_name); -+ target_option_val!(entry_abi); - - if let Some(abi) = self.default_adjusted_cabi { - d.insert("default-adjusted-cabi".into(), Abi::name(abi).to_json()); --- -2.38.1 - diff --git a/0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch b/0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch deleted file mode 100644 index 3f087ef..0000000 --- a/0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 98ae83daae67e9e7663b8345eced1de8c667271f Mon Sep 17 00:00:00 2001 -From: Dan Gohman -Date: Thu, 8 Dec 2022 10:35:46 -0800 -Subject: [PATCH] Mangle "main" as "__main_void" on wasm32-wasi - -On wasm, the age-old C trick of having a main function which can either have -no arguments or argc+argv doesn't work, because wasm requires caller and -callee signatures to match. WASI's current strategy is to have compilers -mangle main's name to indicate which signature they're using. Rust uses the -no-argument form, which should be mangled as `__main_void`. - -This is needed on wasm32-wasi as of #105395. ---- - compiler/rustc_target/src/spec/wasm32_wasi.rs | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/compiler/rustc_target/src/spec/wasm32_wasi.rs b/compiler/rustc_target/src/spec/wasm32_wasi.rs -index 6f0bbf0672d4..a0476d542e64 100644 ---- a/compiler/rustc_target/src/spec/wasm32_wasi.rs -+++ b/compiler/rustc_target/src/spec/wasm32_wasi.rs -@@ -104,6 +104,10 @@ pub fn target() -> Target { - // `args::args()` makes the WASI API calls itself. - options.main_needs_argc_argv = false; - -+ // And, WASI mangles the name of "main" to distinguish between different -+ // signatures. -+ options.entry_name = "__main_void".into(); -+ - Target { - llvm_target: "wasm32-wasi".into(), - pointer_width: 32, --- -2.38.1 - diff --git a/0001-compiletest-set-the-dylib-path-when-gathering-target.patch b/0001-compiletest-set-the-dylib-path-when-gathering-target.patch deleted file mode 100644 index 54185a7..0000000 --- a/0001-compiletest-set-the-dylib-path-when-gathering-target.patch +++ /dev/null @@ -1,185 +0,0 @@ -From 2bdbc5fbf7f84c62f8c7b1007f3b6fd6d3da06f6 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Fri, 14 Oct 2022 16:11:28 -0700 -Subject: [PATCH] compiletest: set the dylib path when gathering target cfg - -If the compiler is built with `rpath = false`, then it won't find its -own libraries unless the library search path is set. We already do that -while running the actual compiletests, but #100260 added another rustc -command for getting the target cfg. - - Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) - thread 'main' panicked at 'error: failed to get cfg info from "[...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" - --- stdout - - --- stderr - [...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-a2a76dc626cd02d2.so: cannot open shared object file: No such file or directory - ', src/tools/compiletest/src/common.rs:476:13 - -Now the library path is set here as well, so it works without rpath. - -(cherry picked from commit f8a0cc2ca8a644ddb63867526711ba17cb7508c8) ---- - src/tools/compiletest/src/common.rs | 20 +++++++++++--------- - src/tools/compiletest/src/runtest.rs | 27 +++------------------------ - src/tools/compiletest/src/util.rs | 23 +++++++++++++++++++++++ - 3 files changed, 37 insertions(+), 33 deletions(-) - -diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs -index 0260f6848386..9a432f11f82f 100644 ---- a/src/tools/compiletest/src/common.rs -+++ b/src/tools/compiletest/src/common.rs -@@ -2,11 +2,12 @@ - - use std::ffi::OsString; - use std::fmt; -+use std::iter; - use std::path::{Path, PathBuf}; - use std::process::Command; - use std::str::FromStr; - --use crate::util::PathBufExt; -+use crate::util::{add_dylib_path, PathBufExt}; - use lazycell::LazyCell; - use test::ColorConfig; - -@@ -385,8 +386,7 @@ pub fn run_enabled(&self) -> bool { - } - - fn target_cfg(&self) -> &TargetCfg { -- self.target_cfg -- .borrow_with(|| TargetCfg::new(&self.rustc_path, &self.target, &self.target_rustcflags)) -+ self.target_cfg.borrow_with(|| TargetCfg::new(self)) - } - - pub fn matches_arch(&self, arch: &str) -> bool { -@@ -457,21 +457,23 @@ pub enum Endian { - } - - impl TargetCfg { -- fn new(rustc_path: &Path, target: &str, target_rustcflags: &Vec) -> TargetCfg { -- let output = match Command::new(rustc_path) -+ fn new(config: &Config) -> TargetCfg { -+ let mut command = Command::new(&config.rustc_path); -+ add_dylib_path(&mut command, iter::once(&config.compile_lib_path)); -+ let output = match command - .arg("--print=cfg") - .arg("--target") -- .arg(target) -- .args(target_rustcflags) -+ .arg(&config.target) -+ .args(&config.target_rustcflags) - .output() - { - Ok(output) => output, -- Err(e) => panic!("error: failed to get cfg info from {:?}: {e}", rustc_path), -+ Err(e) => panic!("error: failed to get cfg info from {:?}: {e}", config.rustc_path), - }; - if !output.status.success() { - panic!( - "error: failed to get cfg info from {:?}\n--- stdout\n{}\n--- stderr\n{}", -- rustc_path, -+ config.rustc_path, - String::from_utf8(output.stdout).unwrap(), - String::from_utf8(output.stderr).unwrap(), - ); -diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs -index 8af5f1da694b..f8903f754f09 100644 ---- a/src/tools/compiletest/src/runtest.rs -+++ b/src/tools/compiletest/src/runtest.rs -@@ -13,7 +13,7 @@ - use crate::header::TestProps; - use crate::json; - use crate::read2::read2_abbreviated; --use crate::util::{logv, PathBufExt}; -+use crate::util::{add_dylib_path, dylib_env_var, logv, PathBufExt}; - use crate::ColorConfig; - use regex::{Captures, Regex}; - use rustfix::{apply_suggestions, get_suggestions_from_json, Filter}; -@@ -26,6 +26,7 @@ - use std::hash::{Hash, Hasher}; - use std::io::prelude::*; - use std::io::{self, BufReader}; -+use std::iter; - use std::path::{Path, PathBuf}; - use std::process::{Child, Command, ExitStatus, Output, Stdio}; - use std::str; -@@ -72,19 +73,6 @@ fn disable_error_reporting R, R>(f: F) -> R { - f() - } - --/// The name of the environment variable that holds dynamic library locations. --pub fn dylib_env_var() -> &'static str { -- if cfg!(windows) { -- "PATH" -- } else if cfg!(target_os = "macos") { -- "DYLD_LIBRARY_PATH" -- } else if cfg!(target_os = "haiku") { -- "LIBRARY_PATH" -- } else { -- "LD_LIBRARY_PATH" -- } --} -- - /// The platform-specific library name - pub fn get_lib_name(lib: &str, dylib: bool) -> String { - // In some casess (e.g. MUSL), we build a static -@@ -1811,16 +1799,7 @@ fn compose_and_run( - - // Need to be sure to put both the lib_path and the aux path in the dylib - // search path for the child. -- let mut path = -- env::split_paths(&env::var_os(dylib_env_var()).unwrap_or_default()).collect::>(); -- if let Some(p) = aux_path { -- path.insert(0, PathBuf::from(p)) -- } -- path.insert(0, PathBuf::from(lib_path)); -- -- // Add the new dylib search path var -- let newpath = env::join_paths(&path).unwrap(); -- command.env(dylib_env_var(), newpath); -+ add_dylib_path(&mut command, iter::once(lib_path).chain(aux_path)); - - let mut child = disable_error_reporting(|| command.spawn()) - .unwrap_or_else(|_| panic!("failed to exec `{:?}`", &command)); -diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs -index e5ff0906be8a..ec36f1e4fb72 100644 ---- a/src/tools/compiletest/src/util.rs -+++ b/src/tools/compiletest/src/util.rs -@@ -2,6 +2,7 @@ - use std::env; - use std::ffi::OsStr; - use std::path::PathBuf; -+use std::process::Command; - - use tracing::*; - -@@ -111,3 +112,25 @@ fn with_extra_extension>(&self, extension: S) -> PathBuf { - } - } - } -+ -+/// The name of the environment variable that holds dynamic library locations. -+pub fn dylib_env_var() -> &'static str { -+ if cfg!(windows) { -+ "PATH" -+ } else if cfg!(target_os = "macos") { -+ "DYLD_LIBRARY_PATH" -+ } else if cfg!(target_os = "haiku") { -+ "LIBRARY_PATH" -+ } else { -+ "LD_LIBRARY_PATH" -+ } -+} -+ -+/// Adds a list of lookup paths to `cmd`'s dynamic library lookup path. -+/// If the dylib_path_var is already set for this cmd, the old value will be overwritten! -+pub fn add_dylib_path(cmd: &mut Command, paths: impl Iterator>) { -+ let path_env = env::var_os(dylib_env_var()); -+ let old_paths = path_env.as_ref().map(env::split_paths); -+ let new_paths = paths.map(Into::into).chain(old_paths.into_iter().flatten()); -+ cmd.env(dylib_env_var(), env::join_paths(new_paths).unwrap()); -+} --- -2.38.1 - diff --git a/rust.spec b/rust.spec index 249e50b..04de8a6 100644 --- a/rust.spec +++ b/rust.spec @@ -8,9 +8,9 @@ # 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.65.0 -%global bootstrap_channel 1.65.0 -%global bootstrap_date 2022-11-03 +%global bootstrap_version 1.66.0 +%global bootstrap_channel 1.66.0 +%global bootstrap_date 2022-12-15 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -46,7 +46,7 @@ # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 12.0+. %global min_llvm_version 13.0.0 -%global bundled_llvm_version 15.0.2 +%global bundled_llvm_version 15.0.6 %bcond_with bundled_llvm # Requires stable libgit2 1.5, and not the next minor soname change. @@ -83,8 +83,8 @@ %endif Name: rust -Version: 1.66.1 -Release: 2%{?dist} +Version: 1.67.0 +Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -106,15 +106,6 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch -# https://github.com/rust-lang/rust/pull/103072 -Patch3: 0001-compiletest-set-the-dylib-path-when-gathering-target.patch - -# https://github.com/rust-lang/rust/pull/104001 -Patch4: 0001-Improve-generating-Custom-entry-function.patch - -# https://github.com/rust-lang/rust/pull/105468 -Patch5: 0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch - ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) @@ -125,7 +116,7 @@ Patch100: rustc-1.65.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.65.0-disable-http2.patch +Patch101: rustc-1.67.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) @@ -589,9 +580,6 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -991,16 +979,7 @@ end} %files doc %docdir %{_docdir}/%{name} %dir %{_docdir}/%{name} -%dir %{_docdir}/%{name}/html -%{_docdir}/%{name}/html/*/ -%{_docdir}/%{name}/html/*.html -%{_docdir}/%{name}/html/*.css -%{_docdir}/%{name}/html/*.js -%{_docdir}/%{name}/html/*.png -%{_docdir}/%{name}/html/*.svg -%{_docdir}/%{name}/html/*.woff2 -%license %{_docdir}/%{name}/html/*.txt -%license %{_docdir}/%{name}/html/*.md +%{_docdir}/%{name}/html # former cargo-doc %docdir %{_docdir}/cargo %dir %{_docdir}/cargo @@ -1056,6 +1035,9 @@ end} %changelog +* Thu Jan 26 2023 Josh Stone - 1.67.0-1 +- Update to 1.67.0. + * Fri Jan 20 2023 Fedora Release Engineering - 1.66.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild diff --git a/rustc-1.65.0-disable-http2.patch b/rustc-1.67.0-disable-http2.patch similarity index 77% rename from rustc-1.65.0-disable-http2.patch rename to rustc-1.67.0-disable-http2.patch index 99e33c7..7b346e9 100644 --- a/rustc-1.65.0-disable-http2.patch +++ b/rustc-1.67.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2022-10-04 10:55:48.797517289 -0700 -+++ rustc-beta-src/Cargo.lock 2022-10-04 10:55:48.799517248 -0700 -@@ -1026,7 +1026,6 @@ +--- rustc-beta-src/Cargo.lock.orig 2023-01-24 13:25:47.822917185 -0800 ++++ rustc-beta-src/Cargo.lock 2023-01-24 13:25:47.824917142 -0800 +@@ -1062,7 +1062,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -1993,16 +1992,6 @@ +@@ -2181,16 +2180,6 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] @@ -25,40 +25,19 @@ name = "libz-sys" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2022-10-04 10:55:48.799517248 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2022-10-04 11:00:55.057162743 -0700 +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-01-24 13:25:47.824917142 -0800 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-01-24 13:26:29.209044200 -0800 @@ -21,7 +21,7 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.1.2" } - cargo-util = { path = "crates/cargo-util", version = "0.2.1" } - crates-io = { path = "crates/crates-io", version = "0.34.0" } --curl = { version = "0.4.43", features = ["http2"] } -+curl = { version = "0.4.43", features = [] } - curl-sys = "0.4.55" - env_logger = "0.9.0" + cargo-util = { path = "crates/cargo-util", version = "0.2.3" } + crates-io = { path = "crates/crates-io", version = "0.35.0" } +-curl = { version = "0.4.44", features = ["http2"] } ++curl = { version = "0.4.44", features = [] } + curl-sys = "0.4.59" + env_logger = "0.10.0" pretty_env_logger = { version = "0.4", optional = true } ---- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2022-09-24 10:23:17.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2022-10-04 10:55:48.799517248 -0700 -@@ -192,16 +192,8 @@ - } - self.fetch_started = true; - -- // We've enabled the `http2` feature of `curl` in Cargo, so treat -- // failures here as fatal as it would indicate a build-time problem. -- self.multiplexing = self.config.http_config()?.multiplexing.unwrap_or(true); -- -- self.multi -- .pipelining(false, self.multiplexing) -- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; -- -- // let's not flood the server with connections -- self.multi.set_max_host_connections(2)?; -+ // Multiplexing is disabled because the system libcurl doesn't support it. -+ self.multiplexing = false; - - self.config - .shell() ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-09-24 10:23:17.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2022-10-04 10:55:48.800517227 -0700 +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-01-21 17:17:19.000000000 -0800 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-01-24 13:25:47.824917142 -0800 @@ -403,16 +403,9 @@ sources: SourceMap<'cfg>, config: &'cfg Config, @@ -88,3 +67,24 @@ if let Err(e) = result { warn!("ignoring libcurl {} error: {}", $msg, e); } +--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-01-21 17:17:19.000000000 -0800 ++++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-01-24 13:25:47.824917142 -0800 +@@ -223,16 +223,8 @@ + } + self.fetch_started = true; + +- // We've enabled the `http2` feature of `curl` in Cargo, so treat +- // failures here as fatal as it would indicate a build-time problem. +- self.multiplexing = self.config.http_config()?.multiplexing.unwrap_or(true); +- +- self.multi +- .pipelining(false, self.multiplexing) +- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; +- +- // let's not flood the server with connections +- self.multi.set_max_host_connections(2)?; ++ // Multiplexing is disabled because the system libcurl doesn't support it. ++ self.multiplexing = false; + + self.config + .shell() diff --git a/sources b/sources index 4fb006d..222afaa 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.66.1-src.tar.xz) = 1944c024c603140d0a9236043a3bd1d0d211dd8d368d6d82a3a620f1ff43b29624755b0943f2b38b40a188c7eee77a840238ea757eaf435e2a3fa6a0e6b82832 +SHA512 (rustc-1.67.0-src.tar.xz) = 6d1ddb54c0ee2c4f8ccf73f3c306c8d8868feb738d5e77eb5a5d25f716395c27d1b3666929c87f9dc84213a9acfdb56254feac92ef0fea3147e2c644391c12b4 SHA512 (wasi-libc-wasi-sdk-17.tar.gz) = 5870f86d4a8431edefaef41163d1fa7eddeabcfa6bc5794c7bf18b4fd320b6ea43c261a7e41966d0da1490a2d96b9742c82cbcca7c56bb404830722664cab376 From 23df2b257f7b947181dc4c049bfb7c6ef0cebf43 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 27 Jan 2023 15:00:45 -0800 Subject: [PATCH 10/45] Backport a couple of fixes from upstream One fix to a problem that broke mesa build, and one fix to a problem that broke rust bootstrap. --- 107360-modified.patch | 26 +++++++++++++ ...a0b3dd5fe14b43ad5b7862f4528df7322468.patch | 38 +++++++++++++++++++ rust.spec | 18 ++++++++- 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 107360-modified.patch create mode 100644 675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch diff --git a/107360-modified.patch b/107360-modified.patch new file mode 100644 index 0000000..3d59653 --- /dev/null +++ b/107360-modified.patch @@ -0,0 +1,26 @@ +From de363d54c40a378717881240e719f5f7223ba376 Mon Sep 17 00:00:00 2001 +From: bjorn3 <17426603+bjorn3@users.noreply.github.com> +Date: Fri, 27 Jan 2023 11:48:36 +0000 +Subject: [PATCH 3/4] Revert back to LlvmArchiveBuilder on all platforms + +ArArchiveBuilder doesn't support reading thin archives, causing a +regression. +--- + compiler/rustc_codegen_llvm/src/back/archive.rs | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs +index b00676b7c592b..58ca87524deb6 100644 +--- a/compiler/rustc_codegen_llvm/src/back/archive.rs ++++ b/compiler/rustc_codegen_llvm/src/back/archive.rs +@@ -108,7 +108,9 @@ pub struct LlvmArchiveBuilderBuilder; + + impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder { + fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box + 'a> { +- if sess.target.arch == "wasm32" || sess.target.arch == "wasm64" { ++ // FIXME use ArArchiveBuilder on most targets again once reading thin archives is ++ // implemented ++ if true || sess.target.arch == "wasm32" || sess.target.arch == "wasm64" { + Box::new(LlvmArchiveBuilder { sess, additions: Vec::new() }) + } else { + Box::new(ArArchiveBuilder::new(sess, get_llvm_object_symbols)) diff --git a/675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch b/675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch new file mode 100644 index 0000000..eb16066 --- /dev/null +++ b/675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch @@ -0,0 +1,38 @@ +From 675fa0b3dd5fe14b43ad5b7862f4528df7322468 Mon Sep 17 00:00:00 2001 +From: Michael Goulet +Date: Mon, 12 Dec 2022 18:29:33 +0000 +Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20fix=20unsoundness=20in=20bootstr?= + =?UTF-8?q?ap=20cache=20code?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + src/bootstrap/cache.rs | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs +index be5c9bb078808..05f25af68ea8f 100644 +--- a/src/bootstrap/cache.rs ++++ b/src/bootstrap/cache.rs +@@ -89,16 +89,16 @@ impl Hash for Interned { + + impl Deref for Interned { + type Target = T::Target; +- fn deref(&self) -> &'static Self::Target { ++ fn deref(&self) -> &Self::Target { + let l = T::intern_cache().lock().unwrap(); +- unsafe { mem::transmute::<&Self::Target, &'static Self::Target>(l.get(*self)) } ++ unsafe { mem::transmute::<&Self::Target, &Self::Target>(l.get(*self)) } + } + } + + impl, U: ?Sized> AsRef for Interned { +- fn as_ref(&self) -> &'static U { ++ fn as_ref(&self) -> &U { + let l = T::intern_cache().lock().unwrap(); +- unsafe { mem::transmute::<&U, &'static U>(l.get(*self).as_ref()) } ++ unsafe { mem::transmute::<&U, &U>(l.get(*self).as_ref()) } + } + } + diff --git a/rust.spec b/rust.spec index 04de8a6..1c2cc6c 100644 --- a/rust.spec +++ b/rust.spec @@ -84,7 +84,7 @@ Name: rust Version: 1.67.0 -Release: 1%{?dist} +Release: 2awb%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -106,6 +106,16 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch +# Fix bootstrap failure +# https://github.com/rust-lang/rust/commit/675fa0b3dd5fe14b43ad5b7862f4528df7322468 +Patch3: 675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch + +# fix build of mesa, possibly other things; patch edited to only +# include the one commit necessary on top of 1.67.0 +# https://github.com/rust-lang/rust/issues/107334 +# https://github.com/rust-lang/rust/pull/107360 +Patch4: 107360-modified.patch + ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) @@ -580,6 +590,8 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 +%patch3 -p1 +%patch4 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -1035,6 +1047,10 @@ end} %changelog +* Fri Jan 27 2023 Adam Williamson - 1.67.0-2 +- Backport PR #107360 to fix build of mesa +- Backport 675fa0b3 to fix bootstrapping failure + * Thu Jan 26 2023 Josh Stone - 1.67.0-1 - Update to 1.67.0. From de194644254b9a01eb6e010a907db02378270095 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 27 Jan 2023 15:02:29 -0800 Subject: [PATCH 11/45] Drop private build tag inadvertently left in release --- rust.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust.spec b/rust.spec index 1c2cc6c..63eca7d 100644 --- a/rust.spec +++ b/rust.spec @@ -84,7 +84,7 @@ Name: rust Version: 1.67.0 -Release: 2awb%{?dist} +Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) From d8cb2d0d2e842c3f97f9e9dbff097ae297cd15bf Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 3 Feb 2023 14:44:01 -0800 Subject: [PATCH 12/45] Unbundle libgit2 on Fedora 38. --- rust.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust.spec b/rust.spec index 63eca7d..03c816f 100644 --- a/rust.spec +++ b/rust.spec @@ -54,7 +54,7 @@ %global min_libgit2_version 1.5.0 %global next_libgit2_version 1.6.0~ %global bundled_libgit2_version 1.5.0 -%if 0%{?fedora} >= 99 +%if 0%{?fedora} >= 38 %bcond_with bundled_libgit2 %else %bcond_without bundled_libgit2 @@ -84,7 +84,7 @@ Name: rust Version: 1.67.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -1047,6 +1047,9 @@ end} %changelog +* Fri Feb 03 2023 Josh Stone - 1.67.0-3 +- Unbundle libgit2 on Fedora 38. + * Fri Jan 27 2023 Adam Williamson - 1.67.0-2 - Backport PR #107360 to fix build of mesa - Backport 675fa0b3 to fix bootstrapping failure From 752fe3bcd2d1df989986fc5829445ec937311e74 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 9 Feb 2023 16:52:15 -0800 Subject: [PATCH 13/45] Update to 1.67.1. --- 0001-Fix-Async-Generator-ABI.patch | 55 +++++++++++++++++++ 107360-modified.patch | 26 --------- ...a0b3dd5fe14b43ad5b7862f4528df7322468.patch | 38 ------------- rust.spec | 20 +++---- 4 files changed, 63 insertions(+), 76 deletions(-) create mode 100644 0001-Fix-Async-Generator-ABI.patch delete mode 100644 107360-modified.patch delete mode 100644 675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch diff --git a/0001-Fix-Async-Generator-ABI.patch b/0001-Fix-Async-Generator-ABI.patch new file mode 100644 index 0000000..34dd1bc --- /dev/null +++ b/0001-Fix-Async-Generator-ABI.patch @@ -0,0 +1,55 @@ +From ecf812777a260e35ec9cd0c7d9dbd17a3f5cf5f9 Mon Sep 17 00:00:00 2001 +From: Arpad Borsos +Date: Tue, 29 Nov 2022 23:17:08 +0100 +Subject: [PATCH] Fix Async Generator ABI + +This change was missed when making async generators implement `Future` directly. +It did not cause any problems in codegen so far, as `GeneratorState<(), Output>` +happens to have the same ABI as `Poll`. +--- + compiler/rustc_ty_utils/src/abi.rs | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs +index 73c7eb6992f0..d644cbccea11 100644 +--- a/compiler/rustc_ty_utils/src/abi.rs ++++ b/compiler/rustc_ty_utils/src/abi.rs +@@ -85,7 +85,7 @@ fn fn_sig_for_fn_abi<'tcx>( + bound_vars, + ) + } +- ty::Generator(_, substs, _) => { ++ ty::Generator(did, substs, _) => { + let sig = substs.as_generator().poly_sig(); + + let bound_vars = tcx.mk_bound_variable_kinds( +@@ -104,10 +104,22 @@ fn fn_sig_for_fn_abi<'tcx>( + let env_ty = tcx.mk_adt(pin_adt_ref, pin_substs); + + let sig = sig.skip_binder(); +- let state_did = tcx.require_lang_item(LangItem::GeneratorState, None); +- let state_adt_ref = tcx.adt_def(state_did); +- let state_substs = tcx.intern_substs(&[sig.yield_ty.into(), sig.return_ty.into()]); +- let ret_ty = tcx.mk_adt(state_adt_ref, state_substs); ++ // The `FnSig` and the `ret_ty` here is for a generators main ++ // `Generator::resume(...) -> GeneratorState` function in case we ++ // have an ordinary generator, or the `Future::poll(...) -> Poll` ++ // function in case this is a special generator backing an async construct. ++ let ret_ty = if tcx.generator_is_async(did) { ++ let state_did = tcx.require_lang_item(LangItem::Poll, None); ++ let state_adt_ref = tcx.adt_def(state_did); ++ let state_substs = tcx.intern_substs(&[sig.return_ty.into()]); ++ tcx.mk_adt(state_adt_ref, state_substs) ++ } else { ++ let state_did = tcx.require_lang_item(LangItem::GeneratorState, None); ++ let state_adt_ref = tcx.adt_def(state_did); ++ let state_substs = tcx.intern_substs(&[sig.yield_ty.into(), sig.return_ty.into()]); ++ tcx.mk_adt(state_adt_ref, state_substs) ++ }; ++ + ty::Binder::bind_with_vars( + tcx.mk_fn_sig( + [env_ty, sig.resume_ty].iter(), +-- +2.39.1 + diff --git a/107360-modified.patch b/107360-modified.patch deleted file mode 100644 index 3d59653..0000000 --- a/107360-modified.patch +++ /dev/null @@ -1,26 +0,0 @@ -From de363d54c40a378717881240e719f5f7223ba376 Mon Sep 17 00:00:00 2001 -From: bjorn3 <17426603+bjorn3@users.noreply.github.com> -Date: Fri, 27 Jan 2023 11:48:36 +0000 -Subject: [PATCH 3/4] Revert back to LlvmArchiveBuilder on all platforms - -ArArchiveBuilder doesn't support reading thin archives, causing a -regression. ---- - compiler/rustc_codegen_llvm/src/back/archive.rs | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs -index b00676b7c592b..58ca87524deb6 100644 ---- a/compiler/rustc_codegen_llvm/src/back/archive.rs -+++ b/compiler/rustc_codegen_llvm/src/back/archive.rs -@@ -108,7 +108,9 @@ pub struct LlvmArchiveBuilderBuilder; - - impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder { - fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box + 'a> { -- if sess.target.arch == "wasm32" || sess.target.arch == "wasm64" { -+ // FIXME use ArArchiveBuilder on most targets again once reading thin archives is -+ // implemented -+ if true || sess.target.arch == "wasm32" || sess.target.arch == "wasm64" { - Box::new(LlvmArchiveBuilder { sess, additions: Vec::new() }) - } else { - Box::new(ArArchiveBuilder::new(sess, get_llvm_object_symbols)) diff --git a/675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch b/675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch deleted file mode 100644 index eb16066..0000000 --- a/675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 675fa0b3dd5fe14b43ad5b7862f4528df7322468 Mon Sep 17 00:00:00 2001 -From: Michael Goulet -Date: Mon, 12 Dec 2022 18:29:33 +0000 -Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20fix=20unsoundness=20in=20bootstr?= - =?UTF-8?q?ap=20cache=20code?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - src/bootstrap/cache.rs | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs -index be5c9bb078808..05f25af68ea8f 100644 ---- a/src/bootstrap/cache.rs -+++ b/src/bootstrap/cache.rs -@@ -89,16 +89,16 @@ impl Hash for Interned { - - impl Deref for Interned { - type Target = T::Target; -- fn deref(&self) -> &'static Self::Target { -+ fn deref(&self) -> &Self::Target { - let l = T::intern_cache().lock().unwrap(); -- unsafe { mem::transmute::<&Self::Target, &'static Self::Target>(l.get(*self)) } -+ unsafe { mem::transmute::<&Self::Target, &Self::Target>(l.get(*self)) } - } - } - - impl, U: ?Sized> AsRef for Interned { -- fn as_ref(&self) -> &'static U { -+ fn as_ref(&self) -> &U { - let l = T::intern_cache().lock().unwrap(); -- unsafe { mem::transmute::<&U, &'static U>(l.get(*self).as_ref()) } -+ unsafe { mem::transmute::<&U, &U>(l.get(*self).as_ref()) } - } - } - diff --git a/rust.spec b/rust.spec index 03c816f..5a377de 100644 --- a/rust.spec +++ b/rust.spec @@ -83,8 +83,8 @@ %endif Name: rust -Version: 1.67.0 -Release: 3%{?dist} +Version: 1.67.1 +Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -106,15 +106,9 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch -# Fix bootstrap failure -# https://github.com/rust-lang/rust/commit/675fa0b3dd5fe14b43ad5b7862f4528df7322468 -Patch3: 675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch - -# fix build of mesa, possibly other things; patch edited to only -# include the one commit necessary on top of 1.67.0 -# https://github.com/rust-lang/rust/issues/107334 -# https://github.com/rust-lang/rust/pull/107360 -Patch4: 107360-modified.patch +# Fix Async Generator ABI (rhbz2168622) +# https://github.com/rust-lang/rust/pull/105082 +Patch3: 0001-Fix-Async-Generator-ABI.patch ### RHEL-specific patches below ### @@ -591,7 +585,6 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 %patch3 -p1 -%patch4 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -1047,6 +1040,9 @@ end} %changelog +* Thu Feb 09 2023 Josh Stone - 1.67.1-1 +- Update to 1.67.1. + * Fri Feb 03 2023 Josh Stone - 1.67.0-3 - Unbundle libgit2 on Fedora 38. From f50b7f0c263de110a03416a5bdcc4454cdd112bd Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 9 Feb 2023 16:56:40 -0800 Subject: [PATCH 14/45] fedpkg new-sources --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3de52c7..d66305a 100644 --- a/.gitignore +++ b/.gitignore @@ -411,3 +411,4 @@ /wasi-libc-wasi-sdk-17.tar.gz /rustc-1.66.1-src.tar.xz /rustc-1.67.0-src.tar.xz +/rustc-1.67.1-src.tar.xz diff --git a/sources b/sources index 222afaa..a139b61 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.67.0-src.tar.xz) = 6d1ddb54c0ee2c4f8ccf73f3c306c8d8868feb738d5e77eb5a5d25f716395c27d1b3666929c87f9dc84213a9acfdb56254feac92ef0fea3147e2c644391c12b4 +SHA512 (rustc-1.67.1-src.tar.xz) = 42d77ee93b168ae139b026138fb48d925624ff436a836aa97ee235f870e61ea11643b0cf7ad20bcafda774c6cd3855a4bc10a2e2ed1c4d82c6f15158963b304d SHA512 (wasi-libc-wasi-sdk-17.tar.gz) = 5870f86d4a8431edefaef41163d1fa7eddeabcfa6bc5794c7bf18b4fd320b6ea43c261a7e41966d0da1490a2d96b9742c82cbcca7c56bb404830722664cab376 From 375b75425b9b973f9bcc2c795b44849240e1cc1b Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Mon, 20 Feb 2023 11:43:19 -0700 Subject: [PATCH 15/45] Ship rust-toolset for EPEL7 --- rust.spec | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rust.spec b/rust.spec index 5a377de..4d60a3c 100644 --- a/rust.spec +++ b/rust.spec @@ -84,7 +84,7 @@ Name: rust Version: 1.67.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -548,7 +548,7 @@ feature for the Rust standard library. The RLS (Rust Language Server) uses this data to provide information about the Rust standard library. -%if 0%{?rhel} && 0%{?rhel} >= 8 +%if 0%{?rhel} %package toolset Summary: Rust Toolset @@ -846,7 +846,7 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_* # We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp) rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* -%if 0%{?rhel} && 0%{?rhel} >= 8 +%if 0%{?rhel} # This allows users to build packages using Rust Toolset. %{__install} -D -m 644 %{S:100} %{buildroot}%{rpmmacrodir}/macros.rust-toolset %endif @@ -1033,13 +1033,16 @@ end} %{rustlibdir}/%{rust_triple}/analysis/ -%if 0%{?rhel} && 0%{?rhel} >= 8 +%if 0%{?rhel} %files toolset %{rpmmacrodir}/macros.rust-toolset %endif %changelog +* Mon Feb 20 2023 Orion Poplawski - 1.67.1-2 +- Ship rust-toolset for EPEL7 + * Thu Feb 09 2023 Josh Stone - 1.67.1-1 - Update to 1.67.1. From 7f5b9608ec19e481fd248e44882e42828cf28ed1 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Mon, 20 Feb 2023 15:30:35 -0700 Subject: [PATCH 16/45] Make rust-toolset noarch --- rust.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rust.spec b/rust.spec index 4d60a3c..0073cdb 100644 --- a/rust.spec +++ b/rust.spec @@ -552,8 +552,9 @@ data to provide information about the Rust standard library. %package toolset Summary: Rust Toolset -Requires: rust%{?_isa} = %{version}-%{release} -Requires: cargo%{?_isa} = %{version}-%{release} +BuildArch: noarch +Requires: rust = %{version}-%{release} +Requires: cargo = %{version}-%{release} %description toolset This is the metapackage for Rust Toolset, bringing in the Rust compiler, From b85b429e0026b2de8dabad1a4bdef2e4337d6053 Mon Sep 17 00:00:00 2001 From: David Michael Date: Tue, 7 Mar 2023 10:26:00 -0500 Subject: [PATCH 17/45] Add a virtual Provides to rust-std-static with the target triple This supports depending on a variable target using something like the following since the other target stdlib subpackages are named by this convention. BuildRequires: rust-std-static-%{cargo_target} --- rust.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rust.spec b/rust.spec index 0073cdb..47628ee 100644 --- a/rust.spec +++ b/rust.spec @@ -84,7 +84,7 @@ Name: rust Version: 1.67.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -330,6 +330,7 @@ This package includes the Rust compiler and documentation generator. %package std-static Summary: Standard library for Rust +Provides: %{name}-std-static-%{rust_triple} = %{version}-%{release} Requires: %{name} = %{version}-%{release} Requires: glibc-devel%{?_isa} >= 2.11 @@ -1041,6 +1042,9 @@ end} %changelog +* Tue Mar 07 2023 David Michael - 1.67.1-3 +- Add a virtual Provides to rust-std-static containing the target triple. + * Mon Feb 20 2023 Orion Poplawski - 1.67.1-2 - Ship rust-toolset for EPEL7 From a07799699ff200fe13adbdc0780398794d1b6c11 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 9 Mar 2023 08:52:34 -0800 Subject: [PATCH 18/45] Update to 1.68.0. --- .gitignore | 2 + 0001-Fix-Async-Generator-ABI.patch | 55 ------------------- rust.spec | 32 ++++++----- ....patch => rustc-1.68.0-disable-http2.patch | 46 ++++++++-------- sources | 4 +- 5 files changed, 46 insertions(+), 93 deletions(-) delete mode 100644 0001-Fix-Async-Generator-ABI.patch rename rustc-1.67.0-disable-http2.patch => rustc-1.68.0-disable-http2.patch (75%) diff --git a/.gitignore b/.gitignore index d66305a..357f367 100644 --- a/.gitignore +++ b/.gitignore @@ -412,3 +412,5 @@ /rustc-1.66.1-src.tar.xz /rustc-1.67.0-src.tar.xz /rustc-1.67.1-src.tar.xz +/rustc-1.68.0-src.tar.xz +/wasi-libc-wasi-sdk-19.tar.gz diff --git a/0001-Fix-Async-Generator-ABI.patch b/0001-Fix-Async-Generator-ABI.patch deleted file mode 100644 index 34dd1bc..0000000 --- a/0001-Fix-Async-Generator-ABI.patch +++ /dev/null @@ -1,55 +0,0 @@ -From ecf812777a260e35ec9cd0c7d9dbd17a3f5cf5f9 Mon Sep 17 00:00:00 2001 -From: Arpad Borsos -Date: Tue, 29 Nov 2022 23:17:08 +0100 -Subject: [PATCH] Fix Async Generator ABI - -This change was missed when making async generators implement `Future` directly. -It did not cause any problems in codegen so far, as `GeneratorState<(), Output>` -happens to have the same ABI as `Poll`. ---- - compiler/rustc_ty_utils/src/abi.rs | 22 +++++++++++++++++----- - 1 file changed, 17 insertions(+), 5 deletions(-) - -diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs -index 73c7eb6992f0..d644cbccea11 100644 ---- a/compiler/rustc_ty_utils/src/abi.rs -+++ b/compiler/rustc_ty_utils/src/abi.rs -@@ -85,7 +85,7 @@ fn fn_sig_for_fn_abi<'tcx>( - bound_vars, - ) - } -- ty::Generator(_, substs, _) => { -+ ty::Generator(did, substs, _) => { - let sig = substs.as_generator().poly_sig(); - - let bound_vars = tcx.mk_bound_variable_kinds( -@@ -104,10 +104,22 @@ fn fn_sig_for_fn_abi<'tcx>( - let env_ty = tcx.mk_adt(pin_adt_ref, pin_substs); - - let sig = sig.skip_binder(); -- let state_did = tcx.require_lang_item(LangItem::GeneratorState, None); -- let state_adt_ref = tcx.adt_def(state_did); -- let state_substs = tcx.intern_substs(&[sig.yield_ty.into(), sig.return_ty.into()]); -- let ret_ty = tcx.mk_adt(state_adt_ref, state_substs); -+ // The `FnSig` and the `ret_ty` here is for a generators main -+ // `Generator::resume(...) -> GeneratorState` function in case we -+ // have an ordinary generator, or the `Future::poll(...) -> Poll` -+ // function in case this is a special generator backing an async construct. -+ let ret_ty = if tcx.generator_is_async(did) { -+ let state_did = tcx.require_lang_item(LangItem::Poll, None); -+ let state_adt_ref = tcx.adt_def(state_did); -+ let state_substs = tcx.intern_substs(&[sig.return_ty.into()]); -+ tcx.mk_adt(state_adt_ref, state_substs) -+ } else { -+ let state_did = tcx.require_lang_item(LangItem::GeneratorState, None); -+ let state_adt_ref = tcx.adt_def(state_did); -+ let state_substs = tcx.intern_substs(&[sig.yield_ty.into(), sig.return_ty.into()]); -+ tcx.mk_adt(state_adt_ref, state_substs) -+ }; -+ - ty::Binder::bind_with_vars( - tcx.mk_fn_sig( - [env_ty, sig.resume_ty].iter(), --- -2.39.1 - diff --git a/rust.spec b/rust.spec index 47628ee..6589fd3 100644 --- a/rust.spec +++ b/rust.spec @@ -1,4 +1,4 @@ -# Only x86_64 and i686 are Tier 1 platforms at this time. +# Only x86_64, i686, and aarch64 are Tier 1 platforms at this time. # https://doc.rust-lang.org/nightly/rustc/platform-support.html %global rust_arches x86_64 i686 armv7hl aarch64 ppc64le s390x @@ -8,9 +8,9 @@ # 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.66.0 -%global bootstrap_channel 1.66.0 -%global bootstrap_date 2022-12-15 +%global bootstrap_version 1.67.1 +%global bootstrap_channel 1.67.1 +%global bootstrap_date 2023-02-09 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -35,7 +35,7 @@ # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh # (updated per https://github.com/rust-lang/rust/pull/96907) %global wasi_libc_url https://github.com/WebAssembly/wasi-libc -%global wasi_libc_ref wasi-sdk-17 +%global wasi_libc_ref wasi-sdk-19 %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} @@ -83,8 +83,8 @@ %endif Name: rust -Version: 1.67.1 -Release: 3%{?dist} +Version: 1.68.0 +Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -106,10 +106,6 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch -# Fix Async Generator ABI (rhbz2168622) -# https://github.com/rust-lang/rust/pull/105082 -Patch3: 0001-Fix-Async-Generator-ABI.patch - ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) @@ -120,7 +116,7 @@ Patch100: rustc-1.65.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.67.0-disable-http2.patch +Patch101: rustc-1.68.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) @@ -332,7 +328,7 @@ This package includes the Rust compiler and documentation generator. Summary: Standard library for Rust Provides: %{name}-std-static-%{rust_triple} = %{version}-%{release} Requires: %{name} = %{version}-%{release} -Requires: glibc-devel%{?_isa} >= 2.11 +Requires: glibc-devel%{?_isa} >= 2.17 %description std-static This package includes the standard libraries for building applications @@ -586,7 +582,6 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 -%patch3 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -656,6 +651,12 @@ find vendor -name .cargo-checksum.json \ # it's a shebang and make them executable. Then brp-mangle-shebangs gets upset... find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' +# The distro flags are only appropriate for the host, not our cross-targets, +# and they're not as fine-grained as the settings we choose for std vs rustc. +%if %defined build_rustflags +%global build_rustflags %{nil} +%endif + # Set up shared environment variables for build/install/check %global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} %if 0%{?cmake_path:1} @@ -1042,6 +1043,9 @@ end} %changelog +* Thu Mar 09 2023 Josh Stone - 1.68.0-1 +- Update to 1.68.0. + * Tue Mar 07 2023 David Michael - 1.67.1-3 - Add a virtual Provides to rust-std-static containing the target triple. diff --git a/rustc-1.67.0-disable-http2.patch b/rustc-1.68.0-disable-http2.patch similarity index 75% rename from rustc-1.67.0-disable-http2.patch rename to rustc-1.68.0-disable-http2.patch index 7b346e9..09c4339 100644 --- a/rustc-1.67.0-disable-http2.patch +++ b/rustc-1.68.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2023-01-24 13:25:47.822917185 -0800 -+++ rustc-beta-src/Cargo.lock 2023-01-24 13:25:47.824917142 -0800 -@@ -1062,7 +1062,6 @@ +--- rustc-beta-src/Cargo.lock.orig 2023-03-03 17:26:41.309081970 -0800 ++++ rustc-beta-src/Cargo.lock 2023-03-03 17:26:41.311081929 -0800 +@@ -1152,7 +1152,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -2181,16 +2180,6 @@ +@@ -2399,16 +2398,6 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] @@ -25,20 +25,20 @@ name = "libz-sys" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-01-24 13:25:47.824917142 -0800 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-01-24 13:26:29.209044200 -0800 +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-03-03 17:26:41.311081929 -0800 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-03-03 17:27:32.999013773 -0800 @@ -21,7 +21,7 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.1.2" } cargo-util = { path = "crates/cargo-util", version = "0.2.3" } - crates-io = { path = "crates/crates-io", version = "0.35.0" } + crates-io = { path = "crates/crates-io", version = "0.35.1" } -curl = { version = "0.4.44", features = ["http2"] } +curl = { version = "0.4.44", features = [] } curl-sys = "0.4.59" env_logger = "0.10.0" pretty_env_logger = { version = "0.4", optional = true } ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-01-21 17:17:19.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-01-24 13:25:47.824917142 -0800 -@@ -403,16 +403,9 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-02-26 19:02:38.000000000 -0800 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-03-03 17:26:41.311081929 -0800 +@@ -402,16 +402,9 @@ sources: SourceMap<'cfg>, config: &'cfg Config, ) -> CargoResult> { @@ -58,18 +58,9 @@ Ok(PackageSet { packages: package_ids -@@ -658,7 +651,7 @@ - macro_rules! try_old_curl { - ($e:expr, $msg:expr) => { - let result = $e; -- if cfg!(target_os = "macos") { -+ if cfg!(any(target_os = "linux", target_os = "macos")) { - if let Err(e) = result { - warn!("ignoring libcurl {} error: {}", $msg, e); - } ---- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-01-21 17:17:19.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-01-24 13:25:47.824917142 -0800 -@@ -223,16 +223,8 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-02-26 19:02:38.000000000 -0800 ++++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-03-03 17:26:41.311081929 -0800 +@@ -220,16 +220,8 @@ } self.fetch_started = true; @@ -88,3 +79,14 @@ self.config .shell() +--- rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs.orig 2023-02-26 19:02:38.000000000 -0800 ++++ rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs 2023-03-03 17:29:54.808076261 -0800 +@@ -116,7 +116,7 @@ + macro_rules! try_old_curl { + ($e:expr, $msg:expr) => { + let result = $e; +- if cfg!(target_os = "macos") { ++ if cfg!(any(target_os = "linux", target_os = "macos")) { + if let Err(e) = result { + warn!("ignoring libcurl {} error: {}", $msg, e); + } diff --git a/sources b/sources index a139b61..1d510ad 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.67.1-src.tar.xz) = 42d77ee93b168ae139b026138fb48d925624ff436a836aa97ee235f870e61ea11643b0cf7ad20bcafda774c6cd3855a4bc10a2e2ed1c4d82c6f15158963b304d -SHA512 (wasi-libc-wasi-sdk-17.tar.gz) = 5870f86d4a8431edefaef41163d1fa7eddeabcfa6bc5794c7bf18b4fd320b6ea43c261a7e41966d0da1490a2d96b9742c82cbcca7c56bb404830722664cab376 +SHA512 (rustc-1.68.0-src.tar.xz) = f6cc5c06488080f2d7ce8c4f5adf7ca8ae8b10caea627b57876b051593af1201a48823d0abf5fcbcd344b46606b53957569db9844d647a5fdc4abca06e260f3a +SHA512 (wasi-libc-wasi-sdk-19.tar.gz) = 312f4d01d1b1108c24a1e9b233648ec44408ec1b7c17e8a65288038a94f117be9ed8181c60f99f9593ff80ca380f53c51756357bad466cd65027cb23a3646d23 From b4bb093ae0542643ac4d4d3d3e439153e7d1c5f9 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 23 Mar 2023 08:42:27 -0700 Subject: [PATCH 19/45] Update to 1.68.1. --- .gitignore | 1 + rust.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 357f367..32af96d 100644 --- a/.gitignore +++ b/.gitignore @@ -414,3 +414,4 @@ /rustc-1.67.1-src.tar.xz /rustc-1.68.0-src.tar.xz /wasi-libc-wasi-sdk-19.tar.gz +/rustc-1.68.1-src.tar.xz diff --git a/rust.spec b/rust.spec index 6589fd3..fb51bb8 100644 --- a/rust.spec +++ b/rust.spec @@ -83,7 +83,7 @@ %endif Name: rust -Version: 1.68.0 +Version: 1.68.1 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -1043,6 +1043,9 @@ end} %changelog +* Thu Mar 23 2023 Josh Stone - 1.68.1-1 +- Update to 1.68.1. + * Thu Mar 09 2023 Josh Stone - 1.68.0-1 - Update to 1.68.0. diff --git a/sources b/sources index 1d510ad..4d7894e 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.68.0-src.tar.xz) = f6cc5c06488080f2d7ce8c4f5adf7ca8ae8b10caea627b57876b051593af1201a48823d0abf5fcbcd344b46606b53957569db9844d647a5fdc4abca06e260f3a +SHA512 (rustc-1.68.1-src.tar.xz) = cf3921bc260db54b0f3afc0e6bc9fe8d560ddb81de5d2d4496746307d42a8010291f119d0cfc463996efce6ef829a0494b4eb6145e21c94fd113ff51ee010e21 SHA512 (wasi-libc-wasi-sdk-19.tar.gz) = 312f4d01d1b1108c24a1e9b233648ec44408ec1b7c17e8a65288038a94f117be9ed8181c60f99f9593ff80ca380f53c51756357bad466cd65027cb23a3646d23 From 7ac7a42b5e2fd46d73d2a0946c55109c03e22966 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 28 Mar 2023 10:11:01 -0700 Subject: [PATCH 20/45] Update to 1.68.2. --- .gitignore | 1 + rust.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 32af96d..ebd8c24 100644 --- a/.gitignore +++ b/.gitignore @@ -415,3 +415,4 @@ /rustc-1.68.0-src.tar.xz /wasi-libc-wasi-sdk-19.tar.gz /rustc-1.68.1-src.tar.xz +/rustc-1.68.2-src.tar.xz diff --git a/rust.spec b/rust.spec index fb51bb8..d01c2c4 100644 --- a/rust.spec +++ b/rust.spec @@ -83,7 +83,7 @@ %endif Name: rust -Version: 1.68.1 +Version: 1.68.2 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -1043,6 +1043,9 @@ end} %changelog +* Tue Mar 28 2023 Josh Stone - 1.68.2-1 +- Update to 1.68.2. + * Thu Mar 23 2023 Josh Stone - 1.68.1-1 - Update to 1.68.1. diff --git a/sources b/sources index 4d7894e..63e72f1 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.68.1-src.tar.xz) = cf3921bc260db54b0f3afc0e6bc9fe8d560ddb81de5d2d4496746307d42a8010291f119d0cfc463996efce6ef829a0494b4eb6145e21c94fd113ff51ee010e21 +SHA512 (rustc-1.68.2-src.tar.xz) = 8b085d0351e19100e9abc24b10c44a0939a1d35ba23421da4ece345d7373f7dbad1dc6a2ae153c1259404dd96b41e2682e711cf2b0b63fd03a196760cddbcdd3 SHA512 (wasi-libc-wasi-sdk-19.tar.gz) = 312f4d01d1b1108c24a1e9b233648ec44408ec1b7c17e8a65288038a94f117be9ed8181c60f99f9593ff80ca380f53c51756357bad466cd65027cb23a3646d23 From 77613da92c9f095e8a67c2373892ec08d84dd7c0 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 20 Apr 2023 09:47:54 -0700 Subject: [PATCH 21/45] Update to 1.69.0. Obsolete rust-analysis. --- .gitignore | 2 + rust.spec | 90 +++++++++++-------- ....patch => rustc-1.69.0-disable-http2.patch | 34 +++---- sources | 4 +- 4 files changed, 73 insertions(+), 57 deletions(-) rename rustc-1.68.0-disable-http2.patch => rustc-1.69.0-disable-http2.patch (74%) diff --git a/.gitignore b/.gitignore index ebd8c24..0b1ecb7 100644 --- a/.gitignore +++ b/.gitignore @@ -416,3 +416,5 @@ /wasi-libc-wasi-sdk-19.tar.gz /rustc-1.68.1-src.tar.xz /rustc-1.68.2-src.tar.xz +/rustc-1.69.0-src.tar.xz +/wasi-libc-1dfe5c302d1c5ab621f7abf04620fae92700fd22.tar.gz diff --git a/rust.spec b/rust.spec index d01c2c4..4c7031e 100644 --- a/rust.spec +++ b/rust.spec @@ -1,6 +1,6 @@ # Only x86_64, i686, and aarch64 are Tier 1 platforms at this time. # https://doc.rust-lang.org/nightly/rustc/platform-support.html -%global rust_arches x86_64 i686 armv7hl aarch64 ppc64le s390x +%global rust_arches x86_64 i686 armv7hl aarch64 ppc64le s390x riscv64 # The channel can be stable, beta, or nightly %{!?channel: %global channel stable} @@ -8,9 +8,9 @@ # 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.67.1 -%global bootstrap_channel 1.67.1 -%global bootstrap_date 2023-02-09 +%global bootstrap_version 1.68.2 +%global bootstrap_channel 1.68.2 +%global bootstrap_date 2023-03-28 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -35,7 +35,8 @@ # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh # (updated per https://github.com/rust-lang/rust/pull/96907) %global wasi_libc_url https://github.com/WebAssembly/wasi-libc -%global wasi_libc_ref wasi-sdk-19 +#global wasi_libc_ref wasi-sdk-20 +%global wasi_libc_ref 1dfe5c302d1c5ab621f7abf04620fae92700fd22 %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} @@ -44,9 +45,9 @@ %bcond_with llvm_static # We can also choose to just use Rust's bundled LLVM, in case the system LLVM -# is insufficient. Rust currently requires LLVM 12.0+. -%global min_llvm_version 13.0.0 -%global bundled_llvm_version 15.0.6 +# is insufficient. Rust currently requires LLVM 14.0+. +%global min_llvm_version 14.0.0 +%global bundled_llvm_version 15.0.7 %bcond_with bundled_llvm # Requires stable libgit2 1.5, and not the next minor soname change. @@ -83,7 +84,7 @@ %endif Name: rust -Version: 1.68.2 +Version: 1.69.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -116,7 +117,7 @@ Patch100: rustc-1.65.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.68.0-disable-http2.patch +Patch101: rustc-1.69.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) @@ -139,7 +140,14 @@ Patch102: rustc-1.65.0-no-default-pie.patch return arch.."-unknown-linux-"..abi end} +# Get the environment form of a Rust triple +%{lua: function rust_triple_env(triple) + local sub = string.gsub(triple, "-", "_") + return string.upper(sub) +end} + %global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))} +%global rust_triple_env %{lua: print(rust_triple_env(rpm.expand("%{rust_triple}")))} %if %defined bootstrap_arches # For each bootstrap arch, add an additional binary Source. @@ -215,7 +223,7 @@ Provides: bundled(llvm) = %{bundled_llvm_version} %else BuildRequires: cmake >= 2.8.11 %if 0%{?epel} == 7 -%global llvm llvm13 +%global llvm llvm14 %endif %if %defined llvm %global llvm_root %{_libdir}/%{llvm} @@ -252,7 +260,7 @@ Requires: %{name}-std-static%{?_isa} = %{version}-%{release} Requires: /usr/bin/cc %if 0%{?epel} == 7 -%global devtoolset_name devtoolset-9 +%global devtoolset_name devtoolset-11 BuildRequires: %{devtoolset_name}-binutils BuildRequires: %{devtoolset_name}-gcc BuildRequires: %{devtoolset_name}-gcc-c++ @@ -317,6 +325,10 @@ find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)' %{nil} %endif +# This component was removed as of Rust 1.69.0. +# https://github.com/rust-lang/rust/pull/101841 +Obsoletes: %{name}-analysis < 1.69.0~ + %description Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. @@ -531,20 +543,6 @@ This package includes source files for the Rust standard library. It may be useful as a reference for code completion tools in various editors. -%package analysis -Summary: Compiler analysis data for the Rust standard library -%if 0%{?rhel} && 0%{?rhel} < 8 -Requires: %{name}-std-static%{?_isa} = %{version}-%{release} -%else -Recommends: %{name}-std-static%{?_isa} = %{version}-%{release} -%endif - -%description analysis -This package contains analysis data files produced with rustc's -Zsave-analysis -feature for the Rust standard library. The RLS (Rust Language Server) uses this -data to provide information about the Rust standard library. - - %if 0%{?rhel} %package toolset @@ -580,20 +578,20 @@ test -f '%{local_rust_root}/bin/rustc' %setup -q -n %{rustc_package} -%patch1 -p1 -%patch2 -p1 +%patch -P1 -p1 +%patch -P2 -p1 %if %with disabled_libssh2 -%patch100 -p1 +%patch -P100 -p1 %endif %if %without curl_http2 -%patch101 -p1 +%patch -P101 -p1 rm -rf vendor/libnghttp2-sys/ %endif %if 0%{?rhel} && 0%{?rhel} < 8 -%patch102 -p1 +%patch -P102 -p1 %endif # Use our explicit python3 first @@ -657,9 +655,26 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' %global build_rustflags %{nil} %endif +# These are similar to __cflags_arch_* in /usr/lib/rpm/redhat/macros +%if 0%{?fedora} || 0%{?rhel} >= 9 +%ifarch x86_64 +%global rust_target_cpu %[0%{?rhel} >= 10 ? "x86-64-v3" : ""] +%global rust_target_cpu %[0%{?rhel} == 9 ? "x86-64-v2" : "%{rust_target_cpu}"] +%endif +%ifarch s390x +%global rust_target_cpu %[0%{?rhel} >= 9 ? "z14" : "zEC12"] +%endif +%ifarch ppc64le +%global rust_target_cpu %[0%{?rhel} >= 9 ? "pwr9" : "pwr8"] +%endif +%endif + # Set up shared environment variables for build/install/check %global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} -%if 0%{?cmake_path:1} +%if "%{?rust_target_cpu}" != "" +%global rust_env %{?rust_env} CARGO_TARGET_%{rust_triple_env}_RUSTFLAGS=-Ctarget-cpu=%{rust_target_cpu} +%endif +%if %defined cmake_path %global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH" %endif %if %without disabled_libssh2 @@ -668,7 +683,6 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' %endif %global export_rust_env %{?rust_env:export %{rust_env}} - %build %{export_rust_env} @@ -754,7 +768,7 @@ end} --set build.install-stage=2 \ --set build.test-stage=2 \ --enable-extended \ - --tools=analysis,cargo,clippy,rls,rust-analyzer,rustfmt,src \ + --tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \ --enable-vendor \ --enable-verbose-tests \ --dist-compression-formats=gz \ @@ -1032,10 +1046,6 @@ end} %{rustlibdir}/src -%files analysis -%{rustlibdir}/%{rust_triple}/analysis/ - - %if 0%{?rhel} %files toolset %{rpmmacrodir}/macros.rust-toolset @@ -1043,6 +1053,10 @@ end} %changelog +* Thu Apr 20 2023 Josh Stone - 1.69.0-1 +- Update to 1.69.0. +- Obsolete rust-analysis. + * Tue Mar 28 2023 Josh Stone - 1.68.2-1 - Update to 1.68.2. diff --git a/rustc-1.68.0-disable-http2.patch b/rustc-1.69.0-disable-http2.patch similarity index 74% rename from rustc-1.68.0-disable-http2.patch rename to rustc-1.69.0-disable-http2.patch index 09c4339..09e7930 100644 --- a/rustc-1.68.0-disable-http2.patch +++ b/rustc-1.69.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2023-03-03 17:26:41.309081970 -0800 -+++ rustc-beta-src/Cargo.lock 2023-03-03 17:26:41.311081929 -0800 -@@ -1152,7 +1152,6 @@ +--- rustc-beta-src/Cargo.lock.orig 2023-03-23 17:10:30.810989345 -0700 ++++ rustc-beta-src/Cargo.lock 2023-03-23 17:10:30.812989303 -0700 +@@ -1142,7 +1142,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -2399,16 +2398,6 @@ +@@ -2375,16 +2374,6 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] @@ -25,20 +25,20 @@ name = "libz-sys" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-03-03 17:26:41.311081929 -0800 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-03-03 17:27:32.999013773 -0800 -@@ -21,7 +21,7 @@ - cargo-platform = { path = "crates/cargo-platform", version = "0.1.2" } +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-03-23 17:10:30.812989303 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-03-23 17:11:26.242836664 -0700 +@@ -23,7 +23,7 @@ cargo-util = { path = "crates/cargo-util", version = "0.2.3" } - crates-io = { path = "crates/crates-io", version = "0.35.1" } + clap = "4.1.3" + crates-io = { path = "crates/crates-io", version = "0.36.0" } -curl = { version = "0.4.44", features = ["http2"] } +curl = { version = "0.4.44", features = [] } curl-sys = "0.4.59" env_logger = "0.10.0" - pretty_env_logger = { version = "0.4", optional = true } ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-02-26 19:02:38.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-03-03 17:26:41.311081929 -0800 -@@ -402,16 +402,9 @@ + filetime = "0.2.9" +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-03-19 00:20:55.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-03-23 17:10:30.812989303 -0700 +@@ -401,16 +401,9 @@ sources: SourceMap<'cfg>, config: &'cfg Config, ) -> CargoResult> { @@ -58,8 +58,8 @@ Ok(PackageSet { packages: package_ids ---- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-02-26 19:02:38.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-03-03 17:26:41.311081929 -0800 +--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-03-19 00:20:55.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-03-23 17:10:30.813989282 -0700 @@ -220,16 +220,8 @@ } self.fetch_started = true; @@ -79,8 +79,8 @@ self.config .shell() ---- rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs.orig 2023-02-26 19:02:38.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs 2023-03-03 17:29:54.808076261 -0800 +--- rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs.orig 2023-03-19 00:20:55.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs 2023-03-23 17:10:30.813989282 -0700 @@ -116,7 +116,7 @@ macro_rules! try_old_curl { ($e:expr, $msg:expr) => { diff --git a/sources b/sources index 63e72f1..577db98 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.68.2-src.tar.xz) = 8b085d0351e19100e9abc24b10c44a0939a1d35ba23421da4ece345d7373f7dbad1dc6a2ae153c1259404dd96b41e2682e711cf2b0b63fd03a196760cddbcdd3 -SHA512 (wasi-libc-wasi-sdk-19.tar.gz) = 312f4d01d1b1108c24a1e9b233648ec44408ec1b7c17e8a65288038a94f117be9ed8181c60f99f9593ff80ca380f53c51756357bad466cd65027cb23a3646d23 +SHA512 (rustc-1.69.0-src.tar.xz) = 724398fc208ec18adbd8ba81a445e23d1001b746990f36b869126be8a45f1cdfa75f5b9cbdd0abbab506f91a56d3736ab247677699ebd69525245558cfc01a60 +SHA512 (wasi-libc-1dfe5c302d1c5ab621f7abf04620fae92700fd22.tar.gz) = 6f813bc7822746c161932de6b84fb965111400a1a38c25dd0981209d588b9ccafe1a5923349110c536f1b7cda707dfa2d0be42c92b2fa6fd89c957eda27bda27 From 41fd9d78988e1fd1a9238cb67d8a96070bf72698 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 1 May 2023 10:07:31 -0700 Subject: [PATCH 22/45] Build with LLVM 15 on Fedora 38+ --- rust.spec | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rust.spec b/rust.spec index 4c7031e..cf35d33 100644 --- a/rust.spec +++ b/rust.spec @@ -85,7 +85,7 @@ Name: rust Version: 1.69.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -222,6 +222,12 @@ BuildRequires: ninja-build Provides: bundled(llvm) = %{bundled_llvm_version} %else BuildRequires: cmake >= 2.8.11 +# LLVM 16 is breaking firefox with "error: Cannot represent a difference across sections" +# https://bugzilla.redhat.com/show_bug.cgi?id=2189964 +# https://github.com/llvm/llvm-project/issues/61932 +%if 0%{?fedora} >= 38 +%global llvm llvm15 +%endif %if 0%{?epel} == 7 %global llvm llvm14 %endif @@ -1053,6 +1059,9 @@ end} %changelog +* Mon May 01 2023 Josh Stone - 1.69.0-2 +- Build with LLVM 15 on Fedora 38+ + * Thu Apr 20 2023 Josh Stone - 1.69.0-1 - Update to 1.69.0. - Obsolete rust-analysis. From 777115da9e2892eb47502c8afcbe2b7742b14879 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 5 May 2023 13:28:08 -0700 Subject: [PATCH 23/45] Fix debuginfo with LLVM 16 --- ...it-method-declaration-and-definition.patch | 254 ++++++++++++++++++ rust.spec | 15 +- 2 files changed, 262 insertions(+), 7 deletions(-) create mode 100644 0001-debuginfo-split-method-declaration-and-definition.patch diff --git a/0001-debuginfo-split-method-declaration-and-definition.patch b/0001-debuginfo-split-method-declaration-and-definition.patch new file mode 100644 index 0000000..03a4937 --- /dev/null +++ b/0001-debuginfo-split-method-declaration-and-definition.patch @@ -0,0 +1,254 @@ +From 1476ebe761884e0cfc92f3f16809011663eb33f0 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Wed, 3 May 2023 15:52:31 -0700 +Subject: [PATCH] debuginfo: split method declaration and definition + +When we're adding a method to a type DIE, we only want a DW_AT_declaration +there, because LLVM LTO can't unify type definitions when a child DIE is a +full subprogram definition. Now the subprogram definition gets added at the +CU level with a specification link back to the abstract declaration. + +(cherry picked from commit 10b69dde3fd15334ea2382d2dc9e9a261de1afaf) +--- + .../rustc_codegen_llvm/src/debuginfo/mod.rs | 86 +++++++++++-------- + compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 15 ++++ + .../rustc_llvm/llvm-wrapper/RustWrapper.cpp | 22 +++++ + .../issue-109934-lto-debuginfo/Makefile | 12 +++ + .../issue-109934-lto-debuginfo/lib.rs | 9 ++ + 5 files changed, 110 insertions(+), 34 deletions(-) + create mode 100644 tests/run-make-fulldeps/issue-109934-lto-debuginfo/Makefile + create mode 100644 tests/run-make-fulldeps/issue-109934-lto-debuginfo/lib.rs + +diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +index 5392534cfcb7..11426b150b6c 100644 +--- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs ++++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +@@ -322,7 +322,7 @@ fn dbg_scope_fn( + let tcx = self.tcx; + + let def_id = instance.def_id(); +- let containing_scope = get_containing_scope(self, instance); ++ let (containing_scope, is_method) = get_containing_scope(self, instance); + let span = tcx.def_span(def_id); + let loc = self.lookup_debug_loc(span.lo()); + let file_metadata = file_metadata(self, &loc.file); +@@ -378,8 +378,29 @@ fn dbg_scope_fn( + } + } + +- unsafe { +- return llvm::LLVMRustDIBuilderCreateFunction( ++ // When we're adding a method to a type DIE, we only want a DW_AT_declaration there, because ++ // LLVM LTO can't unify type definitions when a child DIE is a full subprogram definition. ++ // When we use this `decl` below, the subprogram definition gets created at the CU level ++ // with a DW_AT_specification pointing back to the type's declaration. ++ let decl = is_method.then(|| unsafe { ++ llvm::LLVMRustDIBuilderCreateMethod( ++ DIB(self), ++ containing_scope, ++ name.as_ptr().cast(), ++ name.len(), ++ linkage_name.as_ptr().cast(), ++ linkage_name.len(), ++ file_metadata, ++ loc.line, ++ function_type_metadata, ++ flags, ++ spflags & !DISPFlags::SPFlagDefinition, ++ template_parameters, ++ ) ++ }); ++ ++ return unsafe { ++ llvm::LLVMRustDIBuilderCreateFunction( + DIB(self), + containing_scope, + name.as_ptr().cast(), +@@ -394,9 +415,9 @@ fn dbg_scope_fn( + spflags, + maybe_definition_llfn, + template_parameters, +- None, +- ); +- } ++ decl, ++ ) ++ }; + + fn get_function_signature<'ll, 'tcx>( + cx: &CodegenCx<'ll, 'tcx>, +@@ -495,14 +516,16 @@ fn get_parameter_names(cx: &CodegenCx<'_, '_>, generics: &ty::Generics) -> Vec( + cx: &CodegenCx<'ll, 'tcx>, + instance: Instance<'tcx>, +- ) -> &'ll DIScope { ++ ) -> (&'ll DIScope, bool) { + // First, let's see if this is a method within an inherent impl. Because + // if yes, we want to make the result subroutine DIE a child of the + // subroutine's self-type. +- let self_type = cx.tcx.impl_of_method(instance.def_id()).and_then(|impl_def_id| { ++ if let Some(impl_def_id) = cx.tcx.impl_of_method(instance.def_id()) { + // If the method does *not* belong to a trait, proceed + if cx.tcx.trait_id_of_impl(impl_def_id).is_none() { + let impl_self_ty = cx.tcx.subst_and_normalize_erasing_regions( +@@ -513,39 +536,34 @@ fn get_containing_scope<'ll, 'tcx>( + + // Only "class" methods are generally understood by LLVM, + // so avoid methods on other types (e.g., `<*mut T>::null`). +- match impl_self_ty.kind() { +- ty::Adt(def, ..) if !def.is_box() => { +- // Again, only create type information if full debuginfo is enabled +- if cx.sess().opts.debuginfo == DebugInfo::Full +- && !impl_self_ty.needs_subst() +- { +- Some(type_di_node(cx, impl_self_ty)) +- } else { +- Some(namespace::item_namespace(cx, def.did())) +- } ++ if let ty::Adt(def, ..) = impl_self_ty.kind() && !def.is_box() { ++ // Again, only create type information if full debuginfo is enabled ++ if cx.sess().opts.debuginfo == DebugInfo::Full ++ && !impl_self_ty.needs_subst() ++ { ++ return (type_di_node(cx, impl_self_ty), true); ++ } else { ++ return (namespace::item_namespace(cx, def.did()), false); + } +- _ => None, + } + } else { + // For trait method impls we still use the "parallel namespace" + // strategy +- None + } +- }); ++ } + +- self_type.unwrap_or_else(|| { +- namespace::item_namespace( +- cx, +- DefId { +- krate: instance.def_id().krate, +- index: cx +- .tcx +- .def_key(instance.def_id()) +- .parent +- .expect("get_containing_scope: missing parent?"), +- }, +- ) +- }) ++ let scope = namespace::item_namespace( ++ cx, ++ DefId { ++ krate: instance.def_id().krate, ++ index: cx ++ .tcx ++ .def_key(instance.def_id()) ++ .parent ++ .expect("get_containing_scope: missing parent?"), ++ }, ++ ); ++ (scope, false) + } + } + +diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +index 253c2ca7c768..9dd6db1929fc 100644 +--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs ++++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +@@ -1968,6 +1968,21 @@ pub fn LLVMRustDIBuilderCreateFunction<'a>( + Decl: Option<&'a DIDescriptor>, + ) -> &'a DISubprogram; + ++ pub fn LLVMRustDIBuilderCreateMethod<'a>( ++ Builder: &DIBuilder<'a>, ++ Scope: &'a DIDescriptor, ++ Name: *const c_char, ++ NameLen: size_t, ++ LinkageName: *const c_char, ++ LinkageNameLen: size_t, ++ File: &'a DIFile, ++ LineNo: c_uint, ++ Ty: &'a DIType, ++ Flags: DIFlags, ++ SPFlags: DISPFlags, ++ TParam: &'a DIArray, ++ ) -> &'a DISubprogram; ++ + pub fn LLVMRustDIBuilderCreateBasicType<'a>( + Builder: &DIBuilder<'a>, + Name: *const c_char, +diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +index e3493caaaf74..c4a97af1f0f4 100644 +--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp ++++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +@@ -841,6 +841,28 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( + return wrap(Sub); + } + ++extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod( ++ LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, ++ const char *Name, size_t NameLen, ++ const char *LinkageName, size_t LinkageNameLen, ++ LLVMMetadataRef File, unsigned LineNo, ++ LLVMMetadataRef Ty, LLVMRustDIFlags Flags, ++ LLVMRustDISPFlags SPFlags, LLVMMetadataRef TParam) { ++ DITemplateParameterArray TParams = ++ DITemplateParameterArray(unwrap(TParam)); ++ DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags); ++ DINode::DIFlags llvmFlags = fromRust(Flags); ++ DISubprogram *Sub = Builder->createMethod( ++ unwrapDI(Scope), ++ StringRef(Name, NameLen), ++ StringRef(LinkageName, LinkageNameLen), ++ unwrapDI(File), LineNo, ++ unwrapDI(Ty), ++ 0, 0, nullptr, // VTable params aren't used ++ llvmFlags, llvmSPFlags, TParams); ++ return wrap(Sub); ++} ++ + extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateBasicType( + LLVMRustDIBuilderRef Builder, const char *Name, size_t NameLen, + uint64_t SizeInBits, unsigned Encoding) { +diff --git a/tests/run-make-fulldeps/issue-109934-lto-debuginfo/Makefile b/tests/run-make-fulldeps/issue-109934-lto-debuginfo/Makefile +new file mode 100644 +index 000000000000..3b7a99d3dbc6 +--- /dev/null ++++ b/tests/run-make-fulldeps/issue-109934-lto-debuginfo/Makefile +@@ -0,0 +1,12 @@ ++# ignore-cross-compile ++include ../tools.mk ++ ++# With the upgrade to LLVM 16, this was getting: ++# ++# error: Cannot represent a difference across sections ++# ++# The error stemmed from DI function definitions under type scopes, fixed by ++# only declaring in type scope and defining the subprogram elsewhere. ++ ++all: ++ $(RUSTC) lib.rs --test -C lto=fat -C debuginfo=2 -C incremental=$(TMPDIR)/inc-fat +diff --git a/tests/run-make-fulldeps/issue-109934-lto-debuginfo/lib.rs b/tests/run-make-fulldeps/issue-109934-lto-debuginfo/lib.rs +new file mode 100644 +index 000000000000..c405928bd182 +--- /dev/null ++++ b/tests/run-make-fulldeps/issue-109934-lto-debuginfo/lib.rs +@@ -0,0 +1,9 @@ ++extern crate alloc; ++ ++#[cfg(test)] ++mod tests { ++ #[test] ++ fn something_alloc() { ++ assert_eq!(Vec::::new(), Vec::::new()); ++ } ++} +-- +2.40.1 + diff --git a/rust.spec b/rust.spec index cf35d33..b9f2455 100644 --- a/rust.spec +++ b/rust.spec @@ -85,7 +85,7 @@ Name: rust Version: 1.69.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -107,6 +107,9 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch +# https://github.com/rust-lang/rust/pull/111167 +Patch3: 0001-debuginfo-split-method-declaration-and-definition.patch + ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) @@ -222,12 +225,6 @@ BuildRequires: ninja-build Provides: bundled(llvm) = %{bundled_llvm_version} %else BuildRequires: cmake >= 2.8.11 -# LLVM 16 is breaking firefox with "error: Cannot represent a difference across sections" -# https://bugzilla.redhat.com/show_bug.cgi?id=2189964 -# https://github.com/llvm/llvm-project/issues/61932 -%if 0%{?fedora} >= 38 -%global llvm llvm15 -%endif %if 0%{?epel} == 7 %global llvm llvm14 %endif @@ -586,6 +583,7 @@ test -f '%{local_rust_root}/bin/rustc' %patch -P1 -p1 %patch -P2 -p1 +%patch -P3 -p1 %if %with disabled_libssh2 %patch -P100 -p1 @@ -1059,6 +1057,9 @@ end} %changelog +* Fri May 05 2023 Josh Stone - 1.69.0-3 +- Fix debuginfo with LLVM 16 + * Mon May 01 2023 Josh Stone - 1.69.0-2 - Build with LLVM 15 on Fedora 38+ From 8745dbe4c6ca56ccf4e98fe7e13c757770b0656b Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 4 May 2023 17:13:51 +0200 Subject: [PATCH 24/45] Add rpminspect.yaml config file Added suppresion for reduced debuginfo in i386 builds. --- rpminspect.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 rpminspect.yaml diff --git a/rpminspect.yaml b/rpminspect.yaml new file mode 100644 index 0000000..15b680b --- /dev/null +++ b/rpminspect.yaml @@ -0,0 +1,8 @@ +--- +debuginfo: + ignore: + # i686 has limited debuginfo. From rust.spec + # full debuginfo is exhausting memory; just do libstd for now + # https://github.com/rust-lang/rust/issues/45854 + - /usr/lib/debug/usr/bin/rustc-*.i386.debug + From ff66501ce917bd1c3a0e05935bed1ac615f6fd59 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 9 May 2023 20:02:43 -0700 Subject: [PATCH 25/45] Apply set_build_flags on rhel --- rust.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust.spec b/rust.spec index b9f2455..3f23180 100644 --- a/rust.spec +++ b/rust.spec @@ -787,6 +787,9 @@ for triple in %{?mingw_targets} %{?wasm_targets}; do done %install +%if 0%{?rhel} && 0%{?rhel} <= 9 +%{?set_build_flags} +%endif %{export_rust_env} DESTDIR=%{buildroot} %{__python3} ./x.py install @@ -874,6 +877,9 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* %check +%if 0%{?rhel} && 0%{?rhel} <= 9 +%{?set_build_flags} +%endif %{export_rust_env} # Sanity-check the installed binaries, debuginfo-stripped and all. From 6fff218b1962d9a7a85ca61b3c9fbcc9a54dba4f Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 1 Jun 2023 12:46:43 -0700 Subject: [PATCH 26/45] Update to 1.70.0. --- .gitignore | 2 + ...it-method-declaration-and-definition.patch | 254 ------------------ rust.spec | 65 ++--- rustc-1.61.0-rust-gdb-substitute-path.patch | 18 -- rustc-1.65.0-no-default-pie.patch | 43 --- ....patch => rustc-1.70.0-disable-http2.patch | 42 +-- ...atch => rustc-1.70.0-disable-libssh2.patch | 18 +- rustc-1.70.0-rust-gdb-substitute-path.patch | 21 ++ sources | 4 +- 9 files changed, 82 insertions(+), 385 deletions(-) delete mode 100644 0001-debuginfo-split-method-declaration-and-definition.patch delete mode 100644 rustc-1.61.0-rust-gdb-substitute-path.patch delete mode 100644 rustc-1.65.0-no-default-pie.patch rename rustc-1.69.0-disable-http2.patch => rustc-1.70.0-disable-http2.patch (70%) rename rustc-1.65.0-disable-libssh2.patch => rustc-1.70.0-disable-libssh2.patch (55%) create mode 100644 rustc-1.70.0-rust-gdb-substitute-path.patch diff --git a/.gitignore b/.gitignore index 0b1ecb7..51331ef 100644 --- a/.gitignore +++ b/.gitignore @@ -418,3 +418,5 @@ /rustc-1.68.2-src.tar.xz /rustc-1.69.0-src.tar.xz /wasi-libc-1dfe5c302d1c5ab621f7abf04620fae92700fd22.tar.gz +/rustc-1.70.0-src.tar.xz +/wasi-libc-wasi-sdk-20.tar.gz diff --git a/0001-debuginfo-split-method-declaration-and-definition.patch b/0001-debuginfo-split-method-declaration-and-definition.patch deleted file mode 100644 index 03a4937..0000000 --- a/0001-debuginfo-split-method-declaration-and-definition.patch +++ /dev/null @@ -1,254 +0,0 @@ -From 1476ebe761884e0cfc92f3f16809011663eb33f0 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Wed, 3 May 2023 15:52:31 -0700 -Subject: [PATCH] debuginfo: split method declaration and definition - -When we're adding a method to a type DIE, we only want a DW_AT_declaration -there, because LLVM LTO can't unify type definitions when a child DIE is a -full subprogram definition. Now the subprogram definition gets added at the -CU level with a specification link back to the abstract declaration. - -(cherry picked from commit 10b69dde3fd15334ea2382d2dc9e9a261de1afaf) ---- - .../rustc_codegen_llvm/src/debuginfo/mod.rs | 86 +++++++++++-------- - compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 15 ++++ - .../rustc_llvm/llvm-wrapper/RustWrapper.cpp | 22 +++++ - .../issue-109934-lto-debuginfo/Makefile | 12 +++ - .../issue-109934-lto-debuginfo/lib.rs | 9 ++ - 5 files changed, 110 insertions(+), 34 deletions(-) - create mode 100644 tests/run-make-fulldeps/issue-109934-lto-debuginfo/Makefile - create mode 100644 tests/run-make-fulldeps/issue-109934-lto-debuginfo/lib.rs - -diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs -index 5392534cfcb7..11426b150b6c 100644 ---- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs -+++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs -@@ -322,7 +322,7 @@ fn dbg_scope_fn( - let tcx = self.tcx; - - let def_id = instance.def_id(); -- let containing_scope = get_containing_scope(self, instance); -+ let (containing_scope, is_method) = get_containing_scope(self, instance); - let span = tcx.def_span(def_id); - let loc = self.lookup_debug_loc(span.lo()); - let file_metadata = file_metadata(self, &loc.file); -@@ -378,8 +378,29 @@ fn dbg_scope_fn( - } - } - -- unsafe { -- return llvm::LLVMRustDIBuilderCreateFunction( -+ // When we're adding a method to a type DIE, we only want a DW_AT_declaration there, because -+ // LLVM LTO can't unify type definitions when a child DIE is a full subprogram definition. -+ // When we use this `decl` below, the subprogram definition gets created at the CU level -+ // with a DW_AT_specification pointing back to the type's declaration. -+ let decl = is_method.then(|| unsafe { -+ llvm::LLVMRustDIBuilderCreateMethod( -+ DIB(self), -+ containing_scope, -+ name.as_ptr().cast(), -+ name.len(), -+ linkage_name.as_ptr().cast(), -+ linkage_name.len(), -+ file_metadata, -+ loc.line, -+ function_type_metadata, -+ flags, -+ spflags & !DISPFlags::SPFlagDefinition, -+ template_parameters, -+ ) -+ }); -+ -+ return unsafe { -+ llvm::LLVMRustDIBuilderCreateFunction( - DIB(self), - containing_scope, - name.as_ptr().cast(), -@@ -394,9 +415,9 @@ fn dbg_scope_fn( - spflags, - maybe_definition_llfn, - template_parameters, -- None, -- ); -- } -+ decl, -+ ) -+ }; - - fn get_function_signature<'ll, 'tcx>( - cx: &CodegenCx<'ll, 'tcx>, -@@ -495,14 +516,16 @@ fn get_parameter_names(cx: &CodegenCx<'_, '_>, generics: &ty::Generics) -> Vec( - cx: &CodegenCx<'ll, 'tcx>, - instance: Instance<'tcx>, -- ) -> &'ll DIScope { -+ ) -> (&'ll DIScope, bool) { - // First, let's see if this is a method within an inherent impl. Because - // if yes, we want to make the result subroutine DIE a child of the - // subroutine's self-type. -- let self_type = cx.tcx.impl_of_method(instance.def_id()).and_then(|impl_def_id| { -+ if let Some(impl_def_id) = cx.tcx.impl_of_method(instance.def_id()) { - // If the method does *not* belong to a trait, proceed - if cx.tcx.trait_id_of_impl(impl_def_id).is_none() { - let impl_self_ty = cx.tcx.subst_and_normalize_erasing_regions( -@@ -513,39 +536,34 @@ fn get_containing_scope<'ll, 'tcx>( - - // Only "class" methods are generally understood by LLVM, - // so avoid methods on other types (e.g., `<*mut T>::null`). -- match impl_self_ty.kind() { -- ty::Adt(def, ..) if !def.is_box() => { -- // Again, only create type information if full debuginfo is enabled -- if cx.sess().opts.debuginfo == DebugInfo::Full -- && !impl_self_ty.needs_subst() -- { -- Some(type_di_node(cx, impl_self_ty)) -- } else { -- Some(namespace::item_namespace(cx, def.did())) -- } -+ if let ty::Adt(def, ..) = impl_self_ty.kind() && !def.is_box() { -+ // Again, only create type information if full debuginfo is enabled -+ if cx.sess().opts.debuginfo == DebugInfo::Full -+ && !impl_self_ty.needs_subst() -+ { -+ return (type_di_node(cx, impl_self_ty), true); -+ } else { -+ return (namespace::item_namespace(cx, def.did()), false); - } -- _ => None, - } - } else { - // For trait method impls we still use the "parallel namespace" - // strategy -- None - } -- }); -+ } - -- self_type.unwrap_or_else(|| { -- namespace::item_namespace( -- cx, -- DefId { -- krate: instance.def_id().krate, -- index: cx -- .tcx -- .def_key(instance.def_id()) -- .parent -- .expect("get_containing_scope: missing parent?"), -- }, -- ) -- }) -+ let scope = namespace::item_namespace( -+ cx, -+ DefId { -+ krate: instance.def_id().krate, -+ index: cx -+ .tcx -+ .def_key(instance.def_id()) -+ .parent -+ .expect("get_containing_scope: missing parent?"), -+ }, -+ ); -+ (scope, false) - } - } - -diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -index 253c2ca7c768..9dd6db1929fc 100644 ---- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -@@ -1968,6 +1968,21 @@ pub fn LLVMRustDIBuilderCreateFunction<'a>( - Decl: Option<&'a DIDescriptor>, - ) -> &'a DISubprogram; - -+ pub fn LLVMRustDIBuilderCreateMethod<'a>( -+ Builder: &DIBuilder<'a>, -+ Scope: &'a DIDescriptor, -+ Name: *const c_char, -+ NameLen: size_t, -+ LinkageName: *const c_char, -+ LinkageNameLen: size_t, -+ File: &'a DIFile, -+ LineNo: c_uint, -+ Ty: &'a DIType, -+ Flags: DIFlags, -+ SPFlags: DISPFlags, -+ TParam: &'a DIArray, -+ ) -> &'a DISubprogram; -+ - pub fn LLVMRustDIBuilderCreateBasicType<'a>( - Builder: &DIBuilder<'a>, - Name: *const c_char, -diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp -index e3493caaaf74..c4a97af1f0f4 100644 ---- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp -+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp -@@ -841,6 +841,28 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( - return wrap(Sub); - } - -+extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod( -+ LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, -+ const char *Name, size_t NameLen, -+ const char *LinkageName, size_t LinkageNameLen, -+ LLVMMetadataRef File, unsigned LineNo, -+ LLVMMetadataRef Ty, LLVMRustDIFlags Flags, -+ LLVMRustDISPFlags SPFlags, LLVMMetadataRef TParam) { -+ DITemplateParameterArray TParams = -+ DITemplateParameterArray(unwrap(TParam)); -+ DISubprogram::DISPFlags llvmSPFlags = fromRust(SPFlags); -+ DINode::DIFlags llvmFlags = fromRust(Flags); -+ DISubprogram *Sub = Builder->createMethod( -+ unwrapDI(Scope), -+ StringRef(Name, NameLen), -+ StringRef(LinkageName, LinkageNameLen), -+ unwrapDI(File), LineNo, -+ unwrapDI(Ty), -+ 0, 0, nullptr, // VTable params aren't used -+ llvmFlags, llvmSPFlags, TParams); -+ return wrap(Sub); -+} -+ - extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateBasicType( - LLVMRustDIBuilderRef Builder, const char *Name, size_t NameLen, - uint64_t SizeInBits, unsigned Encoding) { -diff --git a/tests/run-make-fulldeps/issue-109934-lto-debuginfo/Makefile b/tests/run-make-fulldeps/issue-109934-lto-debuginfo/Makefile -new file mode 100644 -index 000000000000..3b7a99d3dbc6 ---- /dev/null -+++ b/tests/run-make-fulldeps/issue-109934-lto-debuginfo/Makefile -@@ -0,0 +1,12 @@ -+# ignore-cross-compile -+include ../tools.mk -+ -+# With the upgrade to LLVM 16, this was getting: -+# -+# error: Cannot represent a difference across sections -+# -+# The error stemmed from DI function definitions under type scopes, fixed by -+# only declaring in type scope and defining the subprogram elsewhere. -+ -+all: -+ $(RUSTC) lib.rs --test -C lto=fat -C debuginfo=2 -C incremental=$(TMPDIR)/inc-fat -diff --git a/tests/run-make-fulldeps/issue-109934-lto-debuginfo/lib.rs b/tests/run-make-fulldeps/issue-109934-lto-debuginfo/lib.rs -new file mode 100644 -index 000000000000..c405928bd182 ---- /dev/null -+++ b/tests/run-make-fulldeps/issue-109934-lto-debuginfo/lib.rs -@@ -0,0 +1,9 @@ -+extern crate alloc; -+ -+#[cfg(test)] -+mod tests { -+ #[test] -+ fn something_alloc() { -+ assert_eq!(Vec::::new(), Vec::::new()); -+ } -+} --- -2.40.1 - diff --git a/rust.spec b/rust.spec index 3f23180..f029807 100644 --- a/rust.spec +++ b/rust.spec @@ -8,9 +8,9 @@ # 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.68.2 -%global bootstrap_channel 1.68.2 -%global bootstrap_date 2023-03-28 +%global bootstrap_version 1.69.0 +%global bootstrap_channel 1.69.0 +%global bootstrap_date 2023-04-20 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -35,8 +35,7 @@ # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh # (updated per https://github.com/rust-lang/rust/pull/96907) %global wasi_libc_url https://github.com/WebAssembly/wasi-libc -#global wasi_libc_ref wasi-sdk-20 -%global wasi_libc_ref 1dfe5c302d1c5ab621f7abf04620fae92700fd22 +%global wasi_libc_ref wasi-sdk-20 %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} @@ -47,14 +46,14 @@ # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 14.0+. %global min_llvm_version 14.0.0 -%global bundled_llvm_version 15.0.7 +%global bundled_llvm_version 16.0.2 %bcond_with bundled_llvm -# Requires stable libgit2 1.5, and not the next minor soname change. +# Requires stable libgit2 1.6, and not the next minor soname change. # This needs to be consistent with the bindings in vendor/libgit2-sys. -%global min_libgit2_version 1.5.0 -%global next_libgit2_version 1.6.0~ -%global bundled_libgit2_version 1.5.0 +%global min_libgit2_version 1.6.0 +%global next_libgit2_version 1.7.0~ +%global bundled_libgit2_version 1.6.3 %if 0%{?fedora} >= 38 %bcond_with bundled_libgit2 %else @@ -84,8 +83,8 @@ %endif Name: rust -Version: 1.69.0 -Release: 3%{?dist} +Version: 1.70.0 +Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -105,10 +104,7 @@ Source1: %{wasi_libc_source} Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. -Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch - -# https://github.com/rust-lang/rust/pull/111167 -Patch3: 0001-debuginfo-split-method-declaration-and-definition.patch +Patch2: rustc-1.70.0-rust-gdb-substitute-path.patch ### RHEL-specific patches below ### @@ -116,16 +112,11 @@ Patch3: 0001-debuginfo-split-method-declaration-and-definition.patch Source100: macros.rust-toolset # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.65.0-disable-libssh2.patch +Patch100: rustc-1.70.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.69.0-disable-http2.patch - -# kernel rh1410097 causes too-small stacks for PIE. -# (affects RHEL6 kernels when building for RHEL7) -Patch102: rustc-1.65.0-no-default-pie.patch - +Patch101: rustc-1.70.0-disable-http2.patch # Get the Rust triple for any arch. %{lua: function rust_triple(arch) @@ -583,7 +574,6 @@ test -f '%{local_rust_root}/bin/rustc' %patch -P1 -p1 %patch -P2 -p1 -%patch -P3 -p1 %if %with disabled_libssh2 %patch -P100 -p1 @@ -591,11 +581,7 @@ test -f '%{local_rust_root}/bin/rustc' %if %without curl_http2 %patch -P101 -p1 -rm -rf vendor/libnghttp2-sys/ -%endif - -%if 0%{?rhel} && 0%{?rhel} < 8 -%patch -P102 -p1 +rm -rf vendor/libnghttp2-sys*/ %endif # Use our explicit python3 first @@ -610,21 +596,21 @@ mkdir -p src/llvm-project/libunwind/ %endif # Remove other unused vendored libraries -rm -rf vendor/curl-sys/curl/ +rm -rf vendor/curl-sys*/curl/ rm -rf vendor/*jemalloc-sys*/jemalloc/ -rm -rf vendor/libmimalloc-sys/c_src/mimalloc/ -rm -rf vendor/libssh2-sys/libssh2/ -rm -rf vendor/libz-sys/src/zlib/ -rm -rf vendor/libz-sys/src/zlib-ng/ -rm -rf vendor/lzma-sys/xz-*/ -rm -rf vendor/openssl-src/openssl/ +rm -rf vendor/libffi-sys*/libffi/ +rm -rf vendor/libmimalloc-sys*/c_src/mimalloc/ +rm -rf vendor/libssh2-sys*/libssh2/ +rm -rf vendor/libz-sys*/src/zlib{,-ng}/ +rm -rf vendor/lzma-sys*/xz-*/ +rm -rf vendor/openssl-src*/openssl/ %if %without bundled_libgit2 -rm -rf vendor/libgit2-sys/libgit2/ +rm -rf vendor/libgit2-sys*/libgit2/ %endif %if %with disabled_libssh2 -rm -rf vendor/libssh2-sys/ +rm -rf vendor/libssh2-sys*/ %endif # This only affects the transient rust-installer, but let it use our dynamic xz-libs @@ -1063,6 +1049,9 @@ end} %changelog +* Thu Jun 01 2023 Josh Stone - 1.70.0-1 +- Update to 1.70.0. + * Fri May 05 2023 Josh Stone - 1.69.0-3 - Fix debuginfo with LLVM 16 diff --git a/rustc-1.61.0-rust-gdb-substitute-path.patch b/rustc-1.61.0-rust-gdb-substitute-path.patch deleted file mode 100644 index b94e23e..0000000 --- a/rustc-1.61.0-rust-gdb-substitute-path.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- rustc-1.61.0-src/src/etc/rust-gdb.orig 2022-05-17 18:29:36.000000000 -0700 -+++ rustc-1.61.0-src/src/etc/rust-gdb 2022-05-18 11:18:13.732709661 -0700 -@@ -14,6 +14,9 @@ fi - RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)" - GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc" - -+RUST_STD_BUILD="@BUILDDIR@/library/" -+RUST_STD_SRC="$RUSTC_SYSROOT/lib/rustlib/src/rust/library/" -+ - # Run GDB with the additional arguments that load the pretty printers - # Set the environment variable `RUST_GDB` to overwrite the call to a - # different/specific command (defaults to `gdb`). -@@ -21,4 +24,5 @@ RUST_GDB="${RUST_GDB:-gdb}" - PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \ - --directory="$GDB_PYTHON_MODULE_DIRECTORY" \ - -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \ -+ -iex "set substitute-path $RUST_STD_BUILD $RUST_STD_SRC" \ - "$@" diff --git a/rustc-1.65.0-no-default-pie.patch b/rustc-1.65.0-no-default-pie.patch deleted file mode 100644 index 2a69611..0000000 --- a/rustc-1.65.0-no-default-pie.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs.orig 2022-09-24 10:20:14.000000000 -0700 -+++ rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs 2022-10-05 11:24:21.759564185 -0700 -@@ -755,7 +755,7 @@ - && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie") - { - info!("linker output: {:?}", out); -- warn!("Linker does not support -no-pie command line option. Retrying without."); -+ info!("Linker does not support -no-pie command line option. Retrying without."); - for arg in cmd.take_args() { - if arg.to_string_lossy() != "-no-pie" { - cmd.arg(arg); -@@ -774,7 +774,7 @@ - && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie") - { - info!("linker output: {:?}", out); -- warn!( -+ info!( - "Linker does not support -static-pie command line option. Retrying with -static instead." - ); - // Mirror `add_(pre,post)_link_objects` to replace CRT objects. -@@ -1520,15 +1520,15 @@ - } - - fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind { -- let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) { -+ // Only use PIE if explicitly specified. -+ #[allow(rustc::bad_opt_access)] -+ let explicit_pic = -+ matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic | RelocModel::Pie)); -+ let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) { - (CrateType::Executable, _, _) if sess.is_wasi_reactor() => LinkOutputKind::WasiReactorExe, -- (CrateType::Executable, false, RelocModel::Pic | RelocModel::Pie) => { -- LinkOutputKind::DynamicPicExe -- } -+ (CrateType::Executable, false, true) => LinkOutputKind::DynamicPicExe, - (CrateType::Executable, false, _) => LinkOutputKind::DynamicNoPicExe, -- (CrateType::Executable, true, RelocModel::Pic | RelocModel::Pie) => { -- LinkOutputKind::StaticPicExe -- } -+ (CrateType::Executable, true, true) => LinkOutputKind::StaticPicExe, - (CrateType::Executable, true, _) => LinkOutputKind::StaticNoPicExe, - (_, true, _) => LinkOutputKind::StaticDylib, - (_, false, _) => LinkOutputKind::DynamicDylib, diff --git a/rustc-1.69.0-disable-http2.patch b/rustc-1.70.0-disable-http2.patch similarity index 70% rename from rustc-1.69.0-disable-http2.patch rename to rustc-1.70.0-disable-http2.patch index 09e7930..0e779b3 100644 --- a/rustc-1.69.0-disable-http2.patch +++ b/rustc-1.70.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2023-03-23 17:10:30.810989345 -0700 -+++ rustc-beta-src/Cargo.lock 2023-03-23 17:10:30.812989303 -0700 -@@ -1142,7 +1142,6 @@ +--- rustc-beta-src/Cargo.lock.orig 2023-05-24 16:49:05.242510531 -0700 ++++ rustc-beta-src/Cargo.lock 2023-05-24 16:51:11.741865603 -0700 +@@ -1197,7 +1197,6 @@ checksum = "14d05c10f541ae6f3bc5b3d923c2 dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -2375,16 +2374,6 @@ +@@ -2989,16 +2988,6 @@ source = "registry+https://github.com/ru checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] @@ -25,20 +25,20 @@ name = "libz-sys" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-03-23 17:10:30.812989303 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-03-23 17:11:26.242836664 -0700 -@@ -23,7 +23,7 @@ - cargo-util = { path = "crates/cargo-util", version = "0.2.3" } - clap = "4.1.3" +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-05-24 16:49:05.244510489 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-05-24 16:51:04.683013189 -0700 +@@ -23,7 +23,7 @@ cargo-platform = { path = "crates/cargo- + cargo-util = { path = "crates/cargo-util", version = "0.2.4" } + clap = "4.2.0" crates-io = { path = "crates/crates-io", version = "0.36.0" } -curl = { version = "0.4.44", features = ["http2"] } +curl = { version = "0.4.44", features = [] } - curl-sys = "0.4.59" + curl-sys = "0.4.61" env_logger = "0.10.0" filetime = "0.2.9" ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-03-19 00:20:55.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-03-23 17:10:30.812989303 -0700 -@@ -401,16 +401,9 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-05-19 19:05:42.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-05-24 16:49:05.244510489 -0700 +@@ -407,16 +407,9 @@ impl<'cfg> PackageSet<'cfg> { sources: SourceMap<'cfg>, config: &'cfg Config, ) -> CargoResult> { @@ -58,9 +58,9 @@ Ok(PackageSet { packages: package_ids ---- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-03-19 00:20:55.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-03-23 17:10:30.813989282 -0700 -@@ -220,16 +220,8 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-05-24 16:49:05.245510468 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-05-24 16:51:57.916900146 -0700 +@@ -229,16 +229,8 @@ impl<'cfg> HttpRegistry<'cfg> { } self.fetch_started = true; @@ -77,11 +77,11 @@ + // Multiplexing is disabled because the system libcurl doesn't support it. + self.multiplexing = false; - self.config - .shell() ---- rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs.orig 2023-03-19 00:20:55.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/util/network.rs 2023-03-23 17:10:30.813989282 -0700 -@@ -116,7 +116,7 @@ + if !self.quiet { + self.config +--- rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs.orig 2023-05-19 19:05:42.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs 2023-05-24 16:49:05.245510468 -0700 +@@ -25,7 +25,7 @@ impl PollExt for Poll { macro_rules! try_old_curl { ($e:expr, $msg:expr) => { let result = $e; diff --git a/rustc-1.65.0-disable-libssh2.patch b/rustc-1.70.0-disable-libssh2.patch similarity index 55% rename from rustc-1.65.0-disable-libssh2.patch rename to rustc-1.70.0-disable-libssh2.patch index 24be1f3..f9202b4 100644 --- a/rustc-1.65.0-disable-libssh2.patch +++ b/rustc-1.70.0-disable-libssh2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2022-09-24 10:20:14.000000000 -0700 -+++ rustc-beta-src/Cargo.lock 2022-10-04 10:26:35.490270607 -0700 -@@ -1971,7 +1971,6 @@ +--- rustc-beta-src/Cargo.lock.orig 2023-05-19 19:02:31.000000000 -0700 ++++ rustc-beta-src/Cargo.lock 2023-05-24 16:36:33.312232441 -0700 +@@ -2967,7 +2967,6 @@ dependencies = [ "cc", "libc", @@ -8,14 +8,14 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -2004,20 +2003,6 @@ +@@ -3000,20 +2999,6 @@ ] [[package]] -name = "libssh2-sys" --version = "0.2.23" +-version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" +-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" -dependencies = [ - "cc", - "libc", @@ -29,9 +29,9 @@ name = "libz-sys" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/vendor/git2/Cargo.toml.orig 2022-10-04 10:26:35.490270607 -0700 -+++ rustc-beta-src/vendor/git2/Cargo.toml 2022-10-04 10:28:14.002187686 -0700 -@@ -58,9 +58,7 @@ +--- rustc-beta-src/vendor/git2/Cargo.toml.orig 2023-05-19 21:16:57.000000000 -0700 ++++ rustc-beta-src/vendor/git2/Cargo.toml 2023-05-24 16:33:42.043813439 -0700 +@@ -55,9 +55,7 @@ [features] default = [ diff --git a/rustc-1.70.0-rust-gdb-substitute-path.patch b/rustc-1.70.0-rust-gdb-substitute-path.patch new file mode 100644 index 0000000..e9e5e2e --- /dev/null +++ b/rustc-1.70.0-rust-gdb-substitute-path.patch @@ -0,0 +1,21 @@ +diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb +index 9abed30ea6f7..e4bf55df3688 100755 +--- a/src/etc/rust-gdb ++++ b/src/etc/rust-gdb +@@ -13,8 +13,6 @@ fi + # Find out where the pretty printer Python module is + RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)" + GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc" +-# Get the commit hash for path remapping +-RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \([a-zA-Z0-9_]*\)/\1/p')" + + # Run GDB with the additional arguments that load the pretty printers + # Set the environment variable `RUST_GDB` to overwrite the call to a +@@ -23,6 +21,6 @@ RUST_GDB="${RUST_GDB:-gdb}" + PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \ + --directory="$GDB_PYTHON_MODULE_DIRECTORY" \ + -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \ +- -iex "set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT/lib/rustlib/src/rust" \ ++ -iex "set substitute-path @BUILDDIR@ $RUSTC_SYSROOT/lib/rustlib/src/rust" \ + "$@" + diff --git a/sources b/sources index 577db98..eac2d5d 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.69.0-src.tar.xz) = 724398fc208ec18adbd8ba81a445e23d1001b746990f36b869126be8a45f1cdfa75f5b9cbdd0abbab506f91a56d3736ab247677699ebd69525245558cfc01a60 -SHA512 (wasi-libc-1dfe5c302d1c5ab621f7abf04620fae92700fd22.tar.gz) = 6f813bc7822746c161932de6b84fb965111400a1a38c25dd0981209d588b9ccafe1a5923349110c536f1b7cda707dfa2d0be42c92b2fa6fd89c957eda27bda27 +SHA512 (rustc-1.70.0-src.tar.xz) = 21b35185fdcc35a059ee5ef6dca2b68f5f1d199e97f425a571cfc318a852c36a57bccf68e7673b4cb7cd83128f30d0b3eb93009a978f3ba3909b7eee50d40631 +SHA512 (wasi-libc-wasi-sdk-20.tar.gz) = e264240dc7dbcf6398c8ca09bc108298f4a8aa955af22de5a3015fbcde81cb09dd83cd48349090082d5de0e8a3dbcf746c7b14657c67657b3f2f1ab28bb9cf05 From 356401c7f1a8be2c8e32da80739a3cd4e0452ae8 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 23 Jun 2023 15:31:28 -0700 Subject: [PATCH 27/45] Override default target CPUs to match distro settings --- ...e-LLVM-coverage-of-print-target-cpus.patch | 98 +++++++++++++++++ ...variables-override-some-default-CPUs.patch | 53 +++++++++ ...110876-mj10021-issue-110647-fix-r-b-.patch | 102 ++++++++++++++++++ rust.spec | 48 ++++++--- 4 files changed, 284 insertions(+), 17 deletions(-) create mode 100644 0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch create mode 100644 0001-Let-environment-variables-override-some-default-CPUs.patch create mode 100644 0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch diff --git a/0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch b/0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch new file mode 100644 index 0000000..8dd209d --- /dev/null +++ b/0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch @@ -0,0 +1,98 @@ +From 23b3553ca0332dee4bdd79251b881d552e6bbafa Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 5 May 2023 17:27:59 -0700 +Subject: [PATCH] Expand the LLVM coverage of `--print target-cpus` + +We've been relying on a custom patch to add `MCSubtargetInfo::getCPUTable` +for `rustc --print target-cpus`, and just printing that it's not supported +on external LLVM builds. LLVM `main` now has `getAllProcessorDescriptions` +that can replace ours, so now we try to use that. In addition, the fallback +path can at least print the native and default cpu options. + +There were also some mismatches in the function signatures here between +`LLVM_RUSTLLVM` and otherwise; this is now mitigated by sharing these +functions and only using cpp to adjust the function bodies. + +(cherry picked from commit 67ae38a336599a7e0d2898a5ea3416b947458f5d) +--- + .../rustc_llvm/llvm-wrapper/PassWrapper.cpp | 30 ++++++++++--------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +index b1503e6e4b87..a4827a57f5cf 100644 +--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp ++++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +@@ -297,7 +297,6 @@ static Reloc::Model fromRust(LLVMRustRelocModel RustReloc) { + report_fatal_error("Bad RelocModel."); + } + +-#ifdef LLVM_RUSTLLVM + /// getLongestEntryLength - Return the length of the longest entry in the table. + template + static size_t getLongestEntryLength(ArrayRef Table) { +@@ -312,11 +311,21 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, const char* Tar + const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); + const Triple::ArchType HostArch = Triple(sys::getProcessTriple()).getArch(); + const Triple::ArchType TargetArch = Target->getTargetTriple().getArch(); ++ ++#if LLVM_VERSION_GE(17, 0) ++ const ArrayRef CPUTable = MCInfo->getAllProcessorDescriptions(); ++#elif defined(LLVM_RUSTLLVM) + const ArrayRef CPUTable = MCInfo->getCPUTable(); ++#else ++ printf("Full target CPU help is not supported by this LLVM version.\n\n"); ++ SubtargetSubTypeKV TargetCPUKV = { TargetCPU, {{}}, {{}} }; ++ const ArrayRef CPUTable = TargetCPUKV; ++#endif + unsigned MaxCPULen = getLongestEntryLength(CPUTable); + + printf("Available CPUs for this target:\n"); + if (HostArch == TargetArch) { ++ MaxCPULen = std::max(MaxCPULen, (unsigned) std::strlen("native")); + const StringRef HostCPU = sys::getHostCPUName(); + printf(" %-*s - Select the CPU of the current host (currently %.*s).\n", + MaxCPULen, "native", (int)HostCPU.size(), HostCPU.data()); +@@ -336,34 +345,27 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, const char* Tar + } + + extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) { ++#ifdef LLVM_RUSTLLVM + const TargetMachine *Target = unwrap(TM); + const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); + const ArrayRef FeatTable = MCInfo->getFeatureTable(); + return FeatTable.size(); ++#else ++ return 0; ++#endif + } + + extern "C" void LLVMRustGetTargetFeature(LLVMTargetMachineRef TM, size_t Index, + const char** Feature, const char** Desc) { ++#ifdef LLVM_RUSTLLVM + const TargetMachine *Target = unwrap(TM); + const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); + const ArrayRef FeatTable = MCInfo->getFeatureTable(); + const SubtargetFeatureKV Feat = FeatTable[Index]; + *Feature = Feat.Key; + *Desc = Feat.Desc; +-} +- +-#else +- +-extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef) { +- printf("Target CPU help is not supported by this LLVM version.\n\n"); +-} +- +-extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef) { +- return 0; +-} +- +-extern "C" void LLVMRustGetTargetFeature(LLVMTargetMachineRef, const char**, const char**) {} + #endif ++} + + extern "C" const char* LLVMRustGetHostCPUName(size_t *len) { + StringRef Name = sys::getHostCPUName(); +-- +2.40.1 + diff --git a/0001-Let-environment-variables-override-some-default-CPUs.patch b/0001-Let-environment-variables-override-some-default-CPUs.patch new file mode 100644 index 0000000..c394f78 --- /dev/null +++ b/0001-Let-environment-variables-override-some-default-CPUs.patch @@ -0,0 +1,53 @@ +From 6e2adb05860b72610291d3b0e8bd525c44cb0cc9 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 9 Jun 2023 15:23:08 -0700 +Subject: [PATCH] Let environment variables override some default CPUs + +--- + compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs | 2 +- + compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs | 2 +- + compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs +index fd896e086b54..08d0c43d20b4 100644 +--- a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs ++++ b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs +@@ -2,7 +2,7 @@ + + pub fn target() -> Target { + let mut base = super::linux_gnu_base::opts(); +- base.cpu = "ppc64le".into(); ++ base.cpu = option_env!("RUSTC_TARGET_CPU_PPC64LE").unwrap_or("ppc64le").into(); + base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); + base.max_atomic_width = Some(64); + base.stack_probes = StackProbeType::Inline; +diff --git a/compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs +index f2c722b9a89d..17a14d10b27e 100644 +--- a/compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs ++++ b/compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs +@@ -5,7 +5,7 @@ pub fn target() -> Target { + let mut base = super::linux_gnu_base::opts(); + base.endian = Endian::Big; + // z10 is the oldest CPU supported by LLVM +- base.cpu = "z10".into(); ++ base.cpu = option_env!("RUSTC_TARGET_CPU_S390X").unwrap_or("z10").into(); + // FIXME: The ABI implementation in cabi_s390x.rs is for now hard-coded to assume the no-vector + // ABI. Pass the -vector feature string to LLVM to respect this assumption. On LLVM < 16, we + // also strip v128 from the data_layout below to match the older LLVM's expectation. +diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs +index 9af1049b8702..68f876dd18c3 100644 +--- a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs ++++ b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs +@@ -2,7 +2,7 @@ + + pub fn target() -> Target { + let mut base = super::linux_gnu_base::opts(); +- base.cpu = "x86-64".into(); ++ base.cpu = option_env!("RUSTC_TARGET_CPU_X86_64").unwrap_or("x86-64").into(); + base.max_atomic_width = Some(64); + base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); + base.stack_probes = StackProbeType::X86; +-- +2.40.1 + diff --git a/0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch b/0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch new file mode 100644 index 0000000..1eab090 --- /dev/null +++ b/0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch @@ -0,0 +1,102 @@ +From 6edbc665ea37ba3bf852b4eb42898b7d6e7b919c Mon Sep 17 00:00:00 2001 +From: Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> +Date: Fri, 5 May 2023 18:40:35 +0530 +Subject: [PATCH] Rollup merge of #110876 - mj10021:issue-110647-fix, r=b-naber + +Added default target cpu to `--print target-cpus` output and updated docs + +Added default target cpu info as requested in issue #110647 and noted the new output in the documentation + +(cherry picked from commit 65702bfd6bfb8616e182ddd19d0520ce7e35314a) +--- + compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 2 +- + compiler/rustc_codegen_llvm/src/llvm_util.rs | 9 ++++++++- + .../rustc_llvm/llvm-wrapper/PassWrapper.cpp | 17 +++++++++++++---- + src/doc/rustc/src/codegen-options/index.md | 3 ++- + 4 files changed, 24 insertions(+), 7 deletions(-) + +diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +index 05bbdbb7415c..383a9d2e5ddb 100644 +--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs ++++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +@@ -2263,7 +2263,7 @@ pub fn LLVMRustDIBuilderCreateDebugLocation<'a>( + + pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool; + +- pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine); ++ pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine, cpu: *const c_char); + pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t; + pub fn LLVMRustGetTargetFeature( + T: &TargetMachine, +diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs +index 46692fd5e8bc..2fbdab9f8ce0 100644 +--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs ++++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs +@@ -329,7 +329,14 @@ pub(crate) fn print(req: PrintRequest, sess: &Session) { + require_inited(); + let tm = create_informational_target_machine(sess); + match req { +- PrintRequest::TargetCPUs => unsafe { llvm::LLVMRustPrintTargetCPUs(tm) }, ++ PrintRequest::TargetCPUs => { ++ // SAFETY generate a C compatible string from a byte slice to pass ++ // the target CPU name into LLVM, the lifetime of the reference is ++ // at least as long as the C function ++ let cpu_cstring = CString::new(handle_native(sess.target.cpu.as_ref())) ++ .unwrap_or_else(|e| bug!("failed to convert to cstring: {}", e)); ++ unsafe { llvm::LLVMRustPrintTargetCPUs(tm, cpu_cstring.as_ptr()) }; ++ } + PrintRequest::TargetFeatures => print_target_features(sess, tm), + _ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req), + } +diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +index 08e38b0c9d59..b1503e6e4b87 100644 +--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp ++++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +@@ -307,7 +307,7 @@ static size_t getLongestEntryLength(ArrayRef Table) { + return MaxLen; + } + +-extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) { ++extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, const char* TargetCPU) { + const TargetMachine *Target = unwrap(TM); + const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); + const Triple::ArchType HostArch = Triple(sys::getProcessTriple()).getArch(); +@@ -321,9 +321,18 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) { + printf(" %-*s - Select the CPU of the current host (currently %.*s).\n", + MaxCPULen, "native", (int)HostCPU.size(), HostCPU.data()); + } +- for (auto &CPU : CPUTable) +- printf(" %-*s\n", MaxCPULen, CPU.Key); +- printf("\n"); ++ for (auto &CPU : CPUTable) { ++ // Compare cpu against current target to label the default ++ if (strcmp(CPU.Key, TargetCPU) == 0) { ++ printf(" %-*s - This is the default target CPU" ++ " for the current build target (currently %s).", ++ MaxCPULen, CPU.Key, Target->getTargetTriple().str().c_str()); ++ } ++ else { ++ printf(" %-*s", MaxCPULen, CPU.Key); ++ } ++ printf("\n"); ++ } + } + + extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) { +diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md +index 62347f169a5e..3a14f582d600 100644 +--- a/src/doc/rustc/src/codegen-options/index.md ++++ b/src/doc/rustc/src/codegen-options/index.md +@@ -574,7 +574,8 @@ change in the future. + This instructs `rustc` to generate code specifically for a particular processor. + + You can run `rustc --print target-cpus` to see the valid options to pass +-here. Each target has a default base CPU. Special values include: ++and the default target CPU for the current buid target. ++Each target has a default base CPU. Special values include: + + * `native` can be passed to use the processor of the host machine. + * `generic` refers to an LLVM target with minimal features but modern tuning. +-- +2.40.1 + diff --git a/rust.spec b/rust.spec index f029807..95ea45c 100644 --- a/rust.spec +++ b/rust.spec @@ -84,7 +84,7 @@ Name: rust Version: 1.70.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -106,6 +106,18 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.70.0-rust-gdb-substitute-path.patch +# Override default target CPUs to match distro settings +# TODO: upstream this ability into the actual build configuration +Patch3: 0001-Let-environment-variables-override-some-default-CPUs.patch + +# Added default target cpu to `--print target-cpus` output +# https://github.com/rust-lang/rust/pull/110876 +Patch4: 0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch + +# Improve `--print target-cpus` for non-bundled LLVM +# https://github.com/rust-lang/rust/pull/111274 +Patch5: 0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch + ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) @@ -574,6 +586,9 @@ test -f '%{local_rust_root}/bin/rustc' %patch -P1 -p1 %patch -P2 -p1 +%patch -P3 -p1 +%patch -P4 -p1 +%patch -P5 -p1 %if %with disabled_libssh2 %patch -P100 -p1 @@ -646,24 +661,20 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' %endif # These are similar to __cflags_arch_* in /usr/lib/rpm/redhat/macros -%if 0%{?fedora} || 0%{?rhel} >= 9 -%ifarch x86_64 -%global rust_target_cpu %[0%{?rhel} >= 10 ? "x86-64-v3" : ""] -%global rust_target_cpu %[0%{?rhel} == 9 ? "x86-64-v2" : "%{rust_target_cpu}"] -%endif -%ifarch s390x -%global rust_target_cpu %[0%{?rhel} >= 9 ? "z14" : "zEC12"] -%endif -%ifarch ppc64le -%global rust_target_cpu %[0%{?rhel} >= 9 ? "pwr9" : "pwr8"] -%endif -%endif +%{lua: function rustc_target_cpus() + local fedora = tonumber(rpm.expand("0%{?fedora}")) + local rhel = tonumber(rpm.expand("0%{?rhel}")) + local env = + " RUSTC_TARGET_CPU_X86_64=x86-64" .. ((rhel >= 10) and "-v3" or (rhel == 9) and "-v2" or "") + .. " RUSTC_TARGET_CPU_PPC64LE=" .. ((rhel >= 9) and "pwr9" or "pwr8") + .. " RUSTC_TARGET_CPU_S390X=" .. + ((rhel >= 9) and "z14" or (rhel == 8 or fedora >= 38) and "z13" or + (fedora >= 26) and "zEC12" or (rhel == 7) and "z196" or "z10") + return env +end} # Set up shared environment variables for build/install/check -%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} -%if "%{?rust_target_cpu}" != "" -%global rust_env %{?rust_env} CARGO_TARGET_%{rust_triple_env}_RUSTFLAGS=-Ctarget-cpu=%{rust_target_cpu} -%endif +%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} %{lua: print(rustc_target_cpus())} %if %defined cmake_path %global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH" %endif @@ -1049,6 +1060,9 @@ end} %changelog +* Fri Jun 23 2023 Josh Stone - 1.70.0-2 +- Override default target CPUs to match distro settings + * Thu Jun 01 2023 Josh Stone - 1.70.0-1 - Update to 1.70.0. From 386b9914c97fa484377fdf3e27deec741d1d02a5 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 17 Jul 2023 09:24:25 -0700 Subject: [PATCH 28/45] Update to 1.71.0. --- .gitignore | 1 + ...e-LLVM-coverage-of-print-target-cpus.patch | 98 ----------------- ...t-lint-docs-when-download-rustc-is-e.patch | 60 +++++++++++ ...tc-bash_complettion-src-etc-.-to-avo.patch | 31 ++++++ ...110876-mj10021-issue-110647-fix-r-b-.patch | 102 ------------------ rust.spec | 38 ++++--- rustc-1.70.0-disable-libssh2.patch | 43 -------- ....patch => rustc-1.71.0-disable-http2.patch | 56 +++++----- rustc-1.71.0-disable-libssh2.patch | 42 ++++++++ sources | 2 +- 10 files changed, 185 insertions(+), 288 deletions(-) delete mode 100644 0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch create mode 100644 0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch create mode 100644 0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch delete mode 100644 0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch delete mode 100644 rustc-1.70.0-disable-libssh2.patch rename rustc-1.70.0-disable-http2.patch => rustc-1.71.0-disable-http2.patch (64%) create mode 100644 rustc-1.71.0-disable-libssh2.patch diff --git a/.gitignore b/.gitignore index 51331ef..d7f7e39 100644 --- a/.gitignore +++ b/.gitignore @@ -420,3 +420,4 @@ /wasi-libc-1dfe5c302d1c5ab621f7abf04620fae92700fd22.tar.gz /rustc-1.70.0-src.tar.xz /wasi-libc-wasi-sdk-20.tar.gz +/rustc-1.71.0-src.tar.xz diff --git a/0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch b/0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch deleted file mode 100644 index 8dd209d..0000000 --- a/0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 23b3553ca0332dee4bdd79251b881d552e6bbafa Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Fri, 5 May 2023 17:27:59 -0700 -Subject: [PATCH] Expand the LLVM coverage of `--print target-cpus` - -We've been relying on a custom patch to add `MCSubtargetInfo::getCPUTable` -for `rustc --print target-cpus`, and just printing that it's not supported -on external LLVM builds. LLVM `main` now has `getAllProcessorDescriptions` -that can replace ours, so now we try to use that. In addition, the fallback -path can at least print the native and default cpu options. - -There were also some mismatches in the function signatures here between -`LLVM_RUSTLLVM` and otherwise; this is now mitigated by sharing these -functions and only using cpp to adjust the function bodies. - -(cherry picked from commit 67ae38a336599a7e0d2898a5ea3416b947458f5d) ---- - .../rustc_llvm/llvm-wrapper/PassWrapper.cpp | 30 ++++++++++--------- - 1 file changed, 16 insertions(+), 14 deletions(-) - -diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp -index b1503e6e4b87..a4827a57f5cf 100644 ---- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp -+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp -@@ -297,7 +297,6 @@ static Reloc::Model fromRust(LLVMRustRelocModel RustReloc) { - report_fatal_error("Bad RelocModel."); - } - --#ifdef LLVM_RUSTLLVM - /// getLongestEntryLength - Return the length of the longest entry in the table. - template - static size_t getLongestEntryLength(ArrayRef Table) { -@@ -312,11 +311,21 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, const char* Tar - const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); - const Triple::ArchType HostArch = Triple(sys::getProcessTriple()).getArch(); - const Triple::ArchType TargetArch = Target->getTargetTriple().getArch(); -+ -+#if LLVM_VERSION_GE(17, 0) -+ const ArrayRef CPUTable = MCInfo->getAllProcessorDescriptions(); -+#elif defined(LLVM_RUSTLLVM) - const ArrayRef CPUTable = MCInfo->getCPUTable(); -+#else -+ printf("Full target CPU help is not supported by this LLVM version.\n\n"); -+ SubtargetSubTypeKV TargetCPUKV = { TargetCPU, {{}}, {{}} }; -+ const ArrayRef CPUTable = TargetCPUKV; -+#endif - unsigned MaxCPULen = getLongestEntryLength(CPUTable); - - printf("Available CPUs for this target:\n"); - if (HostArch == TargetArch) { -+ MaxCPULen = std::max(MaxCPULen, (unsigned) std::strlen("native")); - const StringRef HostCPU = sys::getHostCPUName(); - printf(" %-*s - Select the CPU of the current host (currently %.*s).\n", - MaxCPULen, "native", (int)HostCPU.size(), HostCPU.data()); -@@ -336,34 +345,27 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, const char* Tar - } - - extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) { -+#ifdef LLVM_RUSTLLVM - const TargetMachine *Target = unwrap(TM); - const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); - const ArrayRef FeatTable = MCInfo->getFeatureTable(); - return FeatTable.size(); -+#else -+ return 0; -+#endif - } - - extern "C" void LLVMRustGetTargetFeature(LLVMTargetMachineRef TM, size_t Index, - const char** Feature, const char** Desc) { -+#ifdef LLVM_RUSTLLVM - const TargetMachine *Target = unwrap(TM); - const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); - const ArrayRef FeatTable = MCInfo->getFeatureTable(); - const SubtargetFeatureKV Feat = FeatTable[Index]; - *Feature = Feat.Key; - *Desc = Feat.Desc; --} -- --#else -- --extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef) { -- printf("Target CPU help is not supported by this LLVM version.\n\n"); --} -- --extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef) { -- return 0; --} -- --extern "C" void LLVMRustGetTargetFeature(LLVMTargetMachineRef, const char**, const char**) {} - #endif -+} - - extern "C" const char* LLVMRustGetHostCPUName(size_t *len) { - StringRef Name = sys::getHostCPUName(); --- -2.40.1 - diff --git a/0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch b/0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch new file mode 100644 index 0000000..50518c6 --- /dev/null +++ b/0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch @@ -0,0 +1,60 @@ +From 9204a8359201271fd7b1c625d6f29ddd095a419d Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Mon, 10 Jul 2023 13:48:49 -0700 +Subject: [PATCH] Revert "Fix `x test lint-docs` when download-rustc is + enabled" + +This reverts commit abf9cbcb69e485b56776112bc587f6166e7ac5c9. +--- + src/tools/lint-docs/src/groups.rs | 3 +-- + src/tools/lint-docs/src/lib.rs | 9 --------- + 2 files changed, 1 insertion(+), 11 deletions(-) + +diff --git a/src/tools/lint-docs/src/groups.rs b/src/tools/lint-docs/src/groups.rs +index b11fb287cf4d..2a923a61b0a7 100644 +--- a/src/tools/lint-docs/src/groups.rs ++++ b/src/tools/lint-docs/src/groups.rs +@@ -39,12 +39,11 @@ pub(crate) fn generate_group_docs(&self, lints: &[Lint]) -> Result<(), Box Result> { + let mut result = BTreeMap::new(); + let mut cmd = Command::new(self.rustc_path); +- cmd.env_remove("LD_LIBRARY_PATH"); + cmd.arg("-Whelp"); + let output = cmd.output().map_err(|e| format!("failed to run command {:?}\n{}", cmd, e))?; + if !output.status.success() { + return Err(format!( +- "failed to collect lint info: failed to run {cmd:?}: {:?}\n--- stderr\n{}--- stdout\n{}\n", ++ "failed to collect lint info: {:?}\n--- stderr\n{}--- stdout\n{}\n", + output.status, + std::str::from_utf8(&output.stderr).unwrap(), + std::str::from_utf8(&output.stdout).unwrap(), +diff --git a/src/tools/lint-docs/src/lib.rs b/src/tools/lint-docs/src/lib.rs +index fe29b9abda39..034c6aa0708e 100644 +--- a/src/tools/lint-docs/src/lib.rs ++++ b/src/tools/lint-docs/src/lib.rs +@@ -403,12 +403,6 @@ fn generate_lint_output( + fs::write(&tempfile, source) + .map_err(|e| format!("failed to write {}: {}", tempfile.display(), e))?; + let mut cmd = Command::new(self.rustc_path); +- // NOTE: bootstrap sets `LD_LIBRARY_PATH` for building lint-docs itself. +- // Unfortunately, lint-docs is a bootstrap tool while rustc is built from source, +- // and sometimes the paths conflict. In particular, when using `download-rustc`, +- // the LLVM versions can differ between `ci-llvm` and `ci-rustc-sysroot`. +- // Unset LD_LIBRARY_PATH here so it doesn't interfere with running the compiler. +- cmd.env_remove("LD_LIBRARY_PATH"); + if options.contains(&"edition2015") { + cmd.arg("--edition=2015"); + } else { +@@ -421,9 +415,6 @@ fn generate_lint_output( + } + cmd.arg("lint_example.rs"); + cmd.current_dir(tempdir.path()); +- if self.verbose { +- eprintln!("running: {cmd:?}"); +- } + let output = cmd.output().map_err(|e| format!("failed to run command {:?}\n{}", cmd, e))?; + let stderr = std::str::from_utf8(&output.stderr).unwrap(); + let msgs = stderr +-- +2.41.0 + diff --git a/0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch b/0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch new file mode 100644 index 0000000..a326207 --- /dev/null +++ b/0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch @@ -0,0 +1,31 @@ +From cea2e61a03773ce28fd57b7338c4ae4d947650ca Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Mon, 10 Jul 2023 15:52:55 -0700 +Subject: [PATCH] Revert "fix: :bug: etc/bash_complettion -> src/etc/... to + avoid copy error" + +This reverts commit 08ce68b6a6bad360e9c3611ad60cf6598401f878. +--- + src/bootstrap/dist.rs | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs +index b49845386da1..9cead7adc8c3 100644 +--- a/src/bootstrap/dist.rs ++++ b/src/bootstrap/dist.rs +@@ -1071,11 +1071,7 @@ fn run(self, builder: &Builder<'_>) -> Option { + + tarball.add_file(&cargo, "bin", 0o755); + tarball.add_file(etc.join("_cargo"), "share/zsh/site-functions", 0o644); +- tarball.add_renamed_file( +- etc.join("cargo.bashcomp.sh"), +- "src/etc/bash_completion.d", +- "cargo", +- ); ++ tarball.add_renamed_file(etc.join("cargo.bashcomp.sh"), "etc/bash_completion.d", "cargo"); + tarball.add_dir(etc.join("man"), "share/man/man1"); + tarball.add_legal_and_readme_to("share/doc/cargo"); + +-- +2.41.0 + diff --git a/0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch b/0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch deleted file mode 100644 index 1eab090..0000000 --- a/0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 6edbc665ea37ba3bf852b4eb42898b7d6e7b919c Mon Sep 17 00:00:00 2001 -From: Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> -Date: Fri, 5 May 2023 18:40:35 +0530 -Subject: [PATCH] Rollup merge of #110876 - mj10021:issue-110647-fix, r=b-naber - -Added default target cpu to `--print target-cpus` output and updated docs - -Added default target cpu info as requested in issue #110647 and noted the new output in the documentation - -(cherry picked from commit 65702bfd6bfb8616e182ddd19d0520ce7e35314a) ---- - compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 2 +- - compiler/rustc_codegen_llvm/src/llvm_util.rs | 9 ++++++++- - .../rustc_llvm/llvm-wrapper/PassWrapper.cpp | 17 +++++++++++++---- - src/doc/rustc/src/codegen-options/index.md | 3 ++- - 4 files changed, 24 insertions(+), 7 deletions(-) - -diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -index 05bbdbb7415c..383a9d2e5ddb 100644 ---- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -@@ -2263,7 +2263,7 @@ pub fn LLVMRustDIBuilderCreateDebugLocation<'a>( - - pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool; - -- pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine); -+ pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine, cpu: *const c_char); - pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t; - pub fn LLVMRustGetTargetFeature( - T: &TargetMachine, -diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs -index 46692fd5e8bc..2fbdab9f8ce0 100644 ---- a/compiler/rustc_codegen_llvm/src/llvm_util.rs -+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs -@@ -329,7 +329,14 @@ pub(crate) fn print(req: PrintRequest, sess: &Session) { - require_inited(); - let tm = create_informational_target_machine(sess); - match req { -- PrintRequest::TargetCPUs => unsafe { llvm::LLVMRustPrintTargetCPUs(tm) }, -+ PrintRequest::TargetCPUs => { -+ // SAFETY generate a C compatible string from a byte slice to pass -+ // the target CPU name into LLVM, the lifetime of the reference is -+ // at least as long as the C function -+ let cpu_cstring = CString::new(handle_native(sess.target.cpu.as_ref())) -+ .unwrap_or_else(|e| bug!("failed to convert to cstring: {}", e)); -+ unsafe { llvm::LLVMRustPrintTargetCPUs(tm, cpu_cstring.as_ptr()) }; -+ } - PrintRequest::TargetFeatures => print_target_features(sess, tm), - _ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req), - } -diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp -index 08e38b0c9d59..b1503e6e4b87 100644 ---- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp -+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp -@@ -307,7 +307,7 @@ static size_t getLongestEntryLength(ArrayRef Table) { - return MaxLen; - } - --extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) { -+extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, const char* TargetCPU) { - const TargetMachine *Target = unwrap(TM); - const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); - const Triple::ArchType HostArch = Triple(sys::getProcessTriple()).getArch(); -@@ -321,9 +321,18 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) { - printf(" %-*s - Select the CPU of the current host (currently %.*s).\n", - MaxCPULen, "native", (int)HostCPU.size(), HostCPU.data()); - } -- for (auto &CPU : CPUTable) -- printf(" %-*s\n", MaxCPULen, CPU.Key); -- printf("\n"); -+ for (auto &CPU : CPUTable) { -+ // Compare cpu against current target to label the default -+ if (strcmp(CPU.Key, TargetCPU) == 0) { -+ printf(" %-*s - This is the default target CPU" -+ " for the current build target (currently %s).", -+ MaxCPULen, CPU.Key, Target->getTargetTriple().str().c_str()); -+ } -+ else { -+ printf(" %-*s", MaxCPULen, CPU.Key); -+ } -+ printf("\n"); -+ } - } - - extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) { -diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md -index 62347f169a5e..3a14f582d600 100644 ---- a/src/doc/rustc/src/codegen-options/index.md -+++ b/src/doc/rustc/src/codegen-options/index.md -@@ -574,7 +574,8 @@ change in the future. - This instructs `rustc` to generate code specifically for a particular processor. - - You can run `rustc --print target-cpus` to see the valid options to pass --here. Each target has a default base CPU. Special values include: -+and the default target CPU for the current buid target. -+Each target has a default base CPU. Special values include: - - * `native` can be passed to use the processor of the host machine. - * `generic` refers to an LLVM target with minimal features but modern tuning. --- -2.40.1 - diff --git a/rust.spec b/rust.spec index 95ea45c..4fbbcf9 100644 --- a/rust.spec +++ b/rust.spec @@ -8,9 +8,9 @@ # 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.69.0 -%global bootstrap_channel 1.69.0 -%global bootstrap_date 2023-04-20 +%global bootstrap_version 1.70.0 +%global bootstrap_channel 1.70.0 +%global bootstrap_date 2023-06-01 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -46,14 +46,14 @@ # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 14.0+. %global min_llvm_version 14.0.0 -%global bundled_llvm_version 16.0.2 +%global bundled_llvm_version 16.0.5 %bcond_with bundled_llvm # Requires stable libgit2 1.6, and not the next minor soname change. # This needs to be consistent with the bindings in vendor/libgit2-sys. -%global min_libgit2_version 1.6.0 +%global min_libgit2_version 1.6.4 %global next_libgit2_version 1.7.0~ -%global bundled_libgit2_version 1.6.3 +%global bundled_libgit2_version 1.6.4 %if 0%{?fedora} >= 38 %bcond_with bundled_libgit2 %else @@ -83,8 +83,8 @@ %endif Name: rust -Version: 1.70.0 -Release: 2%{?dist} +Version: 1.71.0 +Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -110,13 +110,13 @@ Patch2: rustc-1.70.0-rust-gdb-substitute-path.patch # TODO: upstream this ability into the actual build configuration Patch3: 0001-Let-environment-variables-override-some-default-CPUs.patch -# Added default target cpu to `--print target-cpus` output -# https://github.com/rust-lang/rust/pull/110876 -Patch4: 0001-Rollup-merge-of-110876-mj10021-issue-110647-fix-r-b-.patch +# Restore LD_LIBRARY_PATH when running lint-docs +# https://github.com/rust-lang/rust/pull/110521#issuecomment-1629705099 +Patch4: 0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch -# Improve `--print target-cpus` for non-bundled LLVM -# https://github.com/rust-lang/rust/pull/111274 -Patch5: 0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch +# Restore the bash completion path +# https://github.com/rust-lang/rust/pull/110906#issuecomment-1629832675 +Patch5: 0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch ### RHEL-specific patches below ### @@ -124,11 +124,11 @@ Patch5: 0001-Expand-the-LLVM-coverage-of-print-target-cpus.patch Source100: macros.rust-toolset # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.70.0-disable-libssh2.patch +Patch100: rustc-1.71.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.70.0-disable-http2.patch +Patch101: rustc-1.71.0-disable-http2.patch # Get the Rust triple for any arch. %{lua: function rust_triple(arch) @@ -801,6 +801,9 @@ done # These are transient files used by x.py dist and install rm -rf ./build/dist/ ./build/tmp/ +# Some of the components duplicate-install binaries, leaving backups we don't want +rm -f %{buildroot}%{_bindir}/*.old + # Make sure the shared libraries are in the proper libdir %if "%{_libdir}" != "%{common_libdir}" mkdir -p %{buildroot}%{_libdir} @@ -1060,6 +1063,9 @@ end} %changelog +* Mon Jul 17 2023 Josh Stone - 1.71.0-1 +- Update to 1.71.0. + * Fri Jun 23 2023 Josh Stone - 1.70.0-2 - Override default target CPUs to match distro settings diff --git a/rustc-1.70.0-disable-libssh2.patch b/rustc-1.70.0-disable-libssh2.patch deleted file mode 100644 index f9202b4..0000000 --- a/rustc-1.70.0-disable-libssh2.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- rustc-beta-src/Cargo.lock.orig 2023-05-19 19:02:31.000000000 -0700 -+++ rustc-beta-src/Cargo.lock 2023-05-24 16:36:33.312232441 -0700 -@@ -2967,7 +2967,6 @@ - dependencies = [ - "cc", - "libc", -- "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -@@ -3000,20 +2999,6 @@ - ] - - [[package]] --name = "libssh2-sys" --version = "0.3.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" --dependencies = [ -- "cc", -- "libc", -- "libz-sys", -- "openssl-sys", -- "pkg-config", -- "vcpkg", --] -- --[[package]] - name = "libz-sys" - version = "1.1.3" - source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/vendor/git2/Cargo.toml.orig 2023-05-19 21:16:57.000000000 -0700 -+++ rustc-beta-src/vendor/git2/Cargo.toml 2023-05-24 16:33:42.043813439 -0700 -@@ -55,9 +55,7 @@ - - [features] - default = [ -- "ssh", - "https", -- "ssh_key_from_memory", - ] - https = [ - "libgit2-sys/https", diff --git a/rustc-1.70.0-disable-http2.patch b/rustc-1.71.0-disable-http2.patch similarity index 64% rename from rustc-1.70.0-disable-http2.patch rename to rustc-1.71.0-disable-http2.patch index 0e779b3..34fdab3 100644 --- a/rustc-1.70.0-disable-http2.patch +++ b/rustc-1.71.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2023-05-24 16:49:05.242510531 -0700 -+++ rustc-beta-src/Cargo.lock 2023-05-24 16:51:11.741865603 -0700 -@@ -1197,7 +1197,6 @@ checksum = "14d05c10f541ae6f3bc5b3d923c2 +--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-07-07 17:30:04.817452621 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-07-07 17:30:27.777988139 -0700 +@@ -734,7 +734,6 @@ dependencies = [ "cc", "libc", @@ -8,14 +8,14 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -2989,16 +2988,6 @@ source = "registry+https://github.com/ru - checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" +@@ -1954,16 +1953,6 @@ + checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] -name = "libnghttp2-sys" --version = "0.1.4+1.41.0" +-version = "0.1.7+1.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "03624ec6df166e79e139a2310ca213283d6b3c30810c54844f307086d4488df1" +-checksum = "57ed28aba195b38d5ff02b9170cbff627e336a20925e43b4945390401c5dc93f" -dependencies = [ - "cc", - "libc", @@ -23,22 +23,22 @@ - -[[package]] name = "libz-sys" - version = "1.1.3" + version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-05-24 16:49:05.244510489 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-05-24 16:51:04.683013189 -0700 -@@ -23,7 +23,7 @@ cargo-platform = { path = "crates/cargo- - cargo-util = { path = "crates/cargo-util", version = "0.2.4" } - clap = "4.2.0" - crates-io = { path = "crates/crates-io", version = "0.36.0" } --curl = { version = "0.4.44", features = ["http2"] } -+curl = { version = "0.4.44", features = [] } - curl-sys = "0.4.61" - env_logger = "0.10.0" - filetime = "0.2.9" ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-05-19 19:05:42.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-05-24 16:49:05.244510489 -0700 -@@ -407,16 +407,9 @@ impl<'cfg> PackageSet<'cfg> { +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-07-07 17:30:04.819452581 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-07-07 17:30:24.133061874 -0700 +@@ -118,7 +118,7 @@ + cargo-util.workspace = true + clap = { workspace = true, features = ["wrap_help"] } + crates-io.workspace = true +-curl = { workspace = true, features = ["http2"] } ++curl = { workspace = true, features = [] } + curl-sys.workspace = true + env_logger.workspace = true + filetime.workspace = true +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-06-24 10:27:37.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-07-07 17:30:04.819452581 -0700 +@@ -407,16 +407,9 @@ sources: SourceMap<'cfg>, config: &'cfg Config, ) -> CargoResult> { @@ -58,9 +58,9 @@ Ok(PackageSet { packages: package_ids ---- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-05-24 16:49:05.245510468 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-05-24 16:51:57.916900146 -0700 -@@ -229,16 +229,8 @@ impl<'cfg> HttpRegistry<'cfg> { +--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-06-24 10:27:37.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-07-07 17:30:04.819452581 -0700 +@@ -229,16 +229,8 @@ } self.fetch_started = true; @@ -79,9 +79,9 @@ if !self.quiet { self.config ---- rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs.orig 2023-05-19 19:05:42.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs 2023-05-24 16:49:05.245510468 -0700 -@@ -25,7 +25,7 @@ impl PollExt for Poll { +--- rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs.orig 2023-06-24 10:27:37.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs 2023-07-07 17:30:04.819452581 -0700 +@@ -26,7 +26,7 @@ macro_rules! try_old_curl { ($e:expr, $msg:expr) => { let result = $e; diff --git a/rustc-1.71.0-disable-libssh2.patch b/rustc-1.71.0-disable-libssh2.patch new file mode 100644 index 0000000..ba61454 --- /dev/null +++ b/rustc-1.71.0-disable-libssh2.patch @@ -0,0 +1,42 @@ +--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-06-24 10:27:37.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-07-07 17:12:23.406932870 -0700 +@@ -1942,7 +1942,6 @@ + dependencies = [ + "cc", + "libc", +- "libssh2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", +@@ -1965,20 +1964,6 @@ + ] + + [[package]] +-name = "libssh2-sys" +-version = "0.3.0" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" +-dependencies = [ +- "cc", +- "libc", +- "libz-sys", +- "openssl-sys", +- "pkg-config", +- "vcpkg", +-] +- +-[[package]] + name = "libz-sys" + version = "1.1.8" + source = "registry+https://github.com/rust-lang/crates.io-index" +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-06-24 10:27:37.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-07-07 17:12:00.688392750 -0700 +@@ -31,7 +31,7 @@ + filetime = "0.2.9" + flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] } + fwdansi = "1.1.0" +-git2 = "0.17.1" ++git2 = { version = "0.17.1", default-features = false, features = ["https"] } + git2-curl = "0.18.0" + gix = { version = "0.44.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] } + gix-features-for-configuration-only = { version = "0.29.0", package = "gix-features", features = [ "parallel" ] } diff --git a/sources b/sources index eac2d5d..622ee4f 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.70.0-src.tar.xz) = 21b35185fdcc35a059ee5ef6dca2b68f5f1d199e97f425a571cfc318a852c36a57bccf68e7673b4cb7cd83128f30d0b3eb93009a978f3ba3909b7eee50d40631 +SHA512 (rustc-1.71.0-src.tar.xz) = 2c93bafdd248563765a285add48ca77c1e4bad4d5431675ae6a5cdee4cfe7a41e6bcc880a489ca1069a307fd9a005f2d5f8e230dfc95b4a69152b4f9ca49ac44 SHA512 (wasi-libc-wasi-sdk-20.tar.gz) = e264240dc7dbcf6398c8ca09bc108298f4a8aa955af22de5a3015fbcde81cb09dd83cd48349090082d5de0e8a3dbcf746c7b14657c67657b3f2f1ab28bb9cf05 From 2f56a4c9181a05cfc4535f1b2c62824a77b9e7fe Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 21 Jul 2023 18:41:30 +0000 Subject: [PATCH 29/45] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- rust.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust.spec b/rust.spec index 4fbbcf9..1901dc8 100644 --- a/rust.spec +++ b/rust.spec @@ -84,7 +84,7 @@ Name: rust Version: 1.71.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -1063,6 +1063,9 @@ end} %changelog +* Fri Jul 21 2023 Fedora Release Engineering - 1.71.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Mon Jul 17 2023 Josh Stone - 1.71.0-1 - Update to 1.71.0. From 8cfe070190bc5daab956a97580295c0ff6524505 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 25 Jul 2023 17:53:22 -0700 Subject: [PATCH 30/45] Relax the suspicious_double_ref_op lint Enable the profiler runtime for native hosts --- ...rnal-builds-of-the-compiler-rt-profi.patch | 142 ++++++++++++++ ...112517-fee1-dead-contrib-sus-op-no-b.patch | 185 ++++++++++++++++++ rust.spec | 24 ++- 3 files changed, 350 insertions(+), 1 deletion(-) create mode 100644 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch create mode 100644 0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch diff --git a/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch b/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch new file mode 100644 index 0000000..2b1ecb5 --- /dev/null +++ b/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch @@ -0,0 +1,142 @@ +From f2fd2d01f96b50b039402c9ab4278230687f7922 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Tue, 25 Jul 2023 13:11:50 -0700 +Subject: [PATCH] Allow using external builds of the compiler-rt profile lib + +This changes the bootstrap config `target.*.profiler` from a plain bool +to also allow a string, which will be used as a path to the pre-built +profiling runtime for that target. Then `profiler_builtins/build.rs` +reads that in a `LLVM_PROFILER_RT_LIB` environment variable. +--- + config.example.toml | 6 ++++-- + library/profiler_builtins/build.rs | 6 ++++++ + src/bootstrap/compile.rs | 4 ++++ + src/bootstrap/config.rs | 30 ++++++++++++++++++++++++------ + 4 files changed, 38 insertions(+), 8 deletions(-) + +diff --git a/config.example.toml b/config.example.toml +index d0eaa9fd7ffa..e0e991e679af 100644 +--- a/config.example.toml ++++ b/config.example.toml +@@ -745,8 +745,10 @@ changelog-seen = 2 + # This option will override the same option under [build] section. + #sanitizers = build.sanitizers (bool) + +-# Build the profiler runtime for this target(required when compiling with options that depend +-# on this runtime, such as `-C profile-generate` or `-C instrument-coverage`). ++# When true, build the profiler runtime for this target(required when compiling ++# with options that depend on this runtime, such as `-C profile-generate` or ++# `-C instrument-coverage`). This may also be given a path to an existing build ++# of the profiling runtime library from LLVM's compiler-rt. + # This option will override the same option under [build] section. + #profiler = build.profiler (bool) + +diff --git a/library/profiler_builtins/build.rs b/library/profiler_builtins/build.rs +index 1b1f11798d74..d14d0b82229a 100644 +--- a/library/profiler_builtins/build.rs ++++ b/library/profiler_builtins/build.rs +@@ -6,6 +6,12 @@ + use std::path::Path; + + fn main() { ++ println!("cargo:rerun-if-env-changed=LLVM_PROFILER_RT_LIB"); ++ if let Ok(rt) = env::var("LLVM_PROFILER_RT_LIB") { ++ println!("cargo:rustc-link-lib=static:+verbatim={rt}"); ++ return; ++ } ++ + let target = env::var("TARGET").expect("TARGET was not set"); + let cfg = &mut cc::Build::new(); + +diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs +index 33addb90da37..1d8b3c6e5435 100644 +--- a/src/bootstrap/compile.rs ++++ b/src/bootstrap/compile.rs +@@ -305,6 +305,10 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car + cargo.env("MACOSX_DEPLOYMENT_TARGET", target); + } + ++ if let Some(path) = builder.config.profiler_path(target) { ++ cargo.env("LLVM_PROFILER_RT_LIB", path); ++ } ++ + // 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, but our `src/llvm-project` submodule isn't +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs +index e192cda9a9a7..a4803db0a470 100644 +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -467,7 +467,7 @@ pub struct Target { + pub linker: Option, + pub ndk: Option, + pub sanitizers: Option, +- pub profiler: Option, ++ pub profiler: Option, + pub rpath: Option, + pub crt_static: Option, + pub musl_root: Option, +@@ -796,9 +796,9 @@ struct Dist { + } + } + +-#[derive(Debug, Deserialize)] ++#[derive(Clone, Debug, Deserialize)] + #[serde(untagged)] +-enum StringOrBool { ++pub enum StringOrBool { + String(String), + Bool(bool), + } +@@ -809,6 +809,12 @@ fn default() -> StringOrBool { + } + } + ++impl StringOrBool { ++ fn is_string_or_true(&self) -> bool { ++ matches!(self, Self::String(_) | Self::Bool(true)) ++ } ++} ++ + define_config! { + /// TOML representation of how the Rust build is configured. + struct Rust { +@@ -880,7 +886,7 @@ struct TomlTarget { + llvm_libunwind: Option = "llvm-libunwind", + android_ndk: Option = "android-ndk", + sanitizers: Option = "sanitizers", +- profiler: Option = "profiler", ++ profiler: Option = "profiler", + rpath: Option = "rpath", + crt_static: Option = "crt-static", + musl_root: Option = "musl-root", +@@ -1744,12 +1750,24 @@ pub fn any_sanitizers_enabled(&self) -> bool { + self.target_config.values().any(|t| t.sanitizers == Some(true)) || self.sanitizers + } + ++ pub fn profiler_path(&self, target: TargetSelection) -> Option<&str> { ++ match self.target_config.get(&target)?.profiler.as_ref()? { ++ StringOrBool::String(s) => Some(s), ++ StringOrBool::Bool(_) => None, ++ } ++ } ++ + pub fn profiler_enabled(&self, target: TargetSelection) -> bool { +- self.target_config.get(&target).map(|t| t.profiler).flatten().unwrap_or(self.profiler) ++ self.target_config ++ .get(&target) ++ .and_then(|t| t.profiler.as_ref()) ++ .map(StringOrBool::is_string_or_true) ++ .unwrap_or(self.profiler) + } + + pub fn any_profiler_enabled(&self) -> bool { +- self.target_config.values().any(|t| t.profiler == Some(true)) || self.profiler ++ self.target_config.values().any(|t| matches!(&t.profiler, Some(p) if p.is_string_or_true())) ++ || self.profiler + } + + pub fn rpath_enabled(&self, target: TargetSelection) -> bool { +-- +2.41.0 + diff --git a/0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch b/0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch new file mode 100644 index 0000000..8f8c544 --- /dev/null +++ b/0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch @@ -0,0 +1,185 @@ +From abb7c31ab038f38e33057062ae8b66b4e3cd699c Mon Sep 17 00:00:00 2001 +From: Guillaume Gomez +Date: Thu, 15 Jun 2023 22:04:55 +0200 +Subject: [PATCH] Rollup merge of #112517 - fee1-dead-contrib:sus-op-no-borrow, + r=compiler-errors + +`suspicious_double_ref_op`: don't lint on `.borrow()` + +closes #112489 + +(cherry picked from commit db7d8374c1b6f1e2e8297f43e6a2cbffeff21882) +--- + compiler/rustc_lint/messages.ftl | 12 ++-- + compiler/rustc_lint/src/lints.rs | 12 ++-- + compiler/rustc_lint/src/noop_method_call.rs | 62 +++++++++++---------- + tests/ui/lint/issue-112489.rs | 17 ++++++ + 4 files changed, 64 insertions(+), 39 deletions(-) + create mode 100644 tests/ui/lint/issue-112489.rs + +diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl +index d34a3afcba53..0fa67cdb391f 100644 +--- a/compiler/rustc_lint/messages.ftl ++++ b/compiler/rustc_lint/messages.ftl +@@ -463,13 +463,11 @@ lint_requested_level = requested on the command line with `{$level} {$lint_name} + lint_supertrait_as_deref_target = `{$t}` implements `Deref` with supertrait `{$target_principal}` as target + .label = target type is set here + +-lint_suspicious_double_ref_op = +- using `.{$call}()` on a double reference, which returns `{$ty}` instead of {$op -> +- *[should_not_happen] [{$op}] +- [deref] dereferencing +- [borrow] borrowing +- [clone] cloning +- } the inner type ++lint_suspicious_double_ref_clone = ++ using `.clone()` on a double reference, which returns `{$ty}` instead of cloning the inner type ++ ++lint_suspicious_double_ref_deref = ++ using `.deref()` on a double reference, which returns `{$ty}` instead of dereferencing the inner type + + lint_trivial_untranslatable_diag = diagnostic with static strings only + +diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs +index de1c2be28757..d96723a68eb6 100644 +--- a/compiler/rustc_lint/src/lints.rs ++++ b/compiler/rustc_lint/src/lints.rs +@@ -1188,11 +1188,15 @@ pub struct NoopMethodCallDiag<'a> { + } + + #[derive(LintDiagnostic)] +-#[diag(lint_suspicious_double_ref_op)] +-pub struct SuspiciousDoubleRefDiag<'a> { +- pub call: Symbol, ++#[diag(lint_suspicious_double_ref_deref)] ++pub struct SuspiciousDoubleRefDerefDiag<'a> { ++ pub ty: Ty<'a>, ++} ++ ++#[derive(LintDiagnostic)] ++#[diag(lint_suspicious_double_ref_clone)] ++pub struct SuspiciousDoubleRefCloneDiag<'a> { + pub ty: Ty<'a>, +- pub op: &'static str, + } + + // pass_by_value.rs +diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs +index d054966459d8..d56c35bb677a 100644 +--- a/compiler/rustc_lint/src/noop_method_call.rs ++++ b/compiler/rustc_lint/src/noop_method_call.rs +@@ -1,5 +1,7 @@ + use crate::context::LintContext; +-use crate::lints::{NoopMethodCallDiag, SuspiciousDoubleRefDiag}; ++use crate::lints::{ ++ NoopMethodCallDiag, SuspiciousDoubleRefCloneDiag, SuspiciousDoubleRefDerefDiag, ++}; + use crate::LateContext; + use crate::LateLintPass; + use rustc_hir::def::DefKind; +@@ -76,22 +78,22 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { + + // We only care about method calls corresponding to the `Clone`, `Deref` and `Borrow` + // traits and ignore any other method call. +- let did = match cx.typeck_results().type_dependent_def(expr.hir_id) { +- // Verify we are dealing with a method/associated function. +- Some((DefKind::AssocFn, did)) => match cx.tcx.trait_of_item(did) { +- // Check that we're dealing with a trait method for one of the traits we care about. +- Some(trait_id) +- if matches!( +- cx.tcx.get_diagnostic_name(trait_id), +- Some(sym::Borrow | sym::Clone | sym::Deref) +- ) => +- { +- did +- } +- _ => return, +- }, +- _ => return, ++ ++ let Some((DefKind::AssocFn, did)) = ++ cx.typeck_results().type_dependent_def(expr.hir_id) ++ else { ++ return; ++ }; ++ ++ let Some(trait_id) = cx.tcx.trait_of_item(did) else { return }; ++ ++ if !matches!( ++ cx.tcx.get_diagnostic_name(trait_id), ++ Some(sym::Borrow | sym::Clone | sym::Deref) ++ ) { ++ return; + }; ++ + let substs = cx + .tcx + .normalize_erasing_regions(cx.param_env, cx.typeck_results().node_substs(expr.hir_id)); +@@ -102,13 +104,6 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { + // (Re)check that it implements the noop diagnostic. + let Some(name) = cx.tcx.get_diagnostic_name(i.def_id()) else { return }; + +- let op = match name { +- sym::noop_method_borrow => "borrow", +- sym::noop_method_clone => "clone", +- sym::noop_method_deref => "deref", +- _ => return, +- }; +- + let receiver_ty = cx.typeck_results().expr_ty(receiver); + let expr_ty = cx.typeck_results().expr_ty_adjusted(expr); + let arg_adjustments = cx.typeck_results().expr_adjustments(receiver); +@@ -129,11 +124,22 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { + NoopMethodCallDiag { method: call.ident.name, receiver_ty, label: span }, + ); + } else { +- cx.emit_spanned_lint( +- SUSPICIOUS_DOUBLE_REF_OP, +- span, +- SuspiciousDoubleRefDiag { call: call.ident.name, ty: expr_ty, op }, +- ) ++ match name { ++ // If `type_of(x) == T` and `x.borrow()` is used to get `&T`, ++ // then that should be allowed ++ sym::noop_method_borrow => return, ++ sym::noop_method_clone => cx.emit_spanned_lint( ++ SUSPICIOUS_DOUBLE_REF_OP, ++ span, ++ SuspiciousDoubleRefCloneDiag { ty: expr_ty }, ++ ), ++ sym::noop_method_deref => cx.emit_spanned_lint( ++ SUSPICIOUS_DOUBLE_REF_OP, ++ span, ++ SuspiciousDoubleRefDerefDiag { ty: expr_ty }, ++ ), ++ _ => return, ++ } + } + } + } +diff --git a/tests/ui/lint/issue-112489.rs b/tests/ui/lint/issue-112489.rs +new file mode 100644 +index 000000000000..559edf0e4f23 +--- /dev/null ++++ b/tests/ui/lint/issue-112489.rs +@@ -0,0 +1,17 @@ ++// check-pass ++use std::borrow::Borrow; ++ ++struct S; ++ ++trait T: Sized { ++ fn foo(self) {} ++} ++ ++impl T for S {} ++impl T for &S {} ++ ++fn main() { ++ let s = S; ++ s.borrow().foo(); ++ s.foo(); ++} +-- +2.41.0 + diff --git a/rust.spec b/rust.spec index 1901dc8..e5c7547 100644 --- a/rust.spec +++ b/rust.spec @@ -84,7 +84,7 @@ Name: rust Version: 1.71.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -118,6 +118,14 @@ Patch4: 0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch # https://github.com/rust-lang/rust/pull/110906#issuecomment-1629832675 Patch5: 0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch +# (c9s) rhbz2225471: relax the suspicious_double_ref_op lint +# https://github.com/rust-lang/rust/pull/112517 +Patch6: 0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch + +# Enable the profiler runtime for native hosts +# https://github.com/rust-lang/rust/pull/114069 +Patch7: 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch + ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) @@ -331,6 +339,9 @@ find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)' %{nil} %endif +# For profiler_builtins +BuildRequires: compiler-rt + # This component was removed as of Rust 1.69.0. # https://github.com/rust-lang/rust/pull/101841 Obsoletes: %{name}-analysis < 1.69.0~ @@ -589,6 +600,8 @@ test -f '%{local_rust_root}/bin/rustc' %patch -P3 -p1 %patch -P4 -p1 %patch -P5 -p1 +%patch -P6 -p1 +%patch -P7 -p1 %if %with disabled_libssh2 %patch -P100 -p1 @@ -744,6 +757,10 @@ end} end} %endif +# The exact profiler path is version dependent, and uses LLVM-specific +# arch names in the filename, but this find is good enough for now... +PROFILER=$(find %{_libdir}/clang -type f -name 'libclang_rt.profile-*.a') + %configure --disable-option-checking \ --libdir=%{common_libdir} \ --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ @@ -752,6 +769,7 @@ end} --set target.%{rust_triple}.cxx=%{__cxx} \ --set target.%{rust_triple}.ar=%{__ar} \ --set target.%{rust_triple}.ranlib=%{__ranlib} \ + ${PROFILER:+--set target.%{rust_triple}.profiler="$PROFILER"} \ %{?mingw_target_config} \ %{?wasm_target_config} \ --python=%{__python3} \ @@ -1063,6 +1081,10 @@ end} %changelog +* Tue Jul 25 2023 Josh Stone - 1.71.0-3 +- Relax the suspicious_double_ref_op lint +- Enable the profiler runtime for native hosts + * Fri Jul 21 2023 Fedora Release Engineering - 1.71.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From cd2d5f3610773b37fb263f2ae51a0507192ae7e0 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 7 Aug 2023 14:57:21 -0700 Subject: [PATCH 31/45] Update to 1.71.1. Security fix for CVE-2023-38497 --- .gitignore | 1 + ...t-lint-docs-when-download-rustc-is-e.patch | 60 ------ ...tc-bash_complettion-src-etc-.-to-avo.patch | 31 --- ...112517-fee1-dead-contrib-sus-op-no-b.patch | 185 ------------------ ...ap-config-fix-version-comparison-bug.patch | 36 ++++ rust.spec | 32 ++- sources | 2 +- 7 files changed, 52 insertions(+), 295 deletions(-) delete mode 100644 0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch delete mode 100644 0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch delete mode 100644 0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch create mode 100644 0001-bootstrap-config-fix-version-comparison-bug.patch diff --git a/.gitignore b/.gitignore index d7f7e39..3ec0cf1 100644 --- a/.gitignore +++ b/.gitignore @@ -421,3 +421,4 @@ /rustc-1.70.0-src.tar.xz /wasi-libc-wasi-sdk-20.tar.gz /rustc-1.71.0-src.tar.xz +/rustc-1.71.1-src.tar.xz diff --git a/0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch b/0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch deleted file mode 100644 index 50518c6..0000000 --- a/0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 9204a8359201271fd7b1c625d6f29ddd095a419d Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Mon, 10 Jul 2023 13:48:49 -0700 -Subject: [PATCH] Revert "Fix `x test lint-docs` when download-rustc is - enabled" - -This reverts commit abf9cbcb69e485b56776112bc587f6166e7ac5c9. ---- - src/tools/lint-docs/src/groups.rs | 3 +-- - src/tools/lint-docs/src/lib.rs | 9 --------- - 2 files changed, 1 insertion(+), 11 deletions(-) - -diff --git a/src/tools/lint-docs/src/groups.rs b/src/tools/lint-docs/src/groups.rs -index b11fb287cf4d..2a923a61b0a7 100644 ---- a/src/tools/lint-docs/src/groups.rs -+++ b/src/tools/lint-docs/src/groups.rs -@@ -39,12 +39,11 @@ pub(crate) fn generate_group_docs(&self, lints: &[Lint]) -> Result<(), Box Result> { - let mut result = BTreeMap::new(); - let mut cmd = Command::new(self.rustc_path); -- cmd.env_remove("LD_LIBRARY_PATH"); - cmd.arg("-Whelp"); - let output = cmd.output().map_err(|e| format!("failed to run command {:?}\n{}", cmd, e))?; - if !output.status.success() { - return Err(format!( -- "failed to collect lint info: failed to run {cmd:?}: {:?}\n--- stderr\n{}--- stdout\n{}\n", -+ "failed to collect lint info: {:?}\n--- stderr\n{}--- stdout\n{}\n", - output.status, - std::str::from_utf8(&output.stderr).unwrap(), - std::str::from_utf8(&output.stdout).unwrap(), -diff --git a/src/tools/lint-docs/src/lib.rs b/src/tools/lint-docs/src/lib.rs -index fe29b9abda39..034c6aa0708e 100644 ---- a/src/tools/lint-docs/src/lib.rs -+++ b/src/tools/lint-docs/src/lib.rs -@@ -403,12 +403,6 @@ fn generate_lint_output( - fs::write(&tempfile, source) - .map_err(|e| format!("failed to write {}: {}", tempfile.display(), e))?; - let mut cmd = Command::new(self.rustc_path); -- // NOTE: bootstrap sets `LD_LIBRARY_PATH` for building lint-docs itself. -- // Unfortunately, lint-docs is a bootstrap tool while rustc is built from source, -- // and sometimes the paths conflict. In particular, when using `download-rustc`, -- // the LLVM versions can differ between `ci-llvm` and `ci-rustc-sysroot`. -- // Unset LD_LIBRARY_PATH here so it doesn't interfere with running the compiler. -- cmd.env_remove("LD_LIBRARY_PATH"); - if options.contains(&"edition2015") { - cmd.arg("--edition=2015"); - } else { -@@ -421,9 +415,6 @@ fn generate_lint_output( - } - cmd.arg("lint_example.rs"); - cmd.current_dir(tempdir.path()); -- if self.verbose { -- eprintln!("running: {cmd:?}"); -- } - let output = cmd.output().map_err(|e| format!("failed to run command {:?}\n{}", cmd, e))?; - let stderr = std::str::from_utf8(&output.stderr).unwrap(); - let msgs = stderr --- -2.41.0 - diff --git a/0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch b/0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch deleted file mode 100644 index a326207..0000000 --- a/0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch +++ /dev/null @@ -1,31 +0,0 @@ -From cea2e61a03773ce28fd57b7338c4ae4d947650ca Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Mon, 10 Jul 2023 15:52:55 -0700 -Subject: [PATCH] Revert "fix: :bug: etc/bash_complettion -> src/etc/... to - avoid copy error" - -This reverts commit 08ce68b6a6bad360e9c3611ad60cf6598401f878. ---- - src/bootstrap/dist.rs | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs -index b49845386da1..9cead7adc8c3 100644 ---- a/src/bootstrap/dist.rs -+++ b/src/bootstrap/dist.rs -@@ -1071,11 +1071,7 @@ fn run(self, builder: &Builder<'_>) -> Option { - - tarball.add_file(&cargo, "bin", 0o755); - tarball.add_file(etc.join("_cargo"), "share/zsh/site-functions", 0o644); -- tarball.add_renamed_file( -- etc.join("cargo.bashcomp.sh"), -- "src/etc/bash_completion.d", -- "cargo", -- ); -+ tarball.add_renamed_file(etc.join("cargo.bashcomp.sh"), "etc/bash_completion.d", "cargo"); - tarball.add_dir(etc.join("man"), "share/man/man1"); - tarball.add_legal_and_readme_to("share/doc/cargo"); - --- -2.41.0 - diff --git a/0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch b/0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch deleted file mode 100644 index 8f8c544..0000000 --- a/0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch +++ /dev/null @@ -1,185 +0,0 @@ -From abb7c31ab038f38e33057062ae8b66b4e3cd699c Mon Sep 17 00:00:00 2001 -From: Guillaume Gomez -Date: Thu, 15 Jun 2023 22:04:55 +0200 -Subject: [PATCH] Rollup merge of #112517 - fee1-dead-contrib:sus-op-no-borrow, - r=compiler-errors - -`suspicious_double_ref_op`: don't lint on `.borrow()` - -closes #112489 - -(cherry picked from commit db7d8374c1b6f1e2e8297f43e6a2cbffeff21882) ---- - compiler/rustc_lint/messages.ftl | 12 ++-- - compiler/rustc_lint/src/lints.rs | 12 ++-- - compiler/rustc_lint/src/noop_method_call.rs | 62 +++++++++++---------- - tests/ui/lint/issue-112489.rs | 17 ++++++ - 4 files changed, 64 insertions(+), 39 deletions(-) - create mode 100644 tests/ui/lint/issue-112489.rs - -diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl -index d34a3afcba53..0fa67cdb391f 100644 ---- a/compiler/rustc_lint/messages.ftl -+++ b/compiler/rustc_lint/messages.ftl -@@ -463,13 +463,11 @@ lint_requested_level = requested on the command line with `{$level} {$lint_name} - lint_supertrait_as_deref_target = `{$t}` implements `Deref` with supertrait `{$target_principal}` as target - .label = target type is set here - --lint_suspicious_double_ref_op = -- using `.{$call}()` on a double reference, which returns `{$ty}` instead of {$op -> -- *[should_not_happen] [{$op}] -- [deref] dereferencing -- [borrow] borrowing -- [clone] cloning -- } the inner type -+lint_suspicious_double_ref_clone = -+ using `.clone()` on a double reference, which returns `{$ty}` instead of cloning the inner type -+ -+lint_suspicious_double_ref_deref = -+ using `.deref()` on a double reference, which returns `{$ty}` instead of dereferencing the inner type - - lint_trivial_untranslatable_diag = diagnostic with static strings only - -diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs -index de1c2be28757..d96723a68eb6 100644 ---- a/compiler/rustc_lint/src/lints.rs -+++ b/compiler/rustc_lint/src/lints.rs -@@ -1188,11 +1188,15 @@ pub struct NoopMethodCallDiag<'a> { - } - - #[derive(LintDiagnostic)] --#[diag(lint_suspicious_double_ref_op)] --pub struct SuspiciousDoubleRefDiag<'a> { -- pub call: Symbol, -+#[diag(lint_suspicious_double_ref_deref)] -+pub struct SuspiciousDoubleRefDerefDiag<'a> { -+ pub ty: Ty<'a>, -+} -+ -+#[derive(LintDiagnostic)] -+#[diag(lint_suspicious_double_ref_clone)] -+pub struct SuspiciousDoubleRefCloneDiag<'a> { - pub ty: Ty<'a>, -- pub op: &'static str, - } - - // pass_by_value.rs -diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs -index d054966459d8..d56c35bb677a 100644 ---- a/compiler/rustc_lint/src/noop_method_call.rs -+++ b/compiler/rustc_lint/src/noop_method_call.rs -@@ -1,5 +1,7 @@ - use crate::context::LintContext; --use crate::lints::{NoopMethodCallDiag, SuspiciousDoubleRefDiag}; -+use crate::lints::{ -+ NoopMethodCallDiag, SuspiciousDoubleRefCloneDiag, SuspiciousDoubleRefDerefDiag, -+}; - use crate::LateContext; - use crate::LateLintPass; - use rustc_hir::def::DefKind; -@@ -76,22 +78,22 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { - - // We only care about method calls corresponding to the `Clone`, `Deref` and `Borrow` - // traits and ignore any other method call. -- let did = match cx.typeck_results().type_dependent_def(expr.hir_id) { -- // Verify we are dealing with a method/associated function. -- Some((DefKind::AssocFn, did)) => match cx.tcx.trait_of_item(did) { -- // Check that we're dealing with a trait method for one of the traits we care about. -- Some(trait_id) -- if matches!( -- cx.tcx.get_diagnostic_name(trait_id), -- Some(sym::Borrow | sym::Clone | sym::Deref) -- ) => -- { -- did -- } -- _ => return, -- }, -- _ => return, -+ -+ let Some((DefKind::AssocFn, did)) = -+ cx.typeck_results().type_dependent_def(expr.hir_id) -+ else { -+ return; -+ }; -+ -+ let Some(trait_id) = cx.tcx.trait_of_item(did) else { return }; -+ -+ if !matches!( -+ cx.tcx.get_diagnostic_name(trait_id), -+ Some(sym::Borrow | sym::Clone | sym::Deref) -+ ) { -+ return; - }; -+ - let substs = cx - .tcx - .normalize_erasing_regions(cx.param_env, cx.typeck_results().node_substs(expr.hir_id)); -@@ -102,13 +104,6 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { - // (Re)check that it implements the noop diagnostic. - let Some(name) = cx.tcx.get_diagnostic_name(i.def_id()) else { return }; - -- let op = match name { -- sym::noop_method_borrow => "borrow", -- sym::noop_method_clone => "clone", -- sym::noop_method_deref => "deref", -- _ => return, -- }; -- - let receiver_ty = cx.typeck_results().expr_ty(receiver); - let expr_ty = cx.typeck_results().expr_ty_adjusted(expr); - let arg_adjustments = cx.typeck_results().expr_adjustments(receiver); -@@ -129,11 +124,22 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { - NoopMethodCallDiag { method: call.ident.name, receiver_ty, label: span }, - ); - } else { -- cx.emit_spanned_lint( -- SUSPICIOUS_DOUBLE_REF_OP, -- span, -- SuspiciousDoubleRefDiag { call: call.ident.name, ty: expr_ty, op }, -- ) -+ match name { -+ // If `type_of(x) == T` and `x.borrow()` is used to get `&T`, -+ // then that should be allowed -+ sym::noop_method_borrow => return, -+ sym::noop_method_clone => cx.emit_spanned_lint( -+ SUSPICIOUS_DOUBLE_REF_OP, -+ span, -+ SuspiciousDoubleRefCloneDiag { ty: expr_ty }, -+ ), -+ sym::noop_method_deref => cx.emit_spanned_lint( -+ SUSPICIOUS_DOUBLE_REF_OP, -+ span, -+ SuspiciousDoubleRefDerefDiag { ty: expr_ty }, -+ ), -+ _ => return, -+ } - } - } - } -diff --git a/tests/ui/lint/issue-112489.rs b/tests/ui/lint/issue-112489.rs -new file mode 100644 -index 000000000000..559edf0e4f23 ---- /dev/null -+++ b/tests/ui/lint/issue-112489.rs -@@ -0,0 +1,17 @@ -+// check-pass -+use std::borrow::Borrow; -+ -+struct S; -+ -+trait T: Sized { -+ fn foo(self) {} -+} -+ -+impl T for S {} -+impl T for &S {} -+ -+fn main() { -+ let s = S; -+ s.borrow().foo(); -+ s.foo(); -+} --- -2.41.0 - diff --git a/0001-bootstrap-config-fix-version-comparison-bug.patch b/0001-bootstrap-config-fix-version-comparison-bug.patch new file mode 100644 index 0000000..f0c4e55 --- /dev/null +++ b/0001-bootstrap-config-fix-version-comparison-bug.patch @@ -0,0 +1,36 @@ +From a627c8f54cab6880dc7d36c55092a94c6f750a6e Mon Sep 17 00:00:00 2001 +From: Ariadne Conill +Date: Thu, 3 Aug 2023 15:05:40 -0700 +Subject: [PATCH] bootstrap: config: fix version comparison bug + +Rust requires a previous version of Rust to build, such as the current version, or the +previous version. However, the version comparison logic did not take patch releases +into consideration when doing the version comparison for the current branch, e.g. +Rust 1.71.1 could not be built by Rust 1.71.0 because it is neither an exact version +match, or the previous version. + +Adjust the version comparison logic to tolerate mismatches in the patch version. + +Signed-off-by: Ariadne Conill +(cherry picked from commit 31a81a08786826cc6e832bd0b49fb8b934e29648) +--- + src/bootstrap/config.rs | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs +index e192cda9a9a7..2b5d0b94e968 100644 +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -1805,7 +1805,8 @@ pub fn check_build_rustc_version(&self) { + .unwrap(); + if !(source_version == rustc_version + || (source_version.major == rustc_version.major +- && source_version.minor == rustc_version.minor + 1)) ++ && (source_version.minor == rustc_version.minor ++ || source_version.minor == rustc_version.minor + 1))) + { + let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1); + eprintln!( +-- +2.41.0 + diff --git a/rust.spec b/rust.spec index e5c7547..9cc64eb 100644 --- a/rust.spec +++ b/rust.spec @@ -83,8 +83,8 @@ %endif Name: rust -Version: 1.71.0 -Release: 3%{?dist} +Version: 1.71.1 +Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -110,21 +110,12 @@ Patch2: rustc-1.70.0-rust-gdb-substitute-path.patch # TODO: upstream this ability into the actual build configuration Patch3: 0001-Let-environment-variables-override-some-default-CPUs.patch -# Restore LD_LIBRARY_PATH when running lint-docs -# https://github.com/rust-lang/rust/pull/110521#issuecomment-1629705099 -Patch4: 0001-Revert-Fix-x-test-lint-docs-when-download-rustc-is-e.patch - -# Restore the bash completion path -# https://github.com/rust-lang/rust/pull/110906#issuecomment-1629832675 -Patch5: 0001-Revert-fix-bug-etc-bash_complettion-src-etc-.-to-avo.patch - -# (c9s) rhbz2225471: relax the suspicious_double_ref_op lint -# https://github.com/rust-lang/rust/pull/112517 -Patch6: 0001-Rollup-merge-of-112517-fee1-dead-contrib-sus-op-no-b.patch - # Enable the profiler runtime for native hosts # https://github.com/rust-lang/rust/pull/114069 -Patch7: 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch +Patch4: 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch + +# https://github.com/rust-lang/rust/pull/114440 +Patch5: 0001-bootstrap-config-fix-version-comparison-bug.patch ### RHEL-specific patches below ### @@ -600,8 +591,6 @@ test -f '%{local_rust_root}/bin/rustc' %patch -P3 -p1 %patch -P4 -p1 %patch -P5 -p1 -%patch -P6 -p1 -%patch -P7 -p1 %if %with disabled_libssh2 %patch -P100 -p1 @@ -915,7 +904,10 @@ done # 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. -%{__python3} ./x.py test --no-fail-fast || : + +# Bootstrap is excluded because it's not something we ship, and a lot of its +# tests are geared toward the upstream CI environment. +%{__python3} ./x.py test --no-fail-fast --exclude src/bootstrap || : rm -rf "./build/%{rust_triple}/test/" %{__python3} ./x.py test --no-fail-fast cargo || : @@ -1081,6 +1073,10 @@ end} %changelog +* Mon Aug 07 2023 Josh Stone - 1.71.1-1 +- Update to 1.71.1. +- Security fix for CVE-2023-38497 + * Tue Jul 25 2023 Josh Stone - 1.71.0-3 - Relax the suspicious_double_ref_op lint - Enable the profiler runtime for native hosts diff --git a/sources b/sources index 622ee4f..8a2c328 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.71.0-src.tar.xz) = 2c93bafdd248563765a285add48ca77c1e4bad4d5431675ae6a5cdee4cfe7a41e6bcc880a489ca1069a307fd9a005f2d5f8e230dfc95b4a69152b4f9ca49ac44 +SHA512 (rustc-1.71.1-src.tar.xz) = fd0e5a16bdbeb539184513583089e55f681cb772810df357b6b1464853f7022ac02edab3dd155b2262ed0047e2a25dea3808dd078dcdfce9d399384465009db4 SHA512 (wasi-libc-wasi-sdk-20.tar.gz) = e264240dc7dbcf6398c8ca09bc108298f4a8aa955af22de5a3015fbcde81cb09dd83cd48349090082d5de0e8a3dbcf746c7b14657c67657b3f2f1ab28bb9cf05 From 1265039e134082c3888ab24f895cac6aeb662ec8 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 7 Aug 2023 16:39:57 -0700 Subject: [PATCH 32/45] Disable profiler_builtins for EPEL7 We don't have compiler-rt available there. --- rust.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust.spec b/rust.spec index 9cc64eb..5e96177 100644 --- a/rust.spec +++ b/rust.spec @@ -330,8 +330,10 @@ find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)' %{nil} %endif +%if 0%{?fedora} || 0%{?rhel} >= 8 # For profiler_builtins BuildRequires: compiler-rt +%endif # This component was removed as of Rust 1.69.0. # https://github.com/rust-lang/rust/pull/101841 @@ -746,9 +748,11 @@ end} end} %endif +%if 0%{?fedora} || 0%{?rhel} >= 8 # The exact profiler path is version dependent, and uses LLVM-specific # arch names in the filename, but this find is good enough for now... PROFILER=$(find %{_libdir}/clang -type f -name 'libclang_rt.profile-*.a') +%endif %configure --disable-option-checking \ --libdir=%{common_libdir} \ From 0764fad18bb6ddf005d563d34f7545c3bf94acd1 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 24 Aug 2023 11:15:39 -0700 Subject: [PATCH 33/45] Update to 1.72.0. --- .gitignore | 2 + ...rnal-builds-of-the-compiler-rt-profi.patch | 28 +-- ...il-early-if-try_run-returns-an-error.patch | 201 ++++++++++++++++++ ...variables-override-some-default-CPUs.patch | 8 +- ...mlAnchors-when-the-config-is-missing.patch | 32 +++ ...ap-config-fix-version-comparison-bug.patch | 36 ---- rust.spec | 28 ++- ....patch => rustc-1.72.0-disable-http2.patch | 36 ++-- ...atch => rustc-1.72.0-disable-libssh2.patch | 18 +- sources | 4 +- 10 files changed, 301 insertions(+), 92 deletions(-) create mode 100644 0001-Don-t-fail-early-if-try_run-returns-an-error.patch create mode 100644 0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch delete mode 100644 0001-bootstrap-config-fix-version-comparison-bug.patch rename rustc-1.71.0-disable-http2.patch => rustc-1.72.0-disable-http2.patch (77%) rename rustc-1.71.0-disable-libssh2.patch => rustc-1.72.0-disable-libssh2.patch (61%) diff --git a/.gitignore b/.gitignore index 3ec0cf1..2961d88 100644 --- a/.gitignore +++ b/.gitignore @@ -422,3 +422,5 @@ /wasi-libc-wasi-sdk-20.tar.gz /rustc-1.71.0-src.tar.xz /rustc-1.71.1-src.tar.xz +/rustc-1.72.0-src.tar.xz +/wasi-libc-7018e24d8fe248596819d2e884761676f3542a04.tar.gz diff --git a/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch b/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch index 2b1ecb5..01f7847 100644 --- a/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch +++ b/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch @@ -1,4 +1,4 @@ -From f2fd2d01f96b50b039402c9ab4278230687f7922 Mon Sep 17 00:00:00 2001 +From e276ae1cb702fa830be126cccce4bb9e8676f9fb Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 25 Jul 2023 13:11:50 -0700 Subject: [PATCH] Allow using external builds of the compiler-rt profile lib @@ -15,10 +15,10 @@ reads that in a `LLVM_PROFILER_RT_LIB` environment variable. 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/config.example.toml b/config.example.toml -index d0eaa9fd7ffa..e0e991e679af 100644 +index 0c65b25fe138..249847013259 100644 --- a/config.example.toml +++ b/config.example.toml -@@ -745,8 +745,10 @@ changelog-seen = 2 +@@ -752,8 +752,10 @@ changelog-seen = 2 # This option will override the same option under [build] section. #sanitizers = build.sanitizers (bool) @@ -49,10 +49,10 @@ index 1b1f11798d74..d14d0b82229a 100644 let cfg = &mut cc::Build::new(); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs -index 33addb90da37..1d8b3c6e5435 100644 +index 14c3ef79a78f..64bdcd1a3b97 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs -@@ -305,6 +305,10 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car +@@ -336,6 +336,10 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car cargo.env("MACOSX_DEPLOYMENT_TARGET", target); } @@ -64,10 +64,10 @@ index 33addb90da37..1d8b3c6e5435 100644 // the `compiler-builtins` crate. These intrinsics live in LLVM's // `compiler-rt` repository, but our `src/llvm-project` submodule isn't diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs -index e192cda9a9a7..a4803db0a470 100644 +index fe932fd6bd30..45a743082415 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs -@@ -467,7 +467,7 @@ pub struct Target { +@@ -533,7 +533,7 @@ pub struct Target { pub linker: Option, pub ndk: Option, pub sanitizers: Option, @@ -76,7 +76,7 @@ index e192cda9a9a7..a4803db0a470 100644 pub rpath: Option, pub crt_static: Option, pub musl_root: Option, -@@ -796,9 +796,9 @@ struct Dist { +@@ -862,9 +862,9 @@ struct Dist { } } @@ -88,7 +88,7 @@ index e192cda9a9a7..a4803db0a470 100644 String(String), Bool(bool), } -@@ -809,6 +809,12 @@ fn default() -> StringOrBool { +@@ -875,6 +875,12 @@ fn default() -> StringOrBool { } } @@ -98,10 +98,10 @@ index e192cda9a9a7..a4803db0a470 100644 + } +} + - define_config! { - /// TOML representation of how the Rust build is configured. - struct Rust { -@@ -880,7 +886,7 @@ struct TomlTarget { + #[derive(Clone, Debug, Deserialize, PartialEq, Eq)] + #[serde(untagged)] + pub enum RustOptimize { +@@ -991,7 +997,7 @@ struct TomlTarget { llvm_libunwind: Option = "llvm-libunwind", android_ndk: Option = "android-ndk", sanitizers: Option = "sanitizers", @@ -110,7 +110,7 @@ index e192cda9a9a7..a4803db0a470 100644 rpath: Option = "rpath", crt_static: Option = "crt-static", musl_root: Option = "musl-root", -@@ -1744,12 +1750,24 @@ pub fn any_sanitizers_enabled(&self) -> bool { +@@ -1864,12 +1870,24 @@ pub fn any_sanitizers_enabled(&self) -> bool { self.target_config.values().any(|t| t.sanitizers == Some(true)) || self.sanitizers } diff --git a/0001-Don-t-fail-early-if-try_run-returns-an-error.patch b/0001-Don-t-fail-early-if-try_run-returns-an-error.patch new file mode 100644 index 0000000..d77ddc7 --- /dev/null +++ b/0001-Don-t-fail-early-if-try_run-returns-an-error.patch @@ -0,0 +1,201 @@ +From 98336f8f6e701ea99275f32d6e2127a621041994 Mon Sep 17 00:00:00 2001 +From: Guillaume Gomez +Date: Tue, 11 Jul 2023 17:01:35 +0200 +Subject: [PATCH] Don't fail early if `try_run` returns an error + +--- + src/bootstrap/download.rs | 2 +- + src/bootstrap/run.rs | 11 +++++------ + src/bootstrap/test.rs | 36 ++++++++++++++++-------------------- + 3 files changed, 22 insertions(+), 27 deletions(-) + +diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs +index cb40521dda76..9478ac7d9cea 100644 +--- a/src/bootstrap/download.rs ++++ b/src/bootstrap/download.rs +@@ -188,7 +188,7 @@ fn fix_bin_or_dylib(&self, fname: &Path) { + patchelf.args(&["--set-interpreter", dynamic_linker.trim_end()]); + } + +- self.try_run(patchelf.arg(fname)).unwrap(); ++ let _ = self.try_run(patchelf.arg(fname)); + } + + fn download_file(&self, url: &str, dest_path: &Path, help_on_error: &str) { +diff --git a/src/bootstrap/run.rs b/src/bootstrap/run.rs +index c97b75927371..70b917000433 100644 +--- a/src/bootstrap/run.rs ++++ b/src/bootstrap/run.rs +@@ -27,8 +27,7 @@ fn run(self, builder: &Builder<'_>) { + try_run( + builder, + &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("generate").arg(&builder.src), +- ) +- .unwrap(); ++ ); + } + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { +@@ -40,17 +39,17 @@ fn make_run(run: RunConfig<'_>) { + } + } + +-fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> Result<(), ()> { ++fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool { + if !builder.fail_fast { +- if let Err(e) = builder.try_run(cmd) { ++ if builder.try_run(cmd).is_err() { + let mut failures = builder.delayed_failures.borrow_mut(); + failures.push(format!("{:?}", cmd)); +- return Err(e); ++ return false; + } + } else { + builder.run(cmd); + } +- Ok(()) ++ true + } + + #[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] +diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs +index 0907291b54da..13576aa787b6 100644 +--- a/src/bootstrap/test.rs ++++ b/src/bootstrap/test.rs +@@ -48,17 +48,17 @@ + // build for, so there is no entry for "aarch64-apple-darwin" here. + ]; + +-fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> Result<(), ()> { ++fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool { + if !builder.fail_fast { +- if let Err(e) = builder.try_run(cmd) { ++ if builder.try_run(cmd).is_err() { + let mut failures = builder.delayed_failures.borrow_mut(); + failures.push(format!("{:?}", cmd)); +- return Err(e); ++ return false; + } + } else { + builder.run(cmd); + } +- Ok(()) ++ true + } + + fn try_run_quiet(builder: &Builder<'_>, cmd: &mut Command) -> bool { +@@ -187,8 +187,7 @@ fn run(self, builder: &Builder<'_>) { + try_run( + builder, + builder.tool_cmd(Tool::Linkchecker).arg(builder.out.join(host.triple).join("doc")), +- ) +- .unwrap(); ++ ); + } + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { +@@ -241,8 +240,7 @@ fn run(self, builder: &Builder<'_>) { + builder.default_doc(&[]); + builder.ensure(crate::doc::Rustc::new(builder.top_stage, self.target, builder)); + +- try_run(builder, builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target))) +- .unwrap(); ++ try_run(builder, builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target))); + } + } + +@@ -288,8 +286,7 @@ fn run(self, builder: &Builder<'_>) { + .args(builder.config.test_args()) + .env("RUSTC", builder.rustc(compiler)) + .env("RUSTDOC", builder.rustdoc(compiler)), +- ) +- .unwrap(); ++ ); + } + } + +@@ -855,7 +852,7 @@ fn run(self, builder: &Builder<'_>) { + util::lld_flag_no_threads(self.compiler.host.contains("windows")), + ); + } +- try_run(builder, &mut cmd).unwrap(); ++ try_run(builder, &mut cmd); + } + } + +@@ -1106,7 +1103,7 @@ fn run(self, builder: &Builder<'_>) { + } + + builder.info("tidy check"); +- try_run(builder, &mut cmd).unwrap(); ++ try_run(builder, &mut cmd); + + builder.ensure(ExpandYamlAnchors); + +@@ -1154,8 +1151,7 @@ fn run(self, builder: &Builder<'_>) { + try_run( + builder, + &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("check").arg(&builder.src), +- ) +- .unwrap(); ++ ); + } + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { +@@ -1948,7 +1944,7 @@ fn run_ext_doc(self, builder: &Builder<'_>) { + compiler.host, + ); + let _time = util::timeit(&builder); +- let toolstate = if try_run(builder, &mut rustbook_cmd).is_ok() { ++ let toolstate = if try_run(builder, &mut rustbook_cmd) { + ToolState::TestPass + } else { + ToolState::TestFail +@@ -2106,7 +2102,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) -> + cmd.arg("--test-args").arg(test_args); + + if builder.config.verbose_tests { +- try_run(builder, &mut cmd).is_ok() ++ try_run(builder, &mut cmd) + } else { + try_run_quiet(builder, &mut cmd) + } +@@ -2134,7 +2130,7 @@ fn run(self, builder: &Builder<'_>) { + + let src = builder.src.join(relative_path); + let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook); +- let toolstate = if try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src)).is_ok() { ++ let toolstate = if try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src)) { + ToolState::TestPass + } else { + ToolState::TestFail +@@ -2684,7 +2680,7 @@ fn run(self, builder: &Builder<'_>) { + .current_dir(builder.src.join("src/bootstrap/")); + // NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible. + // Use `python -m unittest` manually if you want to pass arguments. +- try_run(builder, &mut check_bootstrap).unwrap(); ++ try_run(builder, &mut check_bootstrap); + + let host = builder.config.build; + let compiler = builder.compiler(0, host); +@@ -2756,7 +2752,7 @@ fn run(self, builder: &Builder<'_>) { + } + + builder.info("platform support check"); +- try_run(builder, &mut cargo.into()).unwrap(); ++ try_run(builder, &mut cargo.into()); + } + } + +@@ -2836,7 +2832,7 @@ fn run(self, builder: &Builder<'_>) { + cmd.env("CARGO", &builder.initial_cargo); + cmd.env("RUSTC", &builder.initial_rustc); + cmd.env("TMP_DIR", &tmpdir); +- try_run(builder, &mut cmd).unwrap(); ++ try_run(builder, &mut cmd); + } + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { +-- +2.41.0 + diff --git a/0001-Let-environment-variables-override-some-default-CPUs.patch b/0001-Let-environment-variables-override-some-default-CPUs.patch index c394f78..04a0c9c 100644 --- a/0001-Let-environment-variables-override-some-default-CPUs.patch +++ b/0001-Let-environment-variables-override-some-default-CPUs.patch @@ -1,4 +1,4 @@ -From 6e2adb05860b72610291d3b0e8bd525c44cb0cc9 Mon Sep 17 00:00:00 2001 +From 87caaab3681b95fa633aac48b9794364e18c467d Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 9 Jun 2023 15:23:08 -0700 Subject: [PATCH] Let environment variables override some default CPUs @@ -36,7 +36,7 @@ index f2c722b9a89d..17a14d10b27e 100644 // ABI. Pass the -vector feature string to LLVM to respect this assumption. On LLVM < 16, we // also strip v128 from the data_layout below to match the older LLVM's expectation. diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs -index 9af1049b8702..68f876dd18c3 100644 +index 2f970f87cc64..7ee62cd62a5c 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs @@ -2,7 +2,7 @@ @@ -45,9 +45,9 @@ index 9af1049b8702..68f876dd18c3 100644 let mut base = super::linux_gnu_base::opts(); - base.cpu = "x86-64".into(); + base.cpu = option_env!("RUSTC_TARGET_CPU_X86_64").unwrap_or("x86-64").into(); + base.plt_by_default = false; base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); - base.stack_probes = StackProbeType::X86; -- -2.40.1 +2.41.0 diff --git a/0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch b/0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch new file mode 100644 index 0000000..62b4c56 --- /dev/null +++ b/0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch @@ -0,0 +1,32 @@ +From ab9c5148956c2b7d177cc94533370d6a01a8d15f Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Tue, 22 Aug 2023 10:42:12 -0700 +Subject: [PATCH] Skip ExpandYamlAnchors when the config is missing + +The dist-src tarball does not include `.github/` at all, so we can't +check whether it needs to be regenerated. + +(cherry picked from commit 35187c7e6474d346eea3113c4ae34d26d6b18756) +--- + src/bootstrap/test.rs | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs +index eed7a584b603..d41850783c6d 100644 +--- a/src/bootstrap/test.rs ++++ b/src/bootstrap/test.rs +@@ -1150,6 +1150,11 @@ impl Step for ExpandYamlAnchors { + /// appropriate configuration for all our CI providers. This step ensures the tool was called + /// by the user before committing CI changes. + fn run(self, builder: &Builder<'_>) { ++ // Note: `.github/` is not included in dist-src tarballs ++ if !builder.src.join(".github/workflows/ci.yml").exists() { ++ builder.info("Skipping YAML anchors check: GitHub Actions config not found"); ++ return; ++ } + builder.info("Ensuring the YAML anchors in the GitHub Actions config were expanded"); + try_run( + builder, +-- +2.41.0 + diff --git a/0001-bootstrap-config-fix-version-comparison-bug.patch b/0001-bootstrap-config-fix-version-comparison-bug.patch deleted file mode 100644 index f0c4e55..0000000 --- a/0001-bootstrap-config-fix-version-comparison-bug.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a627c8f54cab6880dc7d36c55092a94c6f750a6e Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Thu, 3 Aug 2023 15:05:40 -0700 -Subject: [PATCH] bootstrap: config: fix version comparison bug - -Rust requires a previous version of Rust to build, such as the current version, or the -previous version. However, the version comparison logic did not take patch releases -into consideration when doing the version comparison for the current branch, e.g. -Rust 1.71.1 could not be built by Rust 1.71.0 because it is neither an exact version -match, or the previous version. - -Adjust the version comparison logic to tolerate mismatches in the patch version. - -Signed-off-by: Ariadne Conill -(cherry picked from commit 31a81a08786826cc6e832bd0b49fb8b934e29648) ---- - src/bootstrap/config.rs | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs -index e192cda9a9a7..2b5d0b94e968 100644 ---- a/src/bootstrap/config.rs -+++ b/src/bootstrap/config.rs -@@ -1805,7 +1805,8 @@ pub fn check_build_rustc_version(&self) { - .unwrap(); - if !(source_version == rustc_version - || (source_version.major == rustc_version.major -- && source_version.minor == rustc_version.minor + 1)) -+ && (source_version.minor == rustc_version.minor -+ || source_version.minor == rustc_version.minor + 1))) - { - let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1); - eprintln!( --- -2.41.0 - diff --git a/rust.spec b/rust.spec index 5e96177..de93f40 100644 --- a/rust.spec +++ b/rust.spec @@ -8,9 +8,9 @@ # 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.70.0 -%global bootstrap_channel 1.70.0 -%global bootstrap_date 2023-06-01 +%global bootstrap_version 1.71.0 +%global bootstrap_channel 1.71.0 +%global bootstrap_date 2023-07-13 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -35,7 +35,8 @@ # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh # (updated per https://github.com/rust-lang/rust/pull/96907) %global wasi_libc_url https://github.com/WebAssembly/wasi-libc -%global wasi_libc_ref wasi-sdk-20 +#global wasi_libc_ref wasi-sdk-20 +%global wasi_libc_ref 7018e24d8fe248596819d2e884761676f3542a04 %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} @@ -83,7 +84,7 @@ %endif Name: rust -Version: 1.71.1 +Version: 1.72.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -114,8 +115,13 @@ Patch3: 0001-Let-environment-variables-override-some-default-CPUs.patch # https://github.com/rust-lang/rust/pull/114069 Patch4: 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch -# https://github.com/rust-lang/rust/pull/114440 -Patch5: 0001-bootstrap-config-fix-version-comparison-bug.patch +# Fix --no-fail-fast +# https://github.com/rust-lang/rust/pull/113214 +Patch5: 0001-Don-t-fail-early-if-try_run-returns-an-error.patch + +# The dist-src tarball doesn't include .github/ +# https://github.com/rust-lang/rust/pull/115109 +Patch6: 0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch ### RHEL-specific patches below ### @@ -123,11 +129,11 @@ Patch5: 0001-bootstrap-config-fix-version-comparison-bug.patch Source100: macros.rust-toolset # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.71.0-disable-libssh2.patch +Patch100: rustc-1.72.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.71.0-disable-http2.patch +Patch101: rustc-1.72.0-disable-http2.patch # Get the Rust triple for any arch. %{lua: function rust_triple(arch) @@ -593,6 +599,7 @@ test -f '%{local_rust_root}/bin/rustc' %patch -P3 -p1 %patch -P4 -p1 %patch -P5 -p1 +%patch -P6 -p1 %if %with disabled_libssh2 %patch -P100 -p1 @@ -1077,6 +1084,9 @@ end} %changelog +* Thu Aug 24 2023 Josh Stone - 1.72.0-1 +- Update to 1.72.0. + * Mon Aug 07 2023 Josh Stone - 1.71.1-1 - Update to 1.71.1. - Security fix for CVE-2023-38497 diff --git a/rustc-1.71.0-disable-http2.patch b/rustc-1.72.0-disable-http2.patch similarity index 77% rename from rustc-1.71.0-disable-http2.patch rename to rustc-1.72.0-disable-http2.patch index 34fdab3..db2213e 100644 --- a/rustc-1.71.0-disable-http2.patch +++ b/rustc-1.72.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-07-07 17:30:04.817452621 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-07-07 17:30:27.777988139 -0700 -@@ -734,7 +734,6 @@ +--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-08-21 11:00:15.341608892 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-08-21 11:00:46.074984901 -0700 +@@ -743,7 +743,6 @@ dependencies = [ "cc", "libc", @@ -8,8 +8,8 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -1954,16 +1953,6 @@ - checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +@@ -2011,16 +2010,6 @@ + checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] -name = "libnghttp2-sys" @@ -23,10 +23,10 @@ - -[[package]] name = "libz-sys" - version = "1.1.8" + version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-07-07 17:30:04.819452581 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-07-07 17:30:24.133061874 -0700 +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-08-21 11:00:15.341608892 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-08-21 11:00:15.342608871 -0700 @@ -118,7 +118,7 @@ cargo-util.workspace = true clap = { workspace = true, features = ["wrap_help"] } @@ -36,9 +36,9 @@ curl-sys.workspace = true env_logger.workspace = true filetime.workspace = true ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-06-24 10:27:37.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-07-07 17:30:04.819452581 -0700 -@@ -407,16 +407,9 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-08-17 20:58:39.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-08-21 11:00:15.343608851 -0700 +@@ -408,16 +408,9 @@ sources: SourceMap<'cfg>, config: &'cfg Config, ) -> CargoResult> { @@ -58,9 +58,9 @@ Ok(PackageSet { packages: package_ids ---- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-06-24 10:27:37.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-07-07 17:30:04.819452581 -0700 -@@ -229,16 +229,8 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-08-17 20:58:39.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-08-21 11:00:15.343608851 -0700 +@@ -250,16 +250,8 @@ } self.fetch_started = true; @@ -79,14 +79,14 @@ if !self.quiet { self.config ---- rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs.orig 2023-06-24 10:27:37.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs 2023-07-07 17:30:04.819452581 -0700 -@@ -26,7 +26,7 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs.orig 2023-08-21 11:00:15.343608851 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs 2023-08-21 11:02:01.969443986 -0700 +@@ -27,7 +27,7 @@ macro_rules! try_old_curl { ($e:expr, $msg:expr) => { let result = $e; - if cfg!(target_os = "macos") { + if cfg!(any(target_os = "linux", target_os = "macos")) { if let Err(e) = result { - warn!("ignoring libcurl {} error: {}", $msg, e); + ::log::warn!("ignoring libcurl {} error: {}", $msg, e); } diff --git a/rustc-1.71.0-disable-libssh2.patch b/rustc-1.72.0-disable-libssh2.patch similarity index 61% rename from rustc-1.71.0-disable-libssh2.patch rename to rustc-1.72.0-disable-libssh2.patch index ba61454..1198954 100644 --- a/rustc-1.71.0-disable-libssh2.patch +++ b/rustc-1.72.0-disable-libssh2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-06-24 10:27:37.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-07-07 17:12:23.406932870 -0700 -@@ -1942,7 +1942,6 @@ +--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-08-17 20:58:39.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-08-21 10:52:50.520622927 -0700 +@@ -1999,7 +1999,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -1965,20 +1964,6 @@ +@@ -2022,20 +2021,6 @@ ] [[package]] @@ -27,10 +27,10 @@ - -[[package]] name = "libz-sys" - version = "1.1.8" + version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-06-24 10:27:37.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-07-07 17:12:00.688392750 -0700 +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-08-21 10:49:34.852578202 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-08-21 10:52:11.858404449 -0700 @@ -31,7 +31,7 @@ filetime = "0.2.9" flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] } @@ -38,5 +38,5 @@ -git2 = "0.17.1" +git2 = { version = "0.17.1", default-features = false, features = ["https"] } git2-curl = "0.18.0" - gix = { version = "0.44.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] } - gix-features-for-configuration-only = { version = "0.29.0", package = "gix-features", features = [ "parallel" ] } + gix = { version = "0.45.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] } + gix-features-for-configuration-only = { version = "0.30.0", package = "gix-features", features = [ "parallel" ] } diff --git a/sources b/sources index 8a2c328..f37ba8d 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.71.1-src.tar.xz) = fd0e5a16bdbeb539184513583089e55f681cb772810df357b6b1464853f7022ac02edab3dd155b2262ed0047e2a25dea3808dd078dcdfce9d399384465009db4 -SHA512 (wasi-libc-wasi-sdk-20.tar.gz) = e264240dc7dbcf6398c8ca09bc108298f4a8aa955af22de5a3015fbcde81cb09dd83cd48349090082d5de0e8a3dbcf746c7b14657c67657b3f2f1ab28bb9cf05 +SHA512 (rustc-1.72.0-src.tar.xz) = aed27c1babfec7f9b0815bc395302cff4f8e8ed83d8d3bde202f6c86fba4aec14ad2d3e99f4e22618c6727d876262511bfbcd83513731ea4b9c664462c97945b +SHA512 (wasi-libc-7018e24d8fe248596819d2e884761676f3542a04.tar.gz) = a2a4a952c3d9795792be8f055387057befaebe0675ad2464a478cb1f2c45d65f233e0ee4c4dbcaa137bf9649882ff6c6acf2f2bec07b2ad89f63ff980d972e6b From b1db162b38d8b2e8d2aacb242bc3d3bd5b089768 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 19 Sep 2023 10:09:40 -0700 Subject: [PATCH 34/45] Update to 1.72.1. Migrated to SPDX license --- .gitignore | 1 + rust.spec | 12 ++++++++++-- sources | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 2961d88..59e2e5a 100644 --- a/.gitignore +++ b/.gitignore @@ -424,3 +424,4 @@ /rustc-1.71.1-src.tar.xz /rustc-1.72.0-src.tar.xz /wasi-libc-7018e24d8fe248596819d2e884761676f3542a04.tar.gz +/rustc-1.72.1-src.tar.xz diff --git a/rust.spec b/rust.spec index de93f40..b8c167b 100644 --- a/rust.spec +++ b/rust.spec @@ -84,10 +84,10 @@ %endif Name: rust -Version: 1.72.0 +Version: 1.72.1 Release: 1%{?dist} Summary: The Rust Programming Language -License: (ASL 2.0 or MIT) and (BSD and MIT) +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) URL: https://www.rust-lang.org ExclusiveArch: %{rust_arches} @@ -236,6 +236,10 @@ BuildRequires: cmake >= 2.8.11 %if 0%{?epel} == 7 %global llvm llvm14 %endif +# not ready for llvm-17 yet... +%if 0%{?fedora} >= 39 +%global llvm llvm16 +%endif %if %defined llvm %global llvm_root %{_libdir}/%{llvm} %else @@ -1084,6 +1088,10 @@ end} %changelog +* Tue Sep 19 2023 Josh Stone - 1.72.1-1 +- Update to 1.72.1. +- Migrated to SPDX license + * Thu Aug 24 2023 Josh Stone - 1.72.0-1 - Update to 1.72.0. diff --git a/sources b/sources index f37ba8d..efdcb58 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.72.0-src.tar.xz) = aed27c1babfec7f9b0815bc395302cff4f8e8ed83d8d3bde202f6c86fba4aec14ad2d3e99f4e22618c6727d876262511bfbcd83513731ea4b9c664462c97945b +SHA512 (rustc-1.72.1-src.tar.xz) = 08232b5bf36f82a995d67f3d03d5e35b7d8914d31fb4491d4c37b72a830bc438e9d18d9e138d398b1b6ae4aa09f7f8e1e9b68da6273ab74bdae4c6123586a21b SHA512 (wasi-libc-7018e24d8fe248596819d2e884761676f3542a04.tar.gz) = a2a4a952c3d9795792be8f055387057befaebe0675ad2464a478cb1f2c45d65f233e0ee4c4dbcaa137bf9649882ff6c6acf2f2bec07b2ad89f63ff980d972e6b From da52e5d316125c9dc65d0ab98ed01c84eed4de78 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 20 Sep 2023 14:17:19 -0400 Subject: [PATCH 35/45] Fix ELN build ELN (RHEL 10) tracks rawhide and currently also has llvm-17. --- rust.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust.spec b/rust.spec index b8c167b..f748f4d 100644 --- a/rust.spec +++ b/rust.spec @@ -85,7 +85,7 @@ Name: rust Version: 1.72.1 -Release: 1%{?dist} +Release: 2%{?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) @@ -237,7 +237,7 @@ BuildRequires: cmake >= 2.8.11 %global llvm llvm14 %endif # not ready for llvm-17 yet... -%if 0%{?fedora} >= 39 +%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10 %global llvm llvm16 %endif %if %defined llvm @@ -1088,6 +1088,9 @@ end} %changelog +* Mon Sep 25 2023 Josh Stone - 1.72.1-2 +- Fix LLVM dependency for ELN + * Tue Sep 19 2023 Josh Stone - 1.72.1-1 - Update to 1.72.1. - Migrated to SPDX license From 58662257c8186dc4b5f1a8d6d99946e88997e9b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 31 Aug 2023 16:08:44 +0100 Subject: [PATCH 36/45] add 'x86_64-unknown-none' build target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The coconut-svsm project which provides a low level firmware for AMD SEV-SNP virtual machines uses 'x86_64-unknown-none' as its build target and has recently removed the requirement to use rust nightly[1]. Thus adding 'x86_64-unknown-none' as a build target will enable us to build coconut-svsm in Fedora using the standard Rust toolchain packages. [1] https://github.com/coconut-svsm/svsm/pull/81 Signed-off-by: Daniel P. Berrangé --- rust.spec | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/rust.spec b/rust.spec index f748f4d..74fad24 100644 --- a/rust.spec +++ b/rust.spec @@ -29,6 +29,9 @@ %if 0%{?fedora} || 0%{?rhel} >= 8 %global wasm_targets wasm32-unknown-unknown wasm32-wasi %endif +%if 0%{?fedora} || 0%{?rhel} >= 10 +%global extra_targets x86_64-unknown-none +%endif %endif # We need CRT files for *-wasi targets, at least as new as the commit in @@ -428,6 +431,33 @@ end} %endif +%if %defined extra_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{extra_targets}"), "%S+") do + local subs = { + triple = triple, + name = rpm.expand("%{name}"), + verrel = rpm.expand("%{version}-%{release}"), + } + local s = string.gsub([[ + +%package std-static-{{triple}} +Summary: Standard library for Rust {{triple}} +BuildArch: noarch +Requires: {{name}} = {{verrel}} +Requires: lld >= 8.0 + +%description std-static-{{triple}} +This package includes the standard libraries for building applications +written in Rust for the embedded target {{triple}}. + +]], "{{(%w+)}}", subs) + print(s) + end +end} +%endif + + %package debugger-common Summary: Common debugger pretty printers for Rust BuildArch: noarch @@ -801,7 +831,7 @@ PROFILER=$(find %{_libdir}/clang -type f -name 'libclang_rt.profile-*.a') %{__python3} ./x.py build -j "$ncpus" %{__python3} ./x.py doc -for triple in %{?mingw_targets} %{?wasm_targets}; do +for triple in %{?mingw_targets} %{?wasm_targets} %{?extra_targets}; do %{__python3} ./x.py build --target=$triple std done @@ -813,7 +843,7 @@ done DESTDIR=%{buildroot} %{__python3} ./x.py install -for triple in %{?mingw_targets} %{?wasm_targets}; do +for triple in %{?mingw_targets} %{?wasm_targets} %{?extra_targets}; do DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std done @@ -1013,6 +1043,27 @@ end} end} %endif +%if %defined extra_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{extra_targets}"), "%S+") do + local subs = { + triple = triple, + rustlibdir = rpm.expand("%{rustlibdir}"), + } + local s = string.gsub([[ + +%files std-static-{{triple}} +%dir {{rustlibdir}} +%dir {{rustlibdir}}/{{triple}} +%dir {{rustlibdir}}/{{triple}}/lib +{{rustlibdir}}/{{triple}}/lib/*.rlib + +]], "{{(%w+)}}", subs) + print(s) + end +end} +%endif + %files debugger-common %dir %{rustlibdir} @@ -1090,6 +1141,7 @@ end} %changelog * Mon Sep 25 2023 Josh Stone - 1.72.1-2 - Fix LLVM dependency for ELN +- Add build target for x86_64-unknown-none * Tue Sep 19 2023 Josh Stone - 1.72.1-1 - Update to 1.72.1. From 9f66968c1064c19606b144b461a32a34fbc992c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 31 Aug 2023 16:08:44 +0100 Subject: [PATCH 37/45] add 'x86_64-unknown-uefi' build target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This target will facilitate the use of Rust in the UEFI environment Signed-off-by: Daniel P. Berrangé --- rust.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust.spec b/rust.spec index 74fad24..5b3a464 100644 --- a/rust.spec +++ b/rust.spec @@ -30,7 +30,7 @@ %global wasm_targets wasm32-unknown-unknown wasm32-wasi %endif %if 0%{?fedora} || 0%{?rhel} >= 10 -%global extra_targets x86_64-unknown-none +%global extra_targets x86_64-unknown-none x86_64-unknown-uefi %endif %endif @@ -1142,6 +1142,7 @@ end} * Mon Sep 25 2023 Josh Stone - 1.72.1-2 - Fix LLVM dependency for ELN - Add build target for x86_64-unknown-none +- Add build target for x86_64-unknown-uefi * Tue Sep 19 2023 Josh Stone - 1.72.1-1 - Update to 1.72.1. From b2411fce725d39b473c9464ed1ec7375e35f6bf8 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 25 Sep 2023 13:45:57 -0700 Subject: [PATCH 38/45] Drop noarch from embedded x86_64 targets and use lld --- ...-Use-lld-provided-by-system-for-wasm.patch | 26 ------------- 0001-Use-lld-provided-by-system.patch | 39 +++++++++++++++++++ rust.spec | 5 +-- 3 files changed, 41 insertions(+), 29 deletions(-) delete mode 100644 0001-Use-lld-provided-by-system-for-wasm.patch create mode 100644 0001-Use-lld-provided-by-system.patch diff --git a/0001-Use-lld-provided-by-system-for-wasm.patch b/0001-Use-lld-provided-by-system-for-wasm.patch deleted file mode 100644 index 5fcc245..0000000 --- a/0001-Use-lld-provided-by-system-for-wasm.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 37cb177eb53145103ae72b67562884782dde01c3 Mon Sep 17 00:00:00 2001 -From: Ivan Mironov -Date: Sun, 8 Dec 2019 17:23:08 +0500 -Subject: [PATCH] Use lld provided by system for wasm - ---- - compiler/rustc_target/src/spec/wasm_base.rs | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/compiler/rustc_target/src/spec/wasm_base.rs b/compiler/rustc_target/src/spec/wasm_base.rs -index 528a84a8b37c..353d742161d1 100644 ---- a/compiler/rustc_target/src/spec/wasm_base.rs -+++ b/compiler/rustc_target/src/spec/wasm_base.rs -@@ -89,8 +89,7 @@ macro_rules! args { - // arguments just yet - limit_rdylib_exports: false, - -- // we use the LLD shipped with the Rust toolchain by default -- linker: Some("rust-lld".into()), -+ linker: Some("lld".into()), - linker_flavor: LinkerFlavor::WasmLld(Cc::No), - - pre_link_args, --- -2.38.1 - diff --git a/0001-Use-lld-provided-by-system.patch b/0001-Use-lld-provided-by-system.patch new file mode 100644 index 0000000..2b22d48 --- /dev/null +++ b/0001-Use-lld-provided-by-system.patch @@ -0,0 +1,39 @@ +diff --git a/compiler/rustc_target/src/spec/wasm_base.rs b/compiler/rustc_target/src/spec/wasm_base.rs +index 341763aadbaf..ee6358e72955 100644 +--- a/compiler/rustc_target/src/spec/wasm_base.rs ++++ b/compiler/rustc_target/src/spec/wasm_base.rs +@@ -89,8 +89,7 @@ macro_rules! args { + // arguments just yet + limit_rdylib_exports: false, + +- // we use the LLD shipped with the Rust toolchain by default +- linker: Some("rust-lld".into()), ++ linker: Some("lld".into()), + linker_flavor: LinkerFlavor::WasmLld(Cc::No), + + pre_link_args, +diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/x86_64_unknown_none.rs +index fe3b24f2d4af..1f1731d202ca 100644 +--- a/compiler/rustc_target/src/spec/x86_64_unknown_none.rs ++++ b/compiler/rustc_target/src/spec/x86_64_unknown_none.rs +@@ -17,7 +17,7 @@ pub fn target() -> Target { + static_position_independent_executables: true, + relro_level: RelroLevel::Full, + linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), +- linker: Some("rust-lld".into()), ++ linker: Some("lld".into()), + features: + "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float" + .into(), +diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs +index 67664a74710a..53153cd120a3 100644 +--- a/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs ++++ b/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs +@@ -12,6 +12,7 @@ pub fn target() -> Target { + base.cpu = "x86-64".into(); + base.plt_by_default = false; + base.max_atomic_width = Some(64); ++ base.linker = Some("lld".into()); + + // We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to + // enable these CPU features explicitly before their first use, otherwise their instructions diff --git a/rust.spec b/rust.spec index 5b3a464..924d954 100644 --- a/rust.spec +++ b/rust.spec @@ -104,8 +104,8 @@ Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz Source1: %{wasi_libc_source} # Sources for bootstrap_arches are inserted by lua below -# By default, rust tries to use "rust-lld" as a linker for WebAssembly. -Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch +# By default, rust tries to use "rust-lld" as a linker for some targets. +Patch1: 0001-Use-lld-provided-by-system.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.70.0-rust-gdb-substitute-path.patch @@ -443,7 +443,6 @@ end} %package std-static-{{triple}} Summary: Standard library for Rust {{triple}} -BuildArch: noarch Requires: {{name}} = {{verrel}} Requires: lld >= 8.0 From 68e85e44284cecdbb00b5042b06a9d627d0d022b Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 26 Sep 2023 17:08:10 -0700 Subject: [PATCH 39/45] Simplify the target definitions --- rust.spec | 282 ++++++++++++++++++++---------------------------------- 1 file changed, 103 insertions(+), 179 deletions(-) diff --git a/rust.spec b/rust.spec index 924d954..25a37a7 100644 --- a/rust.spec +++ b/rust.spec @@ -33,6 +33,10 @@ %global extra_targets x86_64-unknown-none x86_64-unknown-uefi %endif %endif +%global all_targets %{?mingw_targets} %{?wasm_targets} %{?extra_targets} +%define target_enabled() %{lua: + print(string.find(rpm.expand(" %{all_targets} "), rpm.expand(" %1 "), 1, true) or 0) +} # 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 @@ -154,14 +158,12 @@ Patch101: rustc-1.72.0-disable-http2.patch return arch.."-unknown-linux-"..abi end} -# Get the environment form of a Rust triple -%{lua: function rust_triple_env(triple) - local sub = string.gsub(triple, "-", "_") - return string.upper(sub) -end} - %global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))} -%global rust_triple_env %{lua: print(rust_triple_env(rpm.expand("%{rust_triple}")))} + +# Get the environment form of the Rust triple +%global rust_triple_env %{lua: + print(string.upper(string.gsub(rpm.expand("%{rust_triple}"), "-", "_"))) +} %if %defined bootstrap_arches # For each bootstrap arch, add an additional binary Source. @@ -369,91 +371,63 @@ Requires: glibc-devel%{?_isa} >= 2.17 This package includes the standard libraries for building applications written in Rust. -%if %defined mingw_targets -%{lua: do - for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do - local subs = { - triple = triple, - name = rpm.expand("%{name}"), - verrel = rpm.expand("%{version}-%{release}"), - mingw = string.sub(triple, 1, 4) == "i686" and "mingw32" or "mingw64", - } - local s = string.gsub([[ +%global target_package() \ +%package std-static-%1 \ +Summary: Standard library for Rust %1 \ +Requires: %{name} = %{version}-%{release} -%package std-static-{{triple}} -Summary: Standard library for Rust {{triple}} +%global target_description() \ +%description std-static-%1 \ +This package includes the standard libraries for building applications \ +written in Rust for the %2 target %1. + +%if %target_enabled i686-pc-windows-gnu +%target_package i686-pc-windows-gnu +Requires: mingw32-crt +Requires: mingw32-gcc +Requires: mingw32-winpthreads-static +Provides: mingw32-rust = %{version}-%{release} +Provides: mingw32-rustc = %{version}-%{release} BuildArch: noarch -Provides: {{mingw}}-rust = {{verrel}} -Provides: {{mingw}}-rustc = {{verrel}} -Requires: {{mingw}}-crt -Requires: {{mingw}}-gcc -Requires: {{mingw}}-winpthreads-static -Requires: {{name}} = {{verrel}} - -%description std-static-{{triple}} -This package includes the standard libraries for building applications -written in Rust for the MinGW target {{triple}}. - -]], "{{(%w+)}}", subs) - print(s) - end -end} +%target_description i686-pc-windows-gnu MinGW %endif -%if %defined wasm_targets -%{lua: do - for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do - local subs = { - triple = triple, - name = rpm.expand("%{name}"), - verrel = rpm.expand("%{version}-%{release}"), - wasi = string.find(triple, "-wasi") and 1 or 0, - } - local s = string.gsub([[ - -%package std-static-{{triple}} -Summary: Standard library for Rust {{triple}} +%if %target_enabled x86_64-pc-windows-gnu +%target_package x86_64-pc-windows-gnu +Requires: mingw64-crt +Requires: mingw64-gcc +Requires: mingw64-winpthreads-static +Provides: mingw64-rust = %{version}-%{release} +Provides: mingw64-rustc = %{version}-%{release} BuildArch: noarch -Requires: {{name}} = {{verrel}} +%target_description x86_64-pc-windows-gnu MinGW +%endif + +%if %target_enabled wasm32-unknown-unknown +%target_package wasm32-unknown-unknown +Requires: lld >= 8.0 +BuildArch: noarch +%target_description wasm32-unknown-unknown WebAssembly +%endif + +%if %target_enabled wasm32-wasi +%target_package wasm32-wasi Requires: lld >= 8.0 -%if {{wasi}} Provides: bundled(wasi-libc) +BuildArch: noarch +%target_description wasm32-wasi WebAssembly %endif -%description std-static-{{triple}} -This package includes the standard libraries for building applications -written in Rust for the WebAssembly target {{triple}}. - -]], "{{(%w+)}}", subs) - print(s) - end -end} +%if %target_enabled x86_64-unknown-none +%target_package x86_64-unknown-none +Requires: lld +%target_description x86_64-unknown-none embedded %endif - -%if %defined extra_targets -%{lua: do - for triple in string.gmatch(rpm.expand("%{extra_targets}"), "%S+") do - local subs = { - triple = triple, - name = rpm.expand("%{name}"), - verrel = rpm.expand("%{version}-%{release}"), - } - local s = string.gsub([[ - -%package std-static-{{triple}} -Summary: Standard library for Rust {{triple}} -Requires: {{name}} = {{verrel}} -Requires: lld >= 8.0 - -%description std-static-{{triple}} -This package includes the standard libraries for building applications -written in Rust for the embedded target {{triple}}. - -]], "{{(%w+)}}", subs) - print(s) - end -end} +%if %target_enabled x86_64-unknown-uefi +%target_package x86_64-unknown-uefi +Requires: lld +%target_description x86_64-unknown-uefi embedded %endif @@ -705,7 +679,7 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' %endif # These are similar to __cflags_arch_* in /usr/lib/rpm/redhat/macros -%{lua: function rustc_target_cpus() +%global rustc_target_cpus %{lua: do local fedora = tonumber(rpm.expand("0%{?fedora}")) local rhel = tonumber(rpm.expand("0%{?rhel}")) local env = @@ -714,11 +688,11 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' .. " RUSTC_TARGET_CPU_S390X=" .. ((rhel >= 9) and "z14" or (rhel == 8 or fedora >= 38) and "z13" or (fedora >= 26) and "zEC12" or (rhel == 7) and "z196" or "z10") - return env + print(env) end} # Set up shared environment variables for build/install/check -%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} %{lua: print(rustc_target_cpus())} +%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} %{rustc_target_cpus} %if %defined cmake_path %global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH" %endif @@ -754,38 +728,21 @@ if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then fi %if %defined mingw_targets -%{lua: do - local cfg = "" - for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do - local subs = { - triple = triple, - mingw = string.sub(triple, 1, 4) == "i686" and "mingw32" or "mingw64", - } - local s = string.gsub([[ - --set target.{{triple}}.linker=%{{{mingw}}_cc} - --set target.{{triple}}.cc=%{{{mingw}}_cc} - --set target.{{triple}}.ar=%{{{mingw}}_ar} - --set target.{{triple}}.ranlib=%{{{mingw}}_ranlib} - ]], "{{(%w+)}}", subs) - cfg = cfg .. " " .. s - end - cfg = string.gsub(cfg, "%s+", " ") - rpm.define("mingw_target_config " .. cfg) -end} +%define mingw_target_config %{shrink: + --set target.i686-pc-windows-gnu.linker=%{mingw32_cc} + --set target.i686-pc-windows-gnu.cc=%{mingw32_cc} + --set target.i686-pc-windows-gnu.ar=%{mingw32_ar} + --set target.i686-pc-windows-gnu.ranlib=%{mingw32_ranlib} + --set target.x86_64-pc-windows-gnu.linker=%{mingw64_cc} + --set target.x86_64-pc-windows-gnu.cc=%{mingw64_cc} + --set target.x86_64-pc-windows-gnu.ar=%{mingw64_ar} + --set target.x86_64-pc-windows-gnu.ranlib=%{mingw64_ranlib} +} %endif %if %defined wasm_targets %make_build --quiet -C %{wasi_libc_dir} CC=clang AR=llvm-ar NM=llvm-nm -%{lua: do - local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot" - local cfg = "" - for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do - if string.find(triple, "-wasi") then - cfg = cfg .. " --set target." .. triple .. ".wasi-root=" .. wasi_root - end - end - rpm.define("wasm_target_config "..cfg) -end} +%define wasm_target_config --set target.wasm32-wasi.wasi-root=%{wasi_libc_dir}/sysroot %endif %if 0%{?fedora} || 0%{?rhel} >= 8 @@ -830,7 +787,7 @@ PROFILER=$(find %{_libdir}/clang -type f -name 'libclang_rt.profile-*.a') %{__python3} ./x.py build -j "$ncpus" %{__python3} ./x.py doc -for triple in %{?mingw_targets} %{?wasm_targets} %{?extra_targets}; do +for triple in %{?all_targets} ; do %{__python3} ./x.py build --target=$triple std done @@ -842,7 +799,7 @@ done DESTDIR=%{buildroot} %{__python3} ./x.py install -for triple in %{?mingw_targets} %{?wasm_targets} %{?extra_targets}; do +for triple in %{?all_targets} ; do DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std done @@ -939,7 +896,7 @@ env RUSTC=%{buildroot}%{_bindir}/rustc \ LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ %{buildroot}%{_bindir}/cargo run --manifest-path build/hello-world/Cargo.toml -# Try a build sanity-check for other targets +# Try a build sanity-check for other std-enabled targets for triple in %{?mingw_targets} %{?wasm_targets}; do env RUSTC=%{buildroot}%{_bindir}/rustc \ LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ @@ -988,79 +945,46 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %dir %{rustlibdir}/%{rust_triple}/lib %{rustlibdir}/%{rust_triple}/lib/*.rlib +%global target_files() \ +%files std-static-%1 \ +%dir %{rustlibdir} \ +%dir %{rustlibdir}/%1 \ +%dir %{rustlibdir}/%1/lib \ +%{rustlibdir}/%1/lib/*.rlib -%if %defined mingw_targets -%{lua: do - for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do - local subs = { - triple = triple, - rustlibdir = rpm.expand("%{rustlibdir}"), - } - local s = string.gsub([[ - -%files std-static-{{triple}} -%dir {{rustlibdir}} -%dir {{rustlibdir}}/{{triple}} -%dir {{rustlibdir}}/{{triple}}/lib -{{rustlibdir}}/{{triple}}/lib/*.rlib -{{rustlibdir}}/{{triple}}/lib/rs*.o -%exclude {{rustlibdir}}/{{triple}}/lib/*.dll -%exclude {{rustlibdir}}/{{triple}}/lib/*.dll.a -%exclude {{rustlibdir}}/{{triple}}/lib/self-contained - -]], "{{(%w+)}}", subs) - print(s) - end -end} +%if %target_enabled i686-pc-windows-gnu +%target_files i686-pc-windows-gnu +%{rustlibdir}/i686-pc-windows-gnu/lib/rs*.o +%exclude %{rustlibdir}/i686-pc-windows-gnu/lib/*.dll +%exclude %{rustlibdir}/i686-pc-windows-gnu/lib/*.dll.a +%exclude %{rustlibdir}/i686-pc-windows-gnu/lib/self-contained %endif - -%if %defined wasm_targets -%{lua: do - for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do - local subs = { - triple = triple, - rustlibdir = rpm.expand("%{rustlibdir}"), - wasi = string.find(triple, "-wasi") and 1 or 0, - } - local s = string.gsub([[ - -%files std-static-{{triple}} -%dir {{rustlibdir}} -%dir {{rustlibdir}}/{{triple}} -%dir {{rustlibdir}}/{{triple}}/lib -{{rustlibdir}}/{{triple}}/lib/*.rlib -%if {{wasi}} -%dir {{rustlibdir}}/{{triple}}/lib/self-contained -{{rustlibdir}}/{{triple}}/lib/self-contained/crt*.o -{{rustlibdir}}/{{triple}}/lib/self-contained/libc.a +%if %target_enabled x86_64-pc-windows-gnu +%target_files x86_64-pc-windows-gnu +%{rustlibdir}/x86_64-pc-windows-gnu/lib/rs*.o +%exclude %{rustlibdir}/x86_64-pc-windows-gnu/lib/*.dll +%exclude %{rustlibdir}/x86_64-pc-windows-gnu/lib/*.dll.a +%exclude %{rustlibdir}/x86_64-pc-windows-gnu/lib/self-contained %endif -]], "{{(%w+)}}", subs) - print(s) - end -end} +%if %target_enabled wasm32-unknown-unknown +%target_files wasm32-unknown-unknown %endif -%if %defined extra_targets -%{lua: do - for triple in string.gmatch(rpm.expand("%{extra_targets}"), "%S+") do - local subs = { - triple = triple, - rustlibdir = rpm.expand("%{rustlibdir}"), - } - local s = string.gsub([[ +%if %target_enabled wasm32-wasi +%target_files wasm32-wasi +%dir %{rustlibdir}/wasm32-wasi/lib/self-contained +%{rustlibdir}/wasm32-wasi/lib/self-contained/crt*.o +%{rustlibdir}/wasm32-wasi/lib/self-contained/libc.a +%endif -%files std-static-{{triple}} -%dir {{rustlibdir}} -%dir {{rustlibdir}}/{{triple}} -%dir {{rustlibdir}}/{{triple}}/lib -{{rustlibdir}}/{{triple}}/lib/*.rlib +%if %target_enabled x86_64-unknown-none +%target_files x86_64-unknown-none +%endif -]], "{{(%w+)}}", subs) - print(s) - end -end} +%if %target_enabled x86_64-unknown-uefi +%target_files x86_64-unknown-uefi %endif From 938db5293e8142bd1a38e5f0dcb18c9ae174c77c Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 27 Sep 2023 11:17:12 -0700 Subject: [PATCH 40/45] Fix the profiler runtime with compiler-rt-17 --- rust.spec | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/rust.spec b/rust.spec index 25a37a7..1a49ee4 100644 --- a/rust.spec +++ b/rust.spec @@ -92,7 +92,7 @@ Name: rust Version: 1.72.1 -Release: 2%{?dist} +Release: 3%{?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) @@ -746,9 +746,14 @@ fi %endif %if 0%{?fedora} || 0%{?rhel} >= 8 -# The exact profiler path is version dependent, and uses LLVM-specific -# arch names in the filename, but this find is good enough for now... -PROFILER=$(find %{_libdir}/clang -type f -name 'libclang_rt.profile-*.a') +# Find the compiler-rt library for the Rust profiler_builtins crate. +%if 0%{?clang_major_version} >= 17 +PROFILER='%{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a' +%else +# The exact profiler path is version dependent.. +PROFILER=$(echo %{_libdir}/clang/*/lib/libclang_rt.profile-%{_arch}.a) +%endif +test -r "$PROFILER" %endif %configure --disable-option-checking \ @@ -892,16 +897,23 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* # Sanity-check the installed binaries, debuginfo-stripped and all. %{buildroot}%{_bindir}/cargo new build/hello-world -env RUSTC=%{buildroot}%{_bindir}/rustc \ - LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ - %{buildroot}%{_bindir}/cargo run --manifest-path build/hello-world/Cargo.toml +( + cd build/hello-world + export RUSTC=%{buildroot}%{_bindir}/rustc \ + LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" + %{buildroot}%{_bindir}/cargo run --verbose -# Try a build sanity-check for other std-enabled targets -for triple in %{?mingw_targets} %{?wasm_targets}; do - env RUSTC=%{buildroot}%{_bindir}/rustc \ - LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ - %{buildroot}%{_bindir}/cargo build --manifest-path build/hello-world/Cargo.toml --target=$triple -done +%if 0%{?fedora} || 0%{?rhel} >= 8 + # Sanity-check that code-coverage builds and runs + env RUSTFLAGS="-Cinstrument-coverage" %{buildroot}%{_bindir}/cargo run --verbose + test -r default_*.profraw +%endif + + # Try a build sanity-check for other std-enabled targets + for triple in %{?mingw_targets} %{?wasm_targets}; do + %{buildroot}%{_bindir}/cargo build --verbose --target=$triple + done +) # 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. @@ -1062,6 +1074,9 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %changelog +* Wed Sep 27 2023 Josh Stone - 1.72.1-3 +- Fix the profiler runtime with compiler-rt-17 + * Mon Sep 25 2023 Josh Stone - 1.72.1-2 - Fix LLVM dependency for ELN - Add build target for x86_64-unknown-none From fbe7f8404be27dd136884bdccedbc86771ac714c Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 29 Sep 2023 14:56:44 -0700 Subject: [PATCH 41/45] Switch to unbundled wasi-libc on Fedora Also, use emmalloc instead of CC0 dlmalloc when bundling wasi-libc. --- .gitignore | 1 + ...llow-disabling-target-self-contained.patch | 102 ++++++++++++++++++ ...-round-up-the-size-for-aligned_alloc.patch | 33 ++++++ ...xternal-library-path-for-wasm32-wasi.patch | 78 ++++++++++++++ rust.spec | 58 ++++++++-- sources | 2 +- 6 files changed, 264 insertions(+), 10 deletions(-) create mode 100644 0001-bootstrap-allow-disabling-target-self-contained.patch create mode 100644 0001-wasi-round-up-the-size-for-aligned_alloc.patch create mode 100644 0002-set-an-external-library-path-for-wasm32-wasi.patch diff --git a/.gitignore b/.gitignore index 59e2e5a..3e84863 100644 --- a/.gitignore +++ b/.gitignore @@ -425,3 +425,4 @@ /rustc-1.72.0-src.tar.xz /wasi-libc-7018e24d8fe248596819d2e884761676f3542a04.tar.gz /rustc-1.72.1-src.tar.xz +/wasi-libc-bd950eb128bff337153de217b11270f948d04bb4.tar.gz diff --git a/0001-bootstrap-allow-disabling-target-self-contained.patch b/0001-bootstrap-allow-disabling-target-self-contained.patch new file mode 100644 index 0000000..d499588 --- /dev/null +++ b/0001-bootstrap-allow-disabling-target-self-contained.patch @@ -0,0 +1,102 @@ +From 19c37083cdae94105f6429350dd0b6617e3c2d56 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 + +--- + config.example.toml | 5 +++++ + src/bootstrap/compile.rs | 4 ++++ + src/bootstrap/config.rs | 8 ++++++++ + src/bootstrap/lib.rs | 5 +++++ + 4 files changed, 22 insertions(+) + +diff --git a/config.example.toml b/config.example.toml +index 0c65b25fe138..6a0f1c01c328 100644 +--- a/config.example.toml ++++ b/config.example.toml +@@ -789,6 +789,11 @@ changelog-seen = 2 + # target triples containing `-none`, `nvptx`, `switch`, or `-uefi`. + #no-std = (bool) + ++# Copy libc and CRT objects into the target lib/self-contained/ directory. ++# Enabled by default on `musl`, `wasi`, and `windows-gnu` targets. Other ++# targets may ignore this setting if they have nothing to be contained. ++#self-contained = (bool) ++ + # ============================================================================= + # Distribution options + # +diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs +index 14c3ef79a78f..7adbf091acbb 100644 +--- a/src/bootstrap/compile.rs ++++ b/src/bootstrap/compile.rs +@@ -263,6 +263,10 @@ fn copy_self_contained_objects( + compiler: &Compiler, + target: TargetSelection, + ) -> Vec<(PathBuf, DependencyType)> { ++ if builder.self_contained(target) != Some(true) { ++ return vec![]; ++ } ++ + let libdir_self_contained = builder.sysroot_libdir(*compiler, target).join("self-contained"); + t!(fs::create_dir_all(&libdir_self_contained)); + let mut target_deps = vec![]; +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs +index fe932fd6bd30..a626badc3e8a 100644 +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -541,6 +541,7 @@ pub struct Target { + pub wasi_root: Option, + pub qemu_rootfs: Option, + pub no_std: bool, ++ pub self_contained: bool, + } + + impl Target { +@@ -553,6 +554,9 @@ pub fn from_triple(triple: &str) -> Self { + { + target.no_std = true; + } ++ if triple.contains("-musl") || triple.contains("-wasi") || triple.contains("-windows-gnu") { ++ target.self_contained = true; ++ } + target + } + } +@@ -999,6 +1003,7 @@ struct TomlTarget { + wasi_root: Option = "wasi-root", + qemu_rootfs: Option = "qemu-rootfs", + no_std: Option = "no-std", ++ self_contained: Option = "self-contained", + } + } + +@@ -1524,6 +1529,9 @@ fn get_table(option: &str) -> Result { + if let Some(s) = cfg.no_std { + target.no_std = s; + } ++ if let Some(s) = cfg.self_contained { ++ target.self_contained = s; ++ } + target.cc = cfg.cc.map(PathBuf::from).or_else(|| { + target.ndk.as_ref().map(|ndk| ndk_compiler(Language::C, &triple, ndk)) + }); +diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs +index 0a7aff62257a..9b7c18a3353f 100644 +--- a/src/bootstrap/lib.rs ++++ b/src/bootstrap/lib.rs +@@ -1285,6 +1285,11 @@ fn no_std(&self, target: TargetSelection) -> Option { + self.config.target_config.get(&target).map(|t| t.no_std) + } + ++ /// Returns `true` if this is a self-contained `target`, if defined ++ fn self_contained(&self, target: TargetSelection) -> Option { ++ self.config.target_config.get(&target).map(|t| t.self_contained) ++ } ++ + /// Returns `true` if the target will be tested using the `remote-test-client` + /// and `remote-test-server` binaries. + fn remote_tested(&self, target: TargetSelection) -> bool { +-- +2.41.0 + diff --git a/0001-wasi-round-up-the-size-for-aligned_alloc.patch b/0001-wasi-round-up-the-size-for-aligned_alloc.patch new file mode 100644 index 0000000..7fbe950 --- /dev/null +++ b/0001-wasi-round-up-the-size-for-aligned_alloc.patch @@ -0,0 +1,33 @@ +From 1c6d867d78475fd8c6274e2b64ebb27735b6cabf Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Sat, 26 Aug 2023 11:50:16 -0700 +Subject: [PATCH] wasi: round up the size for `aligned_alloc` + +C11 `aligned_alloc` requires that the size be a multiple of the +alignment. This is enforced in the wasi-libc emmalloc implementation, +which always returns NULL if the size is not a multiple. +(The default `MALLOC_IMPL=dlmalloc` does not currently check this.) +--- + library/std/src/sys/unix/alloc.rs | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/library/std/src/sys/unix/alloc.rs b/library/std/src/sys/unix/alloc.rs +index 8604b53983d6..af0089978ecb 100644 +--- a/library/std/src/sys/unix/alloc.rs ++++ b/library/std/src/sys/unix/alloc.rs +@@ -86,7 +86,11 @@ unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { + } else if #[cfg(target_os = "wasi")] { + #[inline] + unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { +- libc::aligned_alloc(layout.align(), layout.size()) as *mut u8 ++ // C11 aligned_alloc requires that the size be a multiple of the alignment. ++ // Layout already checks that the size rounded up doesn't overflow isize::MAX. ++ let align = layout.align(); ++ let size = layout.size().next_multiple_of(align); ++ libc::aligned_alloc(align, size) as *mut u8 + } + } else { + #[inline] +-- +2.41.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 new file mode 100644 index 0000000..e60433a --- /dev/null +++ b/0002-set-an-external-library-path-for-wasm32-wasi.patch @@ -0,0 +1,78 @@ +From 3016b2b7052d8b01d50c3a3c6591aeb99d918ca3 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 | 2 ++ + compiler/rustc_target/src/spec/wasm32_wasi.rs | 6 +++++- + 3 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs +index b603a8787460..40d878b64479 100644 +--- a/compiler/rustc_codegen_ssa/src/back/link.rs ++++ b/compiler/rustc_codegen_ssa/src/back/link.rs +@@ -1475,6 +1475,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat + return file_path; + } + } ++ if let Some(lib_path) = &sess.target.options.external_lib_path { ++ let file_path = Path::new(lib_path.as_ref()).join(name); ++ if file_path.exists() { ++ return file_path; ++ } ++ } + for search_path in fs.search_paths() { + let file_path = search_path.dir.join(name); + if file_path.exists() { +@@ -1967,6 +1973,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)); + } ++ if let Some(lib_path) = &sess.target.options.external_lib_path { ++ cmd.include_path(Path::new(lib_path.as_ref())); ++ } + } + + /// 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 2365dfaf1af8..35f3a686cf67 100644 +--- a/compiler/rustc_target/src/spec/mod.rs ++++ b/compiler/rustc_target/src/spec/mod.rs +@@ -1653,6 +1653,7 @@ pub struct TargetOptions { + /// Objects to link before and after all other object code. + pub pre_link_objects: CrtObjects, + pub post_link_objects: CrtObjects, ++ pub external_lib_path: Option>, + /// 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, +@@ -2124,6 +2125,7 @@ fn default() -> TargetOptions { + relro_level: RelroLevel::None, + pre_link_objects: Default::default(), + post_link_objects: Default::default(), ++ external_lib_path: None, + pre_link_objects_self_contained: Default::default(), + post_link_objects_self_contained: Default::default(), + link_self_contained: LinkSelfContainedDefault::False, +diff --git a/compiler/rustc_target/src/spec/wasm32_wasi.rs b/compiler/rustc_target/src/spec/wasm32_wasi.rs +index a0476d542e64..ad7160bf5fcd 100644 +--- a/compiler/rustc_target/src/spec/wasm32_wasi.rs ++++ b/compiler/rustc_target/src/spec/wasm32_wasi.rs +@@ -85,7 +85,11 @@ pub fn target() -> Target { + options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained(); + + // FIXME: Figure out cases in which WASM needs to link with a native toolchain. +- options.link_self_contained = LinkSelfContainedDefault::True; ++ options.link_self_contained = LinkSelfContainedDefault::False; ++ ++ options.pre_link_objects = options.pre_link_objects_self_contained.clone(); ++ options.post_link_objects = options.post_link_objects_self_contained.clone(); ++ options.external_lib_path = Some("/usr/wasm32-wasi/lib/wasm32-wasi".into()); + + // Right now this is a bit of a workaround but we're currently saying that + // the target by default has a static crt which we're taking as a signal +-- +2.41.0 + diff --git a/rust.spec b/rust.spec index 1a49ee4..003be5a 100644 --- a/rust.spec +++ b/rust.spec @@ -43,10 +43,15 @@ # (updated per https://github.com/rust-lang/rust/pull/96907) %global wasi_libc_url https://github.com/WebAssembly/wasi-libc #global wasi_libc_ref wasi-sdk-20 -%global wasi_libc_ref 7018e24d8fe248596819d2e884761676f3542a04 +%global wasi_libc_ref bd950eb128bff337153de217b11270f948d04bb4 %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} +%if 0%{?fedora} +%bcond_with bundled_wasi_libc +%else +%bcond_without bundled_wasi_libc +%endif # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. %bcond_with llvm_static @@ -118,17 +123,27 @@ Patch2: rustc-1.70.0-rust-gdb-substitute-path.patch # TODO: upstream this ability into the actual build configuration Patch3: 0001-Let-environment-variables-override-some-default-CPUs.patch +# Override the default self-contained system libraries +# TODO: the first can probably be upstreamed, but the second is hard-coded, +# and we're only applying that if not with bundled_wasi_libc. +Patch4: 0001-bootstrap-allow-disabling-target-self-contained.patch +Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch + # Enable the profiler runtime for native hosts # https://github.com/rust-lang/rust/pull/114069 -Patch4: 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch +Patch6: 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch # Fix --no-fail-fast # https://github.com/rust-lang/rust/pull/113214 -Patch5: 0001-Don-t-fail-early-if-try_run-returns-an-error.patch +Patch7: 0001-Don-t-fail-early-if-try_run-returns-an-error.patch # The dist-src tarball doesn't include .github/ # https://github.com/rust-lang/rust/pull/115109 -Patch6: 0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch +Patch8: 0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch + +# wasi: round up the size for aligned_alloc +# https://github.com/rust-lang/rust/pull/115254 +Patch9: 0001-wasi-round-up-the-size-for-aligned_alloc.patch ### RHEL-specific patches below ### @@ -336,7 +351,11 @@ BuildRequires: mingw64-winpthreads-static %endif %if %defined wasm_targets +%if %with bundled_wasi_libc BuildRequires: clang +%else +BuildRequires: wasi-libc-static +%endif BuildRequires: lld # brp-strip-static-archive breaks the archive index for wasm %global __os_install_post \ @@ -413,7 +432,11 @@ BuildArch: noarch %if %target_enabled wasm32-wasi %target_package wasm32-wasi Requires: lld >= 8.0 +%if %with bundled_wasi_libc Provides: bundled(wasi-libc) +%else +Requires: wasi-libc-static +%endif BuildArch: noarch %target_description wasm32-wasi WebAssembly %endif @@ -595,8 +618,9 @@ test -f '%{local_rust_root}/bin/cargo' test -f '%{local_rust_root}/bin/rustc' %endif -%if %defined wasm_targets +%if %{defined wasm_targets} && %{with bundled_wasi_libc} %setup -q -n %{wasi_libc_name} -T -b 1 +rm -rf %{wasi_libc_dir}/dlmalloc/ %endif %setup -q -n %{rustc_package} @@ -605,8 +629,13 @@ test -f '%{local_rust_root}/bin/rustc' %patch -P2 -p1 %patch -P3 -p1 %patch -P4 -p1 +%if %without bundled_wasi_libc %patch -P5 -p1 +%endif %patch -P6 -p1 +%patch -P7 -p1 +%patch -P8 -p1 +%patch -P9 -p1 %if %with disabled_libssh2 %patch -P100 -p1 @@ -733,16 +762,25 @@ fi --set target.i686-pc-windows-gnu.cc=%{mingw32_cc} --set target.i686-pc-windows-gnu.ar=%{mingw32_ar} --set target.i686-pc-windows-gnu.ranlib=%{mingw32_ranlib} + --set target.i686-pc-windows-gnu.self-contained=false --set target.x86_64-pc-windows-gnu.linker=%{mingw64_cc} --set target.x86_64-pc-windows-gnu.cc=%{mingw64_cc} --set target.x86_64-pc-windows-gnu.ar=%{mingw64_ar} --set target.x86_64-pc-windows-gnu.ranlib=%{mingw64_ranlib} + --set target.x86_64-pc-windows-gnu.self-contained=false } %endif %if %defined wasm_targets -%make_build --quiet -C %{wasi_libc_dir} CC=clang AR=llvm-ar NM=llvm-nm +%if %with bundled_wasi_libc +%make_build --quiet -C %{wasi_libc_dir} MALLOC_IMPL=emmalloc CC=clang AR=llvm-ar NM=llvm-nm %define wasm_target_config --set target.wasm32-wasi.wasi-root=%{wasi_libc_dir}/sysroot +%else +%define wasm_target_config %{shrink: + --set target.wasm32-wasi.wasi-root=%{_prefix}/wasm32-wasi + --set target.wasm32-wasi.self-contained=false +} +%endif %endif %if 0%{?fedora} || 0%{?rhel} >= 8 @@ -969,7 +1007,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %{rustlibdir}/i686-pc-windows-gnu/lib/rs*.o %exclude %{rustlibdir}/i686-pc-windows-gnu/lib/*.dll %exclude %{rustlibdir}/i686-pc-windows-gnu/lib/*.dll.a -%exclude %{rustlibdir}/i686-pc-windows-gnu/lib/self-contained %endif %if %target_enabled x86_64-pc-windows-gnu @@ -977,7 +1014,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %{rustlibdir}/x86_64-pc-windows-gnu/lib/rs*.o %exclude %{rustlibdir}/x86_64-pc-windows-gnu/lib/*.dll %exclude %{rustlibdir}/x86_64-pc-windows-gnu/lib/*.dll.a -%exclude %{rustlibdir}/x86_64-pc-windows-gnu/lib/self-contained %endif %if %target_enabled wasm32-unknown-unknown @@ -986,10 +1022,12 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %if %target_enabled wasm32-wasi %target_files wasm32-wasi +%if %with bundled_wasi_libc %dir %{rustlibdir}/wasm32-wasi/lib/self-contained %{rustlibdir}/wasm32-wasi/lib/self-contained/crt*.o %{rustlibdir}/wasm32-wasi/lib/self-contained/libc.a %endif +%endif %if %target_enabled x86_64-unknown-none %target_files x86_64-unknown-none @@ -1074,8 +1112,10 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %changelog -* Wed Sep 27 2023 Josh Stone - 1.72.1-3 +* Fri Sep 29 2023 Josh Stone - 1.72.1-3 - Fix the profiler runtime with compiler-rt-17 +- Switch to unbundled wasi-libc on Fedora +- Use emmalloc instead of CC0 dlmalloc when bundling wasi-libc * Mon Sep 25 2023 Josh Stone - 1.72.1-2 - Fix LLVM dependency for ELN diff --git a/sources b/sources index efdcb58..c0c8375 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ SHA512 (rustc-1.72.1-src.tar.xz) = 08232b5bf36f82a995d67f3d03d5e35b7d8914d31fb4491d4c37b72a830bc438e9d18d9e138d398b1b6ae4aa09f7f8e1e9b68da6273ab74bdae4c6123586a21b -SHA512 (wasi-libc-7018e24d8fe248596819d2e884761676f3542a04.tar.gz) = a2a4a952c3d9795792be8f055387057befaebe0675ad2464a478cb1f2c45d65f233e0ee4c4dbcaa137bf9649882ff6c6acf2f2bec07b2ad89f63ff980d972e6b +SHA512 (wasi-libc-bd950eb128bff337153de217b11270f948d04bb4.tar.gz) = 01e5cc3ebdab239f57816ff80f939fd87a5491a28951daf74b3310b118b4820c098ac9417771c9c6af55ca91d2cabe6498975ab9db4914aba754d87067cd1066 From afbd2cf0c42e70f5dc6187a73458b2f5c5109cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 4 Oct 2023 10:50:58 +0100 Subject: [PATCH 42/45] ensure rustfmt pulls in exact matching rust evr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /usr/bin/rustfmt is linking to an internal rust library and this results in load errors if rustfmt and rust are at different evrs: $ rustfmt rustfmt: error while loading shared libraries: librustc_driver-69c69b1255476b63.so: cannot open shared object file: No such file or directory $ rpm -q rust rustfmt rust-1.72.0-1.fc38.x86_64 rustfmt-1.72.1-1.fc38.x86_64 Signed-off-by: Daniel P. Berrangé --- rust.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust.spec b/rust.spec index 003be5a..67c25ad 100644 --- a/rust.spec +++ b/rust.spec @@ -531,6 +531,9 @@ and ensure that you'll always get a repeatable build. Summary: Tool to find and fix Rust formatting issues Requires: cargo +# /usr/bin/rustfmt is dynamically linked against internal rustc libs +Requires: %{name}%{?_isa} = %{version}-%{release} + # The component/package was rustfmt-preview until Rust 1.31. Obsoletes: rustfmt-preview < 1.0.0 Provides: rustfmt-preview = %{version}-%{release} From 0b6ffb1d4ac83753c9d75a687ff799fa044a7d80 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 5 Oct 2023 09:24:56 -0700 Subject: [PATCH 43/45] Update to 1.73.0. Drop el7 conditionals from the spec. --- .gitignore | 1 + ...rnal-builds-of-the-compiler-rt-profi.patch | 142 ------------- ...il-early-if-try_run-returns-an-error.patch | 201 ------------------ ...mlAnchors-when-the-config-is-missing.patch | 12 +- rust.spec | 118 ++-------- rustc-1.72.0-disable-http2.patch | 92 -------- ...atch => rustc-1.73.0-disable-libssh2.patch | 22 +- sources | 2 +- 8 files changed, 38 insertions(+), 552 deletions(-) delete mode 100644 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch delete mode 100644 0001-Don-t-fail-early-if-try_run-returns-an-error.patch delete mode 100644 rustc-1.72.0-disable-http2.patch rename rustc-1.72.0-disable-libssh2.patch => rustc-1.73.0-disable-libssh2.patch (58%) diff --git a/.gitignore b/.gitignore index 3e84863..83aeea4 100644 --- a/.gitignore +++ b/.gitignore @@ -426,3 +426,4 @@ /wasi-libc-7018e24d8fe248596819d2e884761676f3542a04.tar.gz /rustc-1.72.1-src.tar.xz /wasi-libc-bd950eb128bff337153de217b11270f948d04bb4.tar.gz +/rustc-1.73.0-src.tar.xz diff --git a/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch b/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch deleted file mode 100644 index 01f7847..0000000 --- a/0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch +++ /dev/null @@ -1,142 +0,0 @@ -From e276ae1cb702fa830be126cccce4bb9e8676f9fb Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Tue, 25 Jul 2023 13:11:50 -0700 -Subject: [PATCH] Allow using external builds of the compiler-rt profile lib - -This changes the bootstrap config `target.*.profiler` from a plain bool -to also allow a string, which will be used as a path to the pre-built -profiling runtime for that target. Then `profiler_builtins/build.rs` -reads that in a `LLVM_PROFILER_RT_LIB` environment variable. ---- - config.example.toml | 6 ++++-- - library/profiler_builtins/build.rs | 6 ++++++ - src/bootstrap/compile.rs | 4 ++++ - src/bootstrap/config.rs | 30 ++++++++++++++++++++++++------ - 4 files changed, 38 insertions(+), 8 deletions(-) - -diff --git a/config.example.toml b/config.example.toml -index 0c65b25fe138..249847013259 100644 ---- a/config.example.toml -+++ b/config.example.toml -@@ -752,8 +752,10 @@ changelog-seen = 2 - # This option will override the same option under [build] section. - #sanitizers = build.sanitizers (bool) - --# Build the profiler runtime for this target(required when compiling with options that depend --# on this runtime, such as `-C profile-generate` or `-C instrument-coverage`). -+# When true, build the profiler runtime for this target(required when compiling -+# with options that depend on this runtime, such as `-C profile-generate` or -+# `-C instrument-coverage`). This may also be given a path to an existing build -+# of the profiling runtime library from LLVM's compiler-rt. - # This option will override the same option under [build] section. - #profiler = build.profiler (bool) - -diff --git a/library/profiler_builtins/build.rs b/library/profiler_builtins/build.rs -index 1b1f11798d74..d14d0b82229a 100644 ---- a/library/profiler_builtins/build.rs -+++ b/library/profiler_builtins/build.rs -@@ -6,6 +6,12 @@ - use std::path::Path; - - fn main() { -+ println!("cargo:rerun-if-env-changed=LLVM_PROFILER_RT_LIB"); -+ if let Ok(rt) = env::var("LLVM_PROFILER_RT_LIB") { -+ println!("cargo:rustc-link-lib=static:+verbatim={rt}"); -+ return; -+ } -+ - let target = env::var("TARGET").expect("TARGET was not set"); - let cfg = &mut cc::Build::new(); - -diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs -index 14c3ef79a78f..64bdcd1a3b97 100644 ---- a/src/bootstrap/compile.rs -+++ b/src/bootstrap/compile.rs -@@ -336,6 +336,10 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car - cargo.env("MACOSX_DEPLOYMENT_TARGET", target); - } - -+ if let Some(path) = builder.config.profiler_path(target) { -+ cargo.env("LLVM_PROFILER_RT_LIB", path); -+ } -+ - // 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, but our `src/llvm-project` submodule isn't -diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs -index fe932fd6bd30..45a743082415 100644 ---- a/src/bootstrap/config.rs -+++ b/src/bootstrap/config.rs -@@ -533,7 +533,7 @@ pub struct Target { - pub linker: Option, - pub ndk: Option, - pub sanitizers: Option, -- pub profiler: Option, -+ pub profiler: Option, - pub rpath: Option, - pub crt_static: Option, - pub musl_root: Option, -@@ -862,9 +862,9 @@ struct Dist { - } - } - --#[derive(Debug, Deserialize)] -+#[derive(Clone, Debug, Deserialize)] - #[serde(untagged)] --enum StringOrBool { -+pub enum StringOrBool { - String(String), - Bool(bool), - } -@@ -875,6 +875,12 @@ fn default() -> StringOrBool { - } - } - -+impl StringOrBool { -+ fn is_string_or_true(&self) -> bool { -+ matches!(self, Self::String(_) | Self::Bool(true)) -+ } -+} -+ - #[derive(Clone, Debug, Deserialize, PartialEq, Eq)] - #[serde(untagged)] - pub enum RustOptimize { -@@ -991,7 +997,7 @@ struct TomlTarget { - llvm_libunwind: Option = "llvm-libunwind", - android_ndk: Option = "android-ndk", - sanitizers: Option = "sanitizers", -- profiler: Option = "profiler", -+ profiler: Option = "profiler", - rpath: Option = "rpath", - crt_static: Option = "crt-static", - musl_root: Option = "musl-root", -@@ -1864,12 +1870,24 @@ pub fn any_sanitizers_enabled(&self) -> bool { - self.target_config.values().any(|t| t.sanitizers == Some(true)) || self.sanitizers - } - -+ pub fn profiler_path(&self, target: TargetSelection) -> Option<&str> { -+ match self.target_config.get(&target)?.profiler.as_ref()? { -+ StringOrBool::String(s) => Some(s), -+ StringOrBool::Bool(_) => None, -+ } -+ } -+ - pub fn profiler_enabled(&self, target: TargetSelection) -> bool { -- self.target_config.get(&target).map(|t| t.profiler).flatten().unwrap_or(self.profiler) -+ self.target_config -+ .get(&target) -+ .and_then(|t| t.profiler.as_ref()) -+ .map(StringOrBool::is_string_or_true) -+ .unwrap_or(self.profiler) - } - - pub fn any_profiler_enabled(&self) -> bool { -- self.target_config.values().any(|t| t.profiler == Some(true)) || self.profiler -+ self.target_config.values().any(|t| matches!(&t.profiler, Some(p) if p.is_string_or_true())) -+ || self.profiler - } - - pub fn rpath_enabled(&self, target: TargetSelection) -> bool { --- -2.41.0 - diff --git a/0001-Don-t-fail-early-if-try_run-returns-an-error.patch b/0001-Don-t-fail-early-if-try_run-returns-an-error.patch deleted file mode 100644 index d77ddc7..0000000 --- a/0001-Don-t-fail-early-if-try_run-returns-an-error.patch +++ /dev/null @@ -1,201 +0,0 @@ -From 98336f8f6e701ea99275f32d6e2127a621041994 Mon Sep 17 00:00:00 2001 -From: Guillaume Gomez -Date: Tue, 11 Jul 2023 17:01:35 +0200 -Subject: [PATCH] Don't fail early if `try_run` returns an error - ---- - src/bootstrap/download.rs | 2 +- - src/bootstrap/run.rs | 11 +++++------ - src/bootstrap/test.rs | 36 ++++++++++++++++-------------------- - 3 files changed, 22 insertions(+), 27 deletions(-) - -diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs -index cb40521dda76..9478ac7d9cea 100644 ---- a/src/bootstrap/download.rs -+++ b/src/bootstrap/download.rs -@@ -188,7 +188,7 @@ fn fix_bin_or_dylib(&self, fname: &Path) { - patchelf.args(&["--set-interpreter", dynamic_linker.trim_end()]); - } - -- self.try_run(patchelf.arg(fname)).unwrap(); -+ let _ = self.try_run(patchelf.arg(fname)); - } - - fn download_file(&self, url: &str, dest_path: &Path, help_on_error: &str) { -diff --git a/src/bootstrap/run.rs b/src/bootstrap/run.rs -index c97b75927371..70b917000433 100644 ---- a/src/bootstrap/run.rs -+++ b/src/bootstrap/run.rs -@@ -27,8 +27,7 @@ fn run(self, builder: &Builder<'_>) { - try_run( - builder, - &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("generate").arg(&builder.src), -- ) -- .unwrap(); -+ ); - } - - fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { -@@ -40,17 +39,17 @@ fn make_run(run: RunConfig<'_>) { - } - } - --fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> Result<(), ()> { -+fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool { - if !builder.fail_fast { -- if let Err(e) = builder.try_run(cmd) { -+ if builder.try_run(cmd).is_err() { - let mut failures = builder.delayed_failures.borrow_mut(); - failures.push(format!("{:?}", cmd)); -- return Err(e); -+ return false; - } - } else { - builder.run(cmd); - } -- Ok(()) -+ true - } - - #[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] -diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs -index 0907291b54da..13576aa787b6 100644 ---- a/src/bootstrap/test.rs -+++ b/src/bootstrap/test.rs -@@ -48,17 +48,17 @@ - // build for, so there is no entry for "aarch64-apple-darwin" here. - ]; - --fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> Result<(), ()> { -+fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool { - if !builder.fail_fast { -- if let Err(e) = builder.try_run(cmd) { -+ if builder.try_run(cmd).is_err() { - let mut failures = builder.delayed_failures.borrow_mut(); - failures.push(format!("{:?}", cmd)); -- return Err(e); -+ return false; - } - } else { - builder.run(cmd); - } -- Ok(()) -+ true - } - - fn try_run_quiet(builder: &Builder<'_>, cmd: &mut Command) -> bool { -@@ -187,8 +187,7 @@ fn run(self, builder: &Builder<'_>) { - try_run( - builder, - builder.tool_cmd(Tool::Linkchecker).arg(builder.out.join(host.triple).join("doc")), -- ) -- .unwrap(); -+ ); - } - - fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { -@@ -241,8 +240,7 @@ fn run(self, builder: &Builder<'_>) { - builder.default_doc(&[]); - builder.ensure(crate::doc::Rustc::new(builder.top_stage, self.target, builder)); - -- try_run(builder, builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target))) -- .unwrap(); -+ try_run(builder, builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target))); - } - } - -@@ -288,8 +286,7 @@ fn run(self, builder: &Builder<'_>) { - .args(builder.config.test_args()) - .env("RUSTC", builder.rustc(compiler)) - .env("RUSTDOC", builder.rustdoc(compiler)), -- ) -- .unwrap(); -+ ); - } - } - -@@ -855,7 +852,7 @@ fn run(self, builder: &Builder<'_>) { - util::lld_flag_no_threads(self.compiler.host.contains("windows")), - ); - } -- try_run(builder, &mut cmd).unwrap(); -+ try_run(builder, &mut cmd); - } - } - -@@ -1106,7 +1103,7 @@ fn run(self, builder: &Builder<'_>) { - } - - builder.info("tidy check"); -- try_run(builder, &mut cmd).unwrap(); -+ try_run(builder, &mut cmd); - - builder.ensure(ExpandYamlAnchors); - -@@ -1154,8 +1151,7 @@ fn run(self, builder: &Builder<'_>) { - try_run( - builder, - &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("check").arg(&builder.src), -- ) -- .unwrap(); -+ ); - } - - fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { -@@ -1948,7 +1944,7 @@ fn run_ext_doc(self, builder: &Builder<'_>) { - compiler.host, - ); - let _time = util::timeit(&builder); -- let toolstate = if try_run(builder, &mut rustbook_cmd).is_ok() { -+ let toolstate = if try_run(builder, &mut rustbook_cmd) { - ToolState::TestPass - } else { - ToolState::TestFail -@@ -2106,7 +2102,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) -> - cmd.arg("--test-args").arg(test_args); - - if builder.config.verbose_tests { -- try_run(builder, &mut cmd).is_ok() -+ try_run(builder, &mut cmd) - } else { - try_run_quiet(builder, &mut cmd) - } -@@ -2134,7 +2130,7 @@ fn run(self, builder: &Builder<'_>) { - - let src = builder.src.join(relative_path); - let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook); -- let toolstate = if try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src)).is_ok() { -+ let toolstate = if try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src)) { - ToolState::TestPass - } else { - ToolState::TestFail -@@ -2684,7 +2680,7 @@ fn run(self, builder: &Builder<'_>) { - .current_dir(builder.src.join("src/bootstrap/")); - // NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible. - // Use `python -m unittest` manually if you want to pass arguments. -- try_run(builder, &mut check_bootstrap).unwrap(); -+ try_run(builder, &mut check_bootstrap); - - let host = builder.config.build; - let compiler = builder.compiler(0, host); -@@ -2756,7 +2752,7 @@ fn run(self, builder: &Builder<'_>) { - } - - builder.info("platform support check"); -- try_run(builder, &mut cargo.into()).unwrap(); -+ try_run(builder, &mut cargo.into()); - } - } - -@@ -2836,7 +2832,7 @@ fn run(self, builder: &Builder<'_>) { - cmd.env("CARGO", &builder.initial_cargo); - cmd.env("RUSTC", &builder.initial_rustc); - cmd.env("TMP_DIR", &tmpdir); -- try_run(builder, &mut cmd).unwrap(); -+ try_run(builder, &mut cmd); - } - - fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { --- -2.41.0 - diff --git a/0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch b/0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch index 62b4c56..6806d2a 100644 --- a/0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch +++ b/0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch @@ -1,21 +1,19 @@ -From ab9c5148956c2b7d177cc94533370d6a01a8d15f Mon Sep 17 00:00:00 2001 +From 35187c7e6474d346eea3113c4ae34d26d6b18756 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 22 Aug 2023 10:42:12 -0700 Subject: [PATCH] Skip ExpandYamlAnchors when the config is missing The dist-src tarball does not include `.github/` at all, so we can't check whether it needs to be regenerated. - -(cherry picked from commit 35187c7e6474d346eea3113c4ae34d26d6b18756) --- src/bootstrap/test.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs -index eed7a584b603..d41850783c6d 100644 +index db3b7ffbea4e..d1018978f78c 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs -@@ -1150,6 +1150,11 @@ impl Step for ExpandYamlAnchors { +@@ -1174,6 +1174,11 @@ impl Step for ExpandYamlAnchors { /// appropriate configuration for all our CI providers. This step ensures the tool was called /// by the user before committing CI changes. fn run(self, builder: &Builder<'_>) { @@ -25,8 +23,8 @@ index eed7a584b603..d41850783c6d 100644 + return; + } builder.info("Ensuring the YAML anchors in the GitHub Actions config were expanded"); - try_run( - builder, + builder.run_delaying_failure( + &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("check").arg(&builder.src), -- 2.41.0 diff --git a/rust.spec b/rust.spec index 67c25ad..b35408d 100644 --- a/rust.spec +++ b/rust.spec @@ -8,9 +8,9 @@ # 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.71.0 -%global bootstrap_channel 1.71.0 -%global bootstrap_date 2023-07-13 +%global bootstrap_version 1.72.0 +%global bootstrap_channel 1.72.0 +%global bootstrap_date 2023-08-24 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -26,9 +26,7 @@ %if 0%{?fedora} %global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu %endif -%if 0%{?fedora} || 0%{?rhel} >= 8 %global wasm_targets wasm32-unknown-unknown wasm32-wasi -%endif %if 0%{?fedora} || 0%{?rhel} >= 10 %global extra_targets x86_64-unknown-none x86_64-unknown-uefi %endif @@ -57,9 +55,9 @@ %bcond_with llvm_static # We can also choose to just use Rust's bundled LLVM, in case the system LLVM -# is insufficient. Rust currently requires LLVM 14.0+. -%global min_llvm_version 14.0.0 -%global bundled_llvm_version 16.0.5 +# is insufficient. Rust currently requires LLVM 15.0+. +%global min_llvm_version 15.0.0 +%global bundled_llvm_version 17.0.2 %bcond_with bundled_llvm # Requires stable libgit2 1.6, and not the next minor soname change. @@ -82,22 +80,9 @@ %bcond_with disabled_libssh2 %endif -%if 0%{?rhel} && 0%{?rhel} < 8 -%bcond_with curl_http2 -%else -%bcond_without curl_http2 -%endif - -# LLDB isn't available everywhere... -%if 0%{?rhel} && 0%{?rhel} < 8 -%bcond_with lldb -%else -%bcond_without lldb -%endif - Name: rust -Version: 1.72.1 -Release: 3%{?dist} +Version: 1.73.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) @@ -129,21 +114,13 @@ Patch3: 0001-Let-environment-variables-override-some-default-CPUs.patch Patch4: 0001-bootstrap-allow-disabling-target-self-contained.patch Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch -# Enable the profiler runtime for native hosts -# https://github.com/rust-lang/rust/pull/114069 -Patch6: 0001-Allow-using-external-builds-of-the-compiler-rt-profi.patch - -# Fix --no-fail-fast -# https://github.com/rust-lang/rust/pull/113214 -Patch7: 0001-Don-t-fail-early-if-try_run-returns-an-error.patch - # The dist-src tarball doesn't include .github/ # https://github.com/rust-lang/rust/pull/115109 -Patch8: 0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch +Patch6: 0001-Skip-ExpandYamlAnchors-when-the-config-is-missing.patch # wasi: round up the size for aligned_alloc # https://github.com/rust-lang/rust/pull/115254 -Patch9: 0001-wasi-round-up-the-size-for-aligned_alloc.patch +Patch7: 0001-wasi-round-up-the-size-for-aligned_alloc.patch ### RHEL-specific patches below ### @@ -151,11 +128,7 @@ Patch9: 0001-wasi-round-up-the-size-for-aligned_alloc.patch Source100: macros.rust-toolset # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.72.0-disable-libssh2.patch - -# libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys -# will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.72.0-disable-http2.patch +Patch100: rustc-1.73.0-disable-libssh2.patch # Get the Rust triple for any arch. %{lua: function rust_triple(arch) @@ -212,12 +185,7 @@ end} Provides: bundled(%{name}-bootstrap) = %{bootstrap_version} %else BuildRequires: cargo >= %{bootstrap_version} -%if 0%{?rhel} && 0%{?rhel} < 8 -BuildRequires: %{name} >= %{bootstrap_version} -BuildConflicts: %{name} > %{version} -%else BuildRequires: (%{name} >= %{bootstrap_version} with %{name} <= %{version}) -%endif %global local_rust_root %{_prefix} %endif @@ -256,10 +224,6 @@ BuildRequires: cmake >= 2.8.11 %if 0%{?epel} == 7 %global llvm llvm14 %endif -# not ready for llvm-17 yet... -%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10 -%global llvm llvm16 -%endif %if %defined llvm %global llvm_root %{_libdir}/%{llvm} %else @@ -319,14 +283,7 @@ BuildRequires: %{devtoolset_name}-gcc-c++ # While we don't want to encourage dynamic linking to Rust shared libraries, as # there's no stable ABI, we still need the unallocated metadata (.rustc) to # support custom-derive plugins like #[proc_macro_derive(Foo)]. -%if 0%{?rhel} && 0%{?rhel} < 8 -# eu-strip is very eager by default, so we have to limit it to -g, only debugging symbols. -%global _find_debuginfo_opts -g -%undefine _include_minidebuginfo -%else -# Newer find-debuginfo.sh supports --keep-section, which is preferable. rhbz1465997 %global _find_debuginfo_opts --keep-section .rustc -%endif %if %{without bundled_llvm} %if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1} @@ -364,10 +321,8 @@ find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)' %{nil} %endif -%if 0%{?fedora} || 0%{?rhel} >= 8 # For profiler_builtins BuildRequires: compiler-rt -%endif # This component was removed as of Rust 1.69.0. # https://github.com/rust-lang/rust/pull/101841 @@ -473,8 +428,6 @@ This package includes the rust-gdb script, which allows easier debugging of Rust programs. -%if %with lldb - %package lldb Summary: LLDB pretty printers for Rust BuildArch: noarch @@ -486,8 +439,6 @@ Requires: %{name}-debugger-common = %{version}-%{release} This package includes the rust-lldb script, which allows easier debugging of Rust programs. -%endif - %package doc Summary: Documentation for Rust @@ -546,11 +497,7 @@ A tool for formatting Rust code according to style guidelines. Summary: Rust implementation of the Language Server Protocol # The standard library sources are needed for most functionality. -%if 0%{?rhel} && 0%{?rhel} < 8 -Requires: %{name}-src -%else Recommends: %{name}-src -%endif # RLS is no longer available as of Rust 1.65, but we're including the stub # binary that implements LSP just enough to recommend rust-analyzer. @@ -581,11 +528,7 @@ A collection of lints to catch common mistakes and improve your Rust code. %package src Summary: Sources for the Rust standard library BuildArch: noarch -%if 0%{?rhel} && 0%{?rhel} < 8 -Requires: %{name}-std-static = %{version}-%{release} -%else Recommends: %{name}-std-static = %{version}-%{release} -%endif %description src This package includes source files for the Rust standard library. It may be @@ -637,18 +580,11 @@ rm -rf %{wasi_libc_dir}/dlmalloc/ %endif %patch -P6 -p1 %patch -P7 -p1 -%patch -P8 -p1 -%patch -P9 -p1 %if %with disabled_libssh2 %patch -P100 -p1 %endif -%if %without curl_http2 -%patch -P101 -p1 -rm -rf vendor/libnghttp2-sys*/ -%endif - # Use our explicit python3 first sed -i.try-python -e '/^try python3 /i try "%{__python3}" "$@"' ./configure @@ -740,13 +676,7 @@ end} %ifarch %{arm} %{ix86} # full debuginfo is exhausting memory; just do libstd for now # https://github.com/rust-lang/rust/issues/45854 -%if 0%{?rhel} && 0%{?rhel} < 8 -# Older rpmbuild didn't work with partial debuginfo coverage. -%global debug_package %{nil} -%define enable_debuginfo --debuginfo-level=0 -%else %define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2 -%endif %else %define enable_debuginfo --debuginfo-level=2 %endif @@ -786,16 +716,14 @@ fi %endif %endif -%if 0%{?fedora} || 0%{?rhel} >= 8 # Find the compiler-rt library for the Rust profiler_builtins crate. %if 0%{?clang_major_version} >= 17 -PROFILER='%{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a' +%define profiler %{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a %else # The exact profiler path is version dependent.. -PROFILER=$(echo %{_libdir}/clang/*/lib/libclang_rt.profile-%{_arch}.a) -%endif -test -r "$PROFILER" +%define profiler %(echo %{_libdir}/clang/*/lib/libclang_rt.profile-%{_arch}.a) %endif +test -r "%{profiler}" %configure --disable-option-checking \ --libdir=%{common_libdir} \ @@ -805,7 +733,7 @@ test -r "$PROFILER" --set target.%{rust_triple}.cxx=%{__cxx} \ --set target.%{rust_triple}.ar=%{__ar} \ --set target.%{rust_triple}.ranlib=%{__ranlib} \ - ${PROFILER:+--set target.%{rust_triple}.profiler="$PROFILER"} \ + --set target.%{rust_triple}.profiler="%{profiler}" \ %{?mingw_target_config} \ %{?wasm_target_config} \ --python=%{__python3} \ @@ -916,11 +844,6 @@ mkdir -p %{buildroot}%{_datadir}/cargo/registry mkdir -p %{buildroot}%{_docdir}/cargo ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html -%if %without lldb -rm -f %{buildroot}%{_bindir}/rust-lldb -rm -f %{buildroot}%{rustlibdir}/etc/lldb_* -%endif - # We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp) rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* @@ -944,11 +867,9 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" %{buildroot}%{_bindir}/cargo run --verbose -%if 0%{?fedora} || 0%{?rhel} >= 8 # Sanity-check that code-coverage builds and runs env RUSTFLAGS="-Cinstrument-coverage" %{buildroot}%{_bindir}/cargo run --verbose test -r default_*.profraw -%endif # Try a build sanity-check for other std-enabled targets for triple in %{?mingw_targets} %{?wasm_targets}; do @@ -961,7 +882,7 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* # Bootstrap is excluded because it's not something we ship, and a lot of its # tests are geared toward the upstream CI environment. -%{__python3} ./x.py test --no-fail-fast --exclude src/bootstrap || : +%{__python3} ./x.py test --no-fail-fast --skip src/bootstrap || : rm -rf "./build/%{rust_triple}/test/" %{__python3} ./x.py test --no-fail-fast cargo || : @@ -1053,11 +974,9 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %exclude %{_bindir}/rust-gdbgui -%if %with lldb %files lldb %{_bindir}/rust-lldb %{rustlibdir}/etc/lldb_* -%endif %files doc @@ -1074,7 +993,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %license src/tools/cargo/LICENSE-{APACHE,MIT,THIRD-PARTY} %doc src/tools/cargo/README.md %{_bindir}/cargo -%{_libexecdir}/cargo* %{_mandir}/man1/cargo*.1* %{_sysconfdir}/bash_completion.d/cargo %{_datadir}/zsh/site-functions/_cargo @@ -1115,6 +1033,10 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %changelog +* Thu Oct 05 2023 Josh Stone - 1.73.0-1 +- Update to 1.73.0. +- Drop el7 conditionals from the spec. + * Fri Sep 29 2023 Josh Stone - 1.72.1-3 - Fix the profiler runtime with compiler-rt-17 - Switch to unbundled wasi-libc on Fedora diff --git a/rustc-1.72.0-disable-http2.patch b/rustc-1.72.0-disable-http2.patch deleted file mode 100644 index db2213e..0000000 --- a/rustc-1.72.0-disable-http2.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-08-21 11:00:15.341608892 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-08-21 11:00:46.074984901 -0700 -@@ -743,7 +743,6 @@ - dependencies = [ - "cc", - "libc", -- "libnghttp2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -@@ -2011,16 +2010,6 @@ - checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" - - [[package]] --name = "libnghttp2-sys" --version = "0.1.7+1.45.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "57ed28aba195b38d5ff02b9170cbff627e336a20925e43b4945390401c5dc93f" --dependencies = [ -- "cc", -- "libc", --] -- --[[package]] - name = "libz-sys" - version = "1.1.9" - source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-08-21 11:00:15.341608892 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-08-21 11:00:15.342608871 -0700 -@@ -118,7 +118,7 @@ - cargo-util.workspace = true - clap = { workspace = true, features = ["wrap_help"] } - crates-io.workspace = true --curl = { workspace = true, features = ["http2"] } -+curl = { workspace = true, features = [] } - curl-sys.workspace = true - env_logger.workspace = true - filetime.workspace = true ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2023-08-17 20:58:39.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2023-08-21 11:00:15.343608851 -0700 -@@ -408,16 +408,9 @@ - sources: SourceMap<'cfg>, - config: &'cfg Config, - ) -> CargoResult> { -- // We've enabled the `http2` feature of `curl` in Cargo, so treat -- // failures here as fatal as it would indicate a build-time problem. -- let mut multi = Multi::new(); -- let multiplexing = config.http_config()?.multiplexing.unwrap_or(true); -- multi -- .pipelining(false, multiplexing) -- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; -- -- // let's not flood crates.io with connections -- multi.set_max_host_connections(2)?; -+ // Multiplexing is disabled because the system libcurl doesn't support it. -+ let multi = Multi::new(); -+ let multiplexing = false; - - Ok(PackageSet { - packages: package_ids ---- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2023-08-17 20:58:39.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2023-08-21 11:00:15.343608851 -0700 -@@ -250,16 +250,8 @@ - } - self.fetch_started = true; - -- // We've enabled the `http2` feature of `curl` in Cargo, so treat -- // failures here as fatal as it would indicate a build-time problem. -- self.multiplexing = self.config.http_config()?.multiplexing.unwrap_or(true); -- -- self.multi -- .pipelining(false, self.multiplexing) -- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; -- -- // let's not flood the server with connections -- self.multi.set_max_host_connections(2)?; -+ // Multiplexing is disabled because the system libcurl doesn't support it. -+ self.multiplexing = false; - - if !self.quiet { - self.config ---- rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs.orig 2023-08-21 11:00:15.343608851 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/util/network/mod.rs 2023-08-21 11:02:01.969443986 -0700 -@@ -27,7 +27,7 @@ - macro_rules! try_old_curl { - ($e:expr, $msg:expr) => { - let result = $e; -- if cfg!(target_os = "macos") { -+ if cfg!(any(target_os = "linux", target_os = "macos")) { - if let Err(e) = result { - ::log::warn!("ignoring libcurl {} error: {}", $msg, e); - } diff --git a/rustc-1.72.0-disable-libssh2.patch b/rustc-1.73.0-disable-libssh2.patch similarity index 58% rename from rustc-1.72.0-disable-libssh2.patch rename to rustc-1.73.0-disable-libssh2.patch index 1198954..96b5f4f 100644 --- a/rustc-1.72.0-disable-libssh2.patch +++ b/rustc-1.73.0-disable-libssh2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-08-17 20:58:39.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-08-21 10:52:50.520622927 -0700 -@@ -1999,7 +1999,6 @@ +--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2023-09-01 10:51:15.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.lock 2023-09-05 16:59:08.837345133 -0700 +@@ -1973,7 +1973,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -2022,20 +2021,6 @@ +@@ -2006,20 +2005,6 @@ ] [[package]] @@ -29,14 +29,14 @@ name = "libz-sys" version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-08-21 10:49:34.852578202 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-08-21 10:52:11.858404449 -0700 -@@ -31,7 +31,7 @@ - filetime = "0.2.9" - flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] } +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2023-09-05 16:59:08.837345133 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2023-09-05 17:00:00.828461993 -0700 +@@ -37,7 +37,7 @@ + filetime = "0.2.21" + flate2 = { version = "1.0.26", default-features = false, features = ["zlib"] } fwdansi = "1.1.0" --git2 = "0.17.1" -+git2 = { version = "0.17.1", default-features = false, features = ["https"] } +-git2 = "0.17.2" ++git2 = { version = "0.17.2", default-features = false, features = ["https"] } git2-curl = "0.18.0" gix = { version = "0.45.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] } gix-features-for-configuration-only = { version = "0.30.0", package = "gix-features", features = [ "parallel" ] } diff --git a/sources b/sources index c0c8375..1626147 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.72.1-src.tar.xz) = 08232b5bf36f82a995d67f3d03d5e35b7d8914d31fb4491d4c37b72a830bc438e9d18d9e138d398b1b6ae4aa09f7f8e1e9b68da6273ab74bdae4c6123586a21b +SHA512 (rustc-1.73.0-src.tar.xz) = 75c59680a82cb9d076b9434744a1c65908524ef769293952f5d9c5779d9a9c6fa4d9aa0c7e7d6b7566a21a50a27cd6ae452b5283a4d4606b2fa1acc24dfd8e0c SHA512 (wasi-libc-bd950eb128bff337153de217b11270f948d04bb4.tar.gz) = 01e5cc3ebdab239f57816ff80f939fd87a5491a28951daf74b3310b118b4820c098ac9417771c9c6af55ca91d2cabe6498975ab9db4914aba754d87067cd1066 From 4740f18b016e16265a95ec132b86e3b9061a67ae Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 5 Oct 2023 15:45:24 -0700 Subject: [PATCH 44/45] Loosen the search for older libclang_rt.profile --- rust.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust.spec b/rust.spec index b35408d..7ff4c0a 100644 --- a/rust.spec +++ b/rust.spec @@ -721,7 +721,7 @@ fi %define profiler %{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a %else # The exact profiler path is version dependent.. -%define profiler %(echo %{_libdir}/clang/*/lib/libclang_rt.profile-%{_arch}.a) +%define profiler %(echo %{_libdir}/clang/??/lib/libclang_rt.profile-*.a) %endif test -r "%{profiler}" From 9746593522f56550b00d16f82de5101526befbbd Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 26 Oct 2023 09:01:56 -0700 Subject: [PATCH 45/45] Use thin-LTO and PGO for rustc itself. --- rust.spec | 56 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/rust.spec b/rust.spec index 7ff4c0a..c29fa40 100644 --- a/rust.spec +++ b/rust.spec @@ -80,9 +80,16 @@ %bcond_with disabled_libssh2 %endif +%if 0%{?__isa_bits} == 32 +# Disable PGO on 32-bit to reduce build memory +%bcond_with rustc_pgo +%else +%bcond_without rustc_pgo +%endif + Name: rust Version: 1.73.0 -Release: 1%{?dist} +Release: 2%{?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) @@ -745,7 +752,8 @@ test -r "%{profiler}" --disable-llvm-static-stdcpp \ --disable-rpath \ %{enable_debuginfo} \ - --set rust.codegen-units-std=1 \ + --set rust.codegen-units=1 \ + --set rust.lto=thin \ --set build.build-stage=2 \ --set build.doc-stage=2 \ --set build.install-stage=2 \ @@ -758,11 +766,32 @@ test -r "%{profiler}" --release-channel=%{channel} \ --release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}" -%{__python3} ./x.py build -j "$ncpus" -%{__python3} ./x.py doc +%global x %{__python3} ./x.py +%global xk %{x} --keep-stage=0 --keep-stage=1 + +%if %with rustc_pgo +# Build the compiler with profile instrumentation +PROFRAW="$PWD/build/profiles" +PROFDATA="$PWD/build/rustc.profdata" +mkdir -p "$PROFRAW" +%{x} build -j "$ncpus" sysroot --rust-profile-generate="$PROFRAW" +# Build cargo as a workload to generate compiler profiles +env LLVM_PROFILE_FILE="$PROFRAW/default_%%m_%%p.profraw" %{xk} build cargo +llvm-profdata merge -o "$PROFDATA" "$PROFRAW" +rm -r "$PROFRAW" build/%{rust_triple}/stage2*/ +# Rebuild the compiler using the profile data +%{x} build -j "$ncpus" sysroot --rust-profile-use="$PROFDATA" +%else +# Build the compiler without PGO +%{x} build -j "$ncpus" sysroot +%endif + +# Build everything else normally +%{xk} build +%{xk} doc for triple in %{?all_targets} ; do - %{__python3} ./x.py build --target=$triple std + %{xk} build --target=$triple std done %install @@ -771,10 +800,10 @@ done %endif %{export_rust_env} -DESTDIR=%{buildroot} %{__python3} ./x.py install +DESTDIR=%{buildroot} %{xk} install for triple in %{?all_targets} ; do - DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std + DESTDIR=%{buildroot} %{xk} install --target=$triple std done # The rls stub doesn't have an install target, but we can just copy it. @@ -882,17 +911,17 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* # Bootstrap is excluded because it's not something we ship, and a lot of its # tests are geared toward the upstream CI environment. -%{__python3} ./x.py test --no-fail-fast --skip src/bootstrap || : +%{xk} test --no-fail-fast --skip src/bootstrap || : rm -rf "./build/%{rust_triple}/test/" -%{__python3} ./x.py test --no-fail-fast cargo || : +%{xk} test --no-fail-fast cargo || : rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" -%{__python3} ./x.py test --no-fail-fast clippy || : +%{xk} test --no-fail-fast clippy || : -%{__python3} ./x.py test --no-fail-fast rust-analyzer || : +%{xk} test --no-fail-fast rust-analyzer || : -%{__python3} ./x.py test --no-fail-fast rustfmt || : +%{xk} test --no-fail-fast rustfmt || : %ldconfig_scriptlets @@ -1033,6 +1062,9 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %changelog +* Thu Oct 26 2023 Josh Stone - 1.73.0-2 +- Use thin-LTO and PGO for rustc itself. + * Thu Oct 05 2023 Josh Stone - 1.73.0-1 - Update to 1.73.0. - Drop el7 conditionals from the spec.