From 33393939a723c268c6b341f019c1c7dc6a380f4d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Wed, 14 Jul 2021 04:38:06 +0000 Subject: [PATCH] import rust-1.53.0-1.module+el8.5.0+11502+08f8036f --- .gitignore | 2 +- .rust.metadata | 2 +- ...-Use-lld-provided-by-system-for-wasm.patch | 26 ++++ ...patch => rustc-1.53.0-disable-http2.patch} | 26 ++-- SPECS/rust.spec | 132 +++++++++++++++--- 5 files changed, 152 insertions(+), 36 deletions(-) create mode 100644 SOURCES/0001-Use-lld-provided-by-system-for-wasm.patch rename SOURCES/{rustc-1.51.0-disable-http2.patch => rustc-1.53.0-disable-http2.patch} (72%) diff --git a/.gitignore b/.gitignore index 7634a95..22752a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/rustc-1.52.1-src.tar.xz +SOURCES/rustc-1.53.0-src.tar.xz diff --git a/.rust.metadata b/.rust.metadata index 313ce67..f756636 100644 --- a/.rust.metadata +++ b/.rust.metadata @@ -1 +1 @@ -c5cdec7630c1915cac29e962e02465544335bad4 SOURCES/rustc-1.52.1-src.tar.xz +ae467484f1e961f15bb521a6b5305377ec61f039 SOURCES/rustc-1.53.0-src.tar.xz diff --git a/SOURCES/0001-Use-lld-provided-by-system-for-wasm.patch b/SOURCES/0001-Use-lld-provided-by-system-for-wasm.patch new file mode 100644 index 0000000..4dcb322 --- /dev/null +++ b/SOURCES/0001-Use-lld-provided-by-system-for-wasm.patch @@ -0,0 +1,26 @@ +From 3582a262d27fd5a2f8705bad6018241eaca8aadd 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 b208eb92f8ff..94a701a11c8b 100644 +--- a/compiler/rustc_target/src/spec/wasm_base.rs ++++ b/compiler/rustc_target/src/spec/wasm_base.rs +@@ -98,8 +98,7 @@ pub fn options() -> TargetOptions { + // arguments just yet + limit_rdylib_exports: false, + +- // we use the LLD shipped with the Rust toolchain by default +- linker: Some("rust-lld".to_owned()), ++ linker: Some("lld".to_owned()), + lld_flavor: LldFlavor::Wasm, + + // No need for indirection here, simd types can always be passed by +-- +2.31.1 + diff --git a/SOURCES/rustc-1.51.0-disable-http2.patch b/SOURCES/rustc-1.53.0-disable-http2.patch similarity index 72% rename from SOURCES/rustc-1.51.0-disable-http2.patch rename to SOURCES/rustc-1.53.0-disable-http2.patch index 2517a34..94040b3 100644 --- a/SOURCES/rustc-1.51.0-disable-http2.patch +++ b/SOURCES/rustc-1.53.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2021-03-09 10:30:08.626424998 -0800 -+++ rustc-beta-src/Cargo.lock 2021-03-09 10:32:38.096207704 -0800 -@@ -899,7 +899,6 @@ +--- rustc-beta-src/Cargo.lock.orig 2021-06-04 15:56:04.141227630 -0700 ++++ rustc-beta-src/Cargo.lock 2021-06-04 16:03:04.461396826 -0700 +@@ -885,7 +885,6 @@ dependencies = [ "cc", "libc", @@ -8,8 +8,8 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -1860,16 +1859,6 @@ - ] +@@ -1904,16 +1903,6 @@ + checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] -name = "libnghttp2-sys" @@ -25,20 +25,20 @@ name = "libz-sys" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2021-03-05 08:34:15.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2021-03-09 10:32:38.096207704 -0800 +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2021-06-04 15:56:04.143227587 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2021-06-04 15:57:56.931857927 -0700 @@ -25,7 +25,7 @@ + cargo-util = { path = "crates/cargo-util", version = "0.1.0" } crates-io = { path = "crates/crates-io", version = "0.33.0" } crossbeam-utils = "0.8" - crypto-hash = "0.3.1" -curl = { version = "0.4.23", features = ["http2"] } +curl = { version = "0.4.23", features = [] } curl-sys = "0.4.22" env_logger = "0.8.1" pretty_env_logger = { version = "0.4", optional = true } ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2021-03-05 08:34:15.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2021-03-09 10:32:38.096207704 -0800 -@@ -412,14 +412,8 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2021-05-22 15:22:31.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2021-06-04 16:00:03.903190293 -0700 +@@ -416,14 +416,8 @@ // Also note that pipelining is disabled as curl authors have indicated // that it's buggy, and we've empirically seen that it's buggy with HTTP // proxies. @@ -46,7 +46,7 @@ - let multiplexing = config.http_config()?.multiplexing.unwrap_or(true); - multi - .pipelining(false, multiplexing) -- .chain_err(|| "failed to enable multiplexing/pipelining in curl")?; +- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; - - // let's not flood crates.io with connections - multi.set_max_host_connections(2)?; @@ -55,7 +55,7 @@ Ok(PackageSet { packages: package_ids -@@ -592,7 +586,7 @@ +@@ -596,7 +590,7 @@ macro_rules! try_old_curl { ($e:expr, $msg:expr) => { let result = $e; diff --git a/SPECS/rust.spec b/SPECS/rust.spec index 23bce5c..3553ecc 100644 --- a/SPECS/rust.spec +++ b/SPECS/rust.spec @@ -10,19 +10,28 @@ # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 # or nightly wants some beta-YYYY-MM-DD # Note that cargo matches the program version here, not its crate version. -%global bootstrap_rust 1.51.0 -%global bootstrap_cargo 1.51.0 -%global bootstrap_channel 1.51.0 -%global bootstrap_date 2021-03-25 +%global bootstrap_rust 1.52.0 +%global bootstrap_cargo 1.52.0 +%global bootstrap_channel 1.52.0 +%global bootstrap_date 2021-05-06 # Only the specified arches will use bootstrap binaries. #global bootstrap_arches %%{rust_arches} +# Define a space-separated list of targets to ship rust-std-static-$triple for +# cross-compilation. The packages are noarch, but they're not fully +# reproducible between hosts, so only x86_64 actually builds it. +%ifarch x86_64 +%if 0%{?fedora} || 0%{?rhel} >= 8 +%global cross_targets wasm32-unknown-unknown +%endif +%endif + # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. %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 9.0+. +# is insufficient. Rust currently requires LLVM 10.0+. %bcond_with bundled_llvm # Requires stable libgit2 1.1 @@ -53,7 +62,7 @@ %endif Name: rust -Version: 1.52.1 +Version: 1.53.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -72,6 +81,9 @@ Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz # https://github.com/rust-lang/rust/issues/80810#issuecomment-781784032 Patch1: 0001-Revert-Auto-merge-of-79547.patch +# By default, rust tries to use "rust-lld" as a linker for WebAssembly. +Patch2: 0001-Use-lld-provided-by-system-for-wasm.patch + ### RHEL-specific patches below ### # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) @@ -79,7 +91,7 @@ Patch100: rustc-1.48.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.51.0-disable-http2.patch +Patch101: rustc-1.53.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) @@ -170,7 +182,7 @@ Provides: bundled(llvm) = 12.0.0 %else BuildRequires: cmake >= 2.8.11 %if 0%{?epel} == 7 -%global llvm llvm9.0 +%global llvm llvm11 %endif %if %defined llvm %global llvm_root %{_libdir}/%{llvm} @@ -178,7 +190,7 @@ BuildRequires: cmake >= 2.8.11 %global llvm llvm %global llvm_root %{_prefix} %endif -BuildRequires: %{llvm}-devel >= 9.0 +BuildRequires: %{llvm}-devel >= 10.0 %if %with llvm_static BuildRequires: %{llvm}-static BuildRequires: libffi-devel @@ -203,6 +215,14 @@ Requires: %{name}-std-static%{?_isa} = %{version}-%{release} # https://github.com/rust-lang/rust/issues/11937 Requires: /usr/bin/cc +%if 0%{?epel} == 7 +%global devtoolset_name devtoolset-9 +BuildRequires: %{devtoolset_name}-gcc +BuildRequires: %{devtoolset_name}-gcc-c++ +%global __cc /opt/rh/%{devtoolset_name}/root/usr/bin/gcc +%global __cxx /opt/rh/%{devtoolset_name}/root/usr/bin/g++ +%endif + # ALL Rust libraries are private, because they don't keep an ABI. %global _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.* %global __provides_exclude ^(%{_privatelibs})$ @@ -231,6 +251,19 @@ Requires: /usr/bin/cc %endif %endif +# We're going to override --libdir when configuring to get rustlib into a +# common path, but we'll fix the shared libraries during install. +%global common_libdir %{_prefix}/lib +%global rustlibdir %{common_libdir}/rustlib + +%if %defined cross_targets +# brp-strip-static-archive breaks the archive index for wasm +%global __os_install_post \ +%__os_install_post \ +find %{buildroot}%{rustlibdir} -type f -path '*/wasm*/lib/*.rlib' -exec ranlib '{}' ';' \ +%{nil} +%endif + %description Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. @@ -245,6 +278,32 @@ Summary: Standard library for Rust This package includes the standard libraries for building applications written in Rust. +%if %defined cross_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do + local requires = rpm.expand("Requires: rust = %{version}-%{release}") + if string.sub(triple, 1, 4) == "wasm" then + requires = requires .. "\nRequires: lld >= 8.0" + end + local subs = { + triple = triple, + requires = requires, + } + local s = string.gsub([[ +%package std-static-{{triple}} +Summary: Standard library for Rust +BuildArch: noarch +{{requires}} + +%description std-static-{{triple}} +This package includes the standard libraries for building applications +written in Rust for the {{triple}} target. +]], "{{(%w+)}}", subs) + print(s) + end +end} +%endif + %package debugger-common Summary: Common debugger pretty printers for Rust @@ -402,6 +461,7 @@ test -f '%{local_rust_root}/bin/rustc' %setup -q -n %{rustc_package} %patch1 -p1 +%patch2 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -487,11 +547,6 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' %build export %{rust_env} -# We're going to override --libdir when configuring to get rustlib into a -# common path, but we'll fix the shared libraries during install. -%global common_libdir %{_prefix}/lib -%global rustlibdir %{common_libdir}/rustlib - %ifarch %{arm} %{ix86} s390x # full debuginfo is exhausting memory; just do libstd for now # https://github.com/rust-lang/rust/issues/45854 @@ -506,13 +561,6 @@ export %{rust_env} %define enable_debuginfo --debuginfo-level=2 %endif -# We want the best optimization for std, but it caused problems for rpm-ostree -# on ppc64le to have all of the compiler_builtins in a single object: -# https://bugzilla.redhat.com/show_bug.cgi?id=1713090 -%ifnarch %{power64} -%define codegen_units_std --set rust.codegen-units-std=1 -%endif - # Some builders have relatively little memory for their CPU count. # At least 2GB per CPU is a good rule of thumb for building rustc. ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN) @@ -524,6 +572,9 @@ fi %configure --disable-option-checking \ --libdir=%{common_libdir} \ --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ + --set target.%{rust_triple}.linker=%{__cc} \ + --set target.%{rust_triple}.cc=%{__cc} \ + --set target.%{rust_triple}.cxx=%{__cxx} \ --python=%{python} \ --local-rust-root=%{local_rust_root} \ %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ @@ -531,6 +582,7 @@ fi %{!?with_llvm_static: --enable-llvm-link-shared } } \ --disable-rpath \ %{enable_debuginfo} \ + --set rust.codegen-units-std=1 \ --enable-extended \ --tools=analysis,cargo,clippy,rls,rustfmt,src \ --enable-vendor \ @@ -542,12 +594,23 @@ fi %{python} ./x.py build -j "$ncpus" --stage 2 %{python} ./x.py doc --stage 2 +%if %defined cross_targets +for triple in %{cross_targets}; do + %{python} ./x.py build --stage 2 --target=$triple std +done +%endif %install export %{rust_env} DESTDIR=%{buildroot} %{python} ./x.py install +%if %defined cross_targets +for triple in %{cross_targets}; do + DESTDIR=%{buildroot} %{python} ./x.py install --target=$triple std +done +%endif + # Make sure the shared libraries are in the proper libdir %if "%{_libdir}" != "%{common_libdir}" mkdir -p %{buildroot}%{_libdir} @@ -650,6 +713,26 @@ export %{rust_env} %{rustlibdir}/%{rust_triple}/lib/*.rlib +%if %defined cross_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{cross_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} %dir %{rustlibdir}/etc @@ -733,6 +816,13 @@ export %{rust_env} %changelog +* Mon Jun 21 2021 Josh Stone - 1.53.0-1 +- Update to 1.53.0. + +* Tue Jun 15 2021 Josh Stone - 1.52.1-2 +- Set rust.codegen-units-std=1 for all targets again. +- Add rust-std-static-wasm32-unknown-unknown. + * Tue May 25 2021 Josh Stone - 1.52.1-1 - Update to 1.52.1. Includes security fixes for CVE-2020-36323, CVE-2021-28876, CVE-2021-28878, CVE-2021-28879, and CVE-2021-31162.