import rust-1.58.0-1.el9

This commit is contained in:
CentOS Sources 2022-02-01 13:00:39 -05:00 committed by Stepan Oksanichenko
parent 48b986c6e7
commit 78faf0cbb4
6 changed files with 228 additions and 233 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/rustc-1.56.1-src.tar.xz SOURCES/rustc-1.58.0-src.tar.xz
SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz

View File

@ -1,2 +1,2 @@
a79516231c4391e37990bdda0efdafdc51697fab SOURCES/rustc-1.56.1-src.tar.xz c57248567ade6533bd15352eba956b13b82e8c6f SOURCES/rustc-1.58.0-src.tar.xz
b8865d1192852214d6d9b0a0957d4b36c16832aa SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz b8865d1192852214d6d9b0a0957d4b36c16832aa SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz

View File

@ -1,102 +0,0 @@
From eaf7ea1fc339e1ff348ed941ed2e8c4d66f3e458 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 18 Feb 2021 19:14:58 -0800
Subject: [PATCH] Revert "Auto merge of #79547 - erikdesjardins:byval,
r=nagisa"
This reverts commit a094ff9590b83c8f94d898f92c2964a5803ded06, reversing
changes made to d37afad0cc87bf709ad10c85319296ac53030f03.
---
compiler/rustc_middle/src/ty/layout.rs | 12 ++++++------
...return-value-in-reg.rs => return-value-in-reg.rs} | 4 ++--
src/test/codegen/union-abi.rs | 11 +++--------
3 files changed, 11 insertions(+), 16 deletions(-)
rename src/test/codegen/{arg-return-value-in-reg.rs => return-value-in-reg.rs} (74%)
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index b545b92c9252..545f6aee1a21 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -2849,7 +2849,7 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
|| abi == SpecAbi::RustIntrinsic
|| abi == SpecAbi::PlatformIntrinsic
{
- let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>| {
+ let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>, is_ret: bool| {
if arg.is_ignore() {
return;
}
@@ -2887,9 +2887,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
_ => return,
}
- // Pass and return structures up to 2 pointers in size by value, matching `ScalarPair`.
- // LLVM will usually pass these in 2 registers, which is more efficient than by-ref.
- let max_by_val_size = Pointer.size(cx) * 2;
+ // Return structures up to 2 pointers in size by value, matching `ScalarPair`. LLVM
+ // will usually return these in 2 registers, which is more efficient than by-ref.
+ let max_by_val_size = if is_ret { Pointer.size(cx) * 2 } else { Pointer.size(cx) };
let size = arg.layout.size;
if arg.layout.is_unsized() || size > max_by_val_size {
@@ -2901,9 +2901,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
arg.cast_to(Reg { kind: RegKind::Integer, size });
}
};
- fixup(&mut self.ret);
+ fixup(&mut self.ret, true);
for arg in &mut self.args {
- fixup(arg);
+ fixup(arg, false);
}
return;
}
diff --git a/src/test/codegen/arg-return-value-in-reg.rs b/src/test/codegen/return-value-in-reg.rs
similarity index 74%
rename from src/test/codegen/arg-return-value-in-reg.rs
rename to src/test/codegen/return-value-in-reg.rs
index a69291d47821..4bc0136c5e32 100644
--- a/src/test/codegen/arg-return-value-in-reg.rs
+++ b/src/test/codegen/return-value-in-reg.rs
@@ -1,4 +1,4 @@
-//! Check that types of up to 128 bits are passed and returned by-value instead of via pointer.
+//! This test checks that types of up to 128 bits are returned by-value instead of via out-pointer.
// compile-flags: -C no-prepopulate-passes -O
// only-x86_64
@@ -11,7 +11,7 @@ pub struct S {
c: u32,
}
-// CHECK: define i128 @modify(i128{{( %0)?}})
+// CHECK: define i128 @modify(%S* noalias nocapture dereferenceable(16) %s)
#[no_mangle]
pub fn modify(s: S) -> S {
S { a: s.a + s.a, b: s.b + s.b, c: s.c + s.c }
diff --git a/src/test/codegen/union-abi.rs b/src/test/codegen/union-abi.rs
index f282fd237054..afea01e9a2d0 100644
--- a/src/test/codegen/union-abi.rs
+++ b/src/test/codegen/union-abi.rs
@@ -63,16 +63,11 @@ pub union UnionU128{a:u128}
#[no_mangle]
pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} }
-pub union UnionU128x2{a:(u128, u128)}
-// CHECK: define void @test_UnionU128x2(i128 %_1.0, i128 %_1.1)
-#[no_mangle]
-pub fn test_UnionU128x2(_: UnionU128x2) { loop {} }
-
#[repr(C)]
-pub union CUnionU128x2{a:(u128, u128)}
-// CHECK: define void @test_CUnionU128x2(%CUnionU128x2* {{.*}} %_1)
+pub union CUnionU128{a:u128}
+// CHECK: define void @test_CUnionU128(%CUnionU128* {{.*}} %_1)
#[no_mangle]
-pub fn test_CUnionU128x2(_: CUnionU128x2) { loop {} }
+pub fn test_CUnionU128(_: CUnionU128) { loop {} }
pub union UnionBool { b:bool }
// CHECK: define zeroext i1 @test_UnionBool(i8 %b)
--
2.29.2

View File

@ -1,18 +1,23 @@
--- rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs.orig 2021-03-09 10:40:09.755485845 -0800 --- rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs.orig 2021-11-29 10:41:02.380100917 -0800
+++ rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs 2021-03-09 10:44:51.257426181 -0800 +++ rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs 2021-11-29 10:53:31.014783112 -0800
@@ -1279,11 +1279,13 @@ @@ -1485,15 +1485,14 @@
} }
fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind { fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind {
- let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) { - let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) {
+ // Only use PIE if explicity specified. + // Only use PIE if explicity specified.
+ let explicit_pic = matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic)); + 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) { + let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) {
(CrateType::Executable, _, _) if sess.is_wasi_reactor() => LinkOutputKind::WasiReactorExe, (CrateType::Executable, _, _) if sess.is_wasi_reactor() => LinkOutputKind::WasiReactorExe,
- (CrateType::Executable, false, RelocModel::Pic) => LinkOutputKind::DynamicPicExe, - (CrateType::Executable, false, RelocModel::Pic | RelocModel::Pie) => {
- LinkOutputKind::DynamicPicExe
- }
+ (CrateType::Executable, false, true) => LinkOutputKind::DynamicPicExe, + (CrateType::Executable, false, true) => LinkOutputKind::DynamicPicExe,
(CrateType::Executable, false, _) => LinkOutputKind::DynamicNoPicExe, (CrateType::Executable, false, _) => LinkOutputKind::DynamicNoPicExe,
- (CrateType::Executable, true, RelocModel::Pic) => LinkOutputKind::StaticPicExe, - (CrateType::Executable, true, RelocModel::Pic | RelocModel::Pie) => {
- LinkOutputKind::StaticPicExe
- }
+ (CrateType::Executable, true, true) => LinkOutputKind::StaticPicExe, + (CrateType::Executable, true, true) => LinkOutputKind::StaticPicExe,
(CrateType::Executable, true, _) => LinkOutputKind::StaticNoPicExe, (CrateType::Executable, true, _) => LinkOutputKind::StaticNoPicExe,
(_, true, _) => LinkOutputKind::StaticDylib, (_, true, _) => LinkOutputKind::StaticDylib,

View File

@ -1,6 +1,6 @@
--- rustc-1.56.0-src/Cargo.lock.orig 2021-10-19 18:03:53.928187581 -0700 --- rustc-1.58.0-src/Cargo.lock.orig 2022-01-11 16:13:10.125323813 -0800
+++ rustc-1.56.0-src/Cargo.lock 2021-10-19 18:05:41.443522980 -0700 +++ rustc-1.58.0-src/Cargo.lock 2022-01-11 16:22:54.313011908 -0800
@@ -877,7 +877,6 @@ @@ -909,7 +909,6 @@
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -8,7 +8,7 @@
"libz-sys", "libz-sys",
"openssl-sys", "openssl-sys",
"pkg-config", "pkg-config",
@@ -1907,16 +1906,6 @@ @@ -1927,16 +1926,6 @@
checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
[[package]] [[package]]
@ -25,20 +25,20 @@
name = "libz-sys" name = "libz-sys"
version = "1.1.3" version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
--- rustc-1.56.0-src/src/tools/cargo/Cargo.toml.orig 2021-10-19 18:03:53.930187532 -0700 --- rustc-1.58.0-src/src/tools/cargo/Cargo.toml.orig 2022-01-11 16:13:10.127323771 -0800
+++ rustc-1.56.0-src/src/tools/cargo/Cargo.toml 2021-10-19 18:05:13.663211469 -0700 +++ rustc-1.58.0-src/src/tools/cargo/Cargo.toml 2022-01-11 16:14:50.721203730 -0800
@@ -25,7 +25,7 @@ @@ -22,7 +22,7 @@
cargo-util = { path = "crates/cargo-util", version = "0.1.1" } cargo-util = { path = "crates/cargo-util", version = "0.1.1" }
crates-io = { path = "crates/crates-io", version = "0.33.0" } crates-io = { path = "crates/crates-io", version = "0.33.0" }
crossbeam-utils = "0.8" crossbeam-utils = "0.8"
-curl = { version = "0.4.38", features = ["http2"] } -curl = { version = "0.4.41", features = ["http2"] }
+curl = { version = "0.4.38", features = [] } +curl = { version = "0.4.41", features = [] }
curl-sys = "0.4.48" curl-sys = "0.4.50"
env_logger = "0.9.0" env_logger = "0.9.0"
pretty_env_logger = { version = "0.4", optional = true } pretty_env_logger = { version = "0.4", optional = true }
--- rustc-1.56.0-src/src/tools/cargo/src/cargo/core/package.rs.orig 2021-10-18 02:52:56.000000000 -0700 --- rustc-1.58.0-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-01-11 03:18:44.000000000 -0800
+++ rustc-1.56.0-src/src/tools/cargo/src/cargo/core/package.rs 2021-10-19 18:03:53.931187507 -0700 +++ rustc-1.58.0-src/src/tools/cargo/src/cargo/core/package.rs 2022-01-11 16:13:10.127323771 -0800
@@ -417,14 +417,8 @@ @@ -419,14 +419,8 @@
// Also note that pipelining is disabled as curl authors have indicated // 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 // that it's buggy, and we've empirically seen that it's buggy with HTTP
// proxies. // proxies.
@ -55,7 +55,7 @@
Ok(PackageSet { Ok(PackageSet {
packages: package_ids packages: package_ids
@@ -653,7 +647,7 @@ @@ -655,7 +649,7 @@
macro_rules! try_old_curl { macro_rules! try_old_curl {
($e:expr, $msg:expr) => { ($e:expr, $msg:expr) => {
let result = $e; let result = $e;

View File

@ -5,14 +5,14 @@
# The channel can be stable, beta, or nightly # The channel can be stable, beta, or nightly
%{!?channel: %global channel stable} %{!?channel: %global channel stable}
# To bootstrap from scratch, set the channel and date from src/stage0.txt # To bootstrap from scratch, set the channel and date from src/stage0.json
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
# or nightly wants some beta-YYYY-MM-DD # or nightly wants some beta-YYYY-MM-DD
# Note that cargo matches the program version here, not its crate version. # Note that cargo matches the program version here, not its crate version.
%global bootstrap_rust 1.55.0 %global bootstrap_rust 1.57.0
%global bootstrap_cargo 1.55.0 %global bootstrap_cargo 1.57.0
%global bootstrap_channel 1.55.0 %global bootstrap_channel 1.57.0
%global bootstrap_date 2021-09-09 %global bootstrap_date 2021-12-02
# Only the specified arches will use bootstrap binaries. # Only the specified arches will use bootstrap binaries.
#global bootstrap_arches %%{rust_arches} #global bootstrap_arches %%{rust_arches}
@ -21,34 +21,42 @@
# cross-compilation. The packages are noarch, but they're not fully # cross-compilation. The packages are noarch, but they're not fully
# reproducible between hosts, so only x86_64 actually builds it. # reproducible between hosts, so only x86_64 actually builds it.
%ifarch x86_64 %ifarch x86_64
%if 0%{?fedora}
%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu
%endif
%if 0%{?fedora} || 0%{?rhel} >= 8 %if 0%{?fedora} || 0%{?rhel} >= 8
%global cross_targets wasm32-unknown-unknown wasm32-wasi %global wasm_targets wasm32-unknown-unknown wasm32-wasi
%endif %endif
%endif %endif
# We need CRT files for *-wasi targets, at least as new as the commit in # 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 # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
%global forgeurl1 https://github.com/WebAssembly/wasi-libc %global wasi_libc_url https://github.com/WebAssembly/wasi-libc
%global commit1 ad5133410f66b93a2381db5b542aad5e0964db96 %global wasi_libc_commit ad5133410f66b93a2381db5b542aad5e0964db96
%forgemeta -z 1 %global wasi_libc_name wasi-libc-%{wasi_libc_commit}
%undefine distprefix1 %global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_commit}/%{wasi_libc_name}.tar.gz
%global wasi_libc_source %{forgesource1} %global wasi_libc_dir %{_builddir}/%{wasi_libc_name}
%global wasi_libc_dir %{_builddir}/%{extractdir1}
# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.
%bcond_with llvm_static %bcond_with llvm_static
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM # We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 10.0+. # is insufficient. Rust currently requires LLVM 12.0+.
%global min_llvm_version 12.0.0
%global bundled_llvm_version 13.0.0
%bcond_with bundled_llvm %bcond_with bundled_llvm
# Requires stable libgit2 1.1 # Requires stable libgit2 1.3
%if 0%{?fedora} >= 34 %global min_libgit2_version 1.3.0
%global bundled_libgit2_version 1.3.0
%if 0%{?fedora} >= 36
%bcond_with bundled_libgit2 %bcond_with bundled_libgit2
%else %else
%bcond_without bundled_libgit2 %bcond_without bundled_libgit2
%endif %endif
# needs libssh2_userauth_publickey_frommemory
%global min_libssh2_version 1.6.0
%if 0%{?rhel} %if 0%{?rhel}
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
%bcond_without disabled_libssh2 %bcond_without disabled_libssh2
@ -70,8 +78,8 @@
%endif %endif
Name: rust Name: rust
Version: 1.56.1 Version: 1.58.0
Release: 2%{?dist} Release: 1%{?dist}
Summary: The Rust Programming Language Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and MIT) License: (ASL 2.0 or MIT) and (BSD and MIT)
# ^ written as: (rust itself) and (bundled libraries) # ^ written as: (rust itself) and (bundled libraries)
@ -87,13 +95,8 @@ Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
Source1: %{wasi_libc_source} Source1: %{wasi_libc_source}
# Sources for bootstrap_arches are inserted by lua below # Sources for bootstrap_arches are inserted by lua below
# An internal rust-abi change broke s390x, but it's fixed in LLVM 12.0.1.
# We'll revert the change on Fedora 33 that has an unpatched LLVM 11.
# 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. # By default, rust tries to use "rust-lld" as a linker for WebAssembly.
Patch2: 0001-Use-lld-provided-by-system-for-wasm.patch Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch
### RHEL-specific patches below ### ### RHEL-specific patches below ###
@ -102,11 +105,12 @@ Patch100: rustc-1.56.0-disable-libssh2.patch
# libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # 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. # will try to build it statically -- instead we turn off the feature.
Patch101: rustc-1.56.0-disable-http2.patch Patch101: rustc-1.58.0-disable-http2.patch
# kernel rh1410097 causes too-small stacks for PIE. # kernel rh1410097 causes too-small stacks for PIE.
# (affects RHEL6 kernels when building for RHEL7) # (affects RHEL6 kernels when building for RHEL7)
Patch102: rustc-1.51.0-no-default-pie.patch Patch102: rustc-1.57.0-no-default-pie.patch
# Get the Rust triple for any arch. # Get the Rust triple for any arch.
%{lua: function rust_triple(arch) %{lua: function rust_triple(arch)
@ -167,7 +171,6 @@ BuildRequires: make
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
BuildRequires: curl
# explicit curl-devel to avoid httpd24-curl (rhbz1540167) # explicit curl-devel to avoid httpd24-curl (rhbz1540167)
BuildRequires: curl-devel BuildRequires: curl-devel
BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(libcurl)
@ -175,26 +178,29 @@ BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(zlib)
%if %without bundled_libgit2 %if %{without bundled_libgit2}
BuildRequires: pkgconfig(libgit2) >= 1.1.0 BuildRequires: pkgconfig(libgit2) >= %{min_libgit2_version}
%endif %endif
%if %{without disabled_libssh2} %if %{without disabled_libssh2}
# needs libssh2_userauth_publickey_frommemory BuildRequires: pkgconfig(libssh2) >= %{min_libssh2_version}
BuildRequires: pkgconfig(libssh2) >= 1.6.0
%endif %endif
%global python python3 %if 0%{?rhel} == 8
BuildRequires: %{python} BuildRequires: platform-python
%else
BuildRequires: python3
%endif
BuildRequires: python3-rpm-macros
%if %with bundled_llvm %if %with bundled_llvm
BuildRequires: cmake3 >= 3.13.4 BuildRequires: cmake3 >= 3.13.4
BuildRequires: ninja-build BuildRequires: ninja-build
Provides: bundled(llvm) = 13.0.0 Provides: bundled(llvm) = %{bundled_llvm_version}
%else %else
BuildRequires: cmake >= 2.8.11 BuildRequires: cmake >= 2.8.11
%if 0%{?epel} == 7 %if 0%{?epel} == 7
%global llvm llvm11 %global llvm llvm13
%endif %endif
%if %defined llvm %if %defined llvm
%global llvm_root %{_libdir}/%{llvm} %global llvm_root %{_libdir}/%{llvm}
@ -202,14 +208,14 @@ BuildRequires: cmake >= 2.8.11
%global llvm llvm %global llvm llvm
%global llvm_root %{_prefix} %global llvm_root %{_prefix}
%endif %endif
BuildRequires: %{llvm}-devel >= 10.0 BuildRequires: %{llvm}-devel >= %{min_llvm_version}
%if %with llvm_static %if %with llvm_static
BuildRequires: %{llvm}-static BuildRequires: %{llvm}-static
BuildRequires: libffi-devel BuildRequires: libffi-devel
%endif %endif
%endif %endif
# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs # make check needs "ps" for src/test/ui/wait-forked-but-failed-child.rs
BuildRequires: procps-ng BuildRequires: procps-ng
# debuginfo-gdb tests need gdb # debuginfo-gdb tests need gdb
@ -229,10 +235,17 @@ Requires: /usr/bin/cc
%if 0%{?epel} == 7 %if 0%{?epel} == 7
%global devtoolset_name devtoolset-9 %global devtoolset_name devtoolset-9
BuildRequires: %{devtoolset_name}-binutils
BuildRequires: %{devtoolset_name}-gcc BuildRequires: %{devtoolset_name}-gcc
BuildRequires: %{devtoolset_name}-gcc-c++ BuildRequires: %{devtoolset_name}-gcc-c++
%global __cc /opt/rh/%{devtoolset_name}/root/usr/bin/gcc %global devtoolset_bindir /opt/rh/%{devtoolset_name}/root/usr/bin
%global __cxx /opt/rh/%{devtoolset_name}/root/usr/bin/g++ %global __cc %{devtoolset_bindir}/gcc
%global __cxx %{devtoolset_bindir}/g++
%global __ar %{devtoolset_bindir}/ar
%global __ranlib %{devtoolset_bindir}/ranlib
%global __strip %{devtoolset_bindir}/strip
%else
%global __ranlib %{_bindir}/ranlib
%endif %endif
# ALL Rust libraries are private, because they don't keep an ABI. # ALL Rust libraries are private, because they don't keep an ABI.
@ -254,9 +267,6 @@ BuildRequires: %{devtoolset_name}-gcc-c++
%global _find_debuginfo_opts --keep-section .rustc %global _find_debuginfo_opts --keep-section .rustc
%endif %endif
# Use hardening ldflags.
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
%if %{without bundled_llvm} %if %{without bundled_llvm}
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1} %if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1}
%global llvm_has_filecheck 1 %global llvm_has_filecheck 1
@ -268,7 +278,14 @@ BuildRequires: %{devtoolset_name}-gcc-c++
%global common_libdir %{_prefix}/lib %global common_libdir %{_prefix}/lib
%global rustlibdir %{common_libdir}/rustlib %global rustlibdir %{common_libdir}/rustlib
%if %defined cross_targets %if %defined mingw_targets
BuildRequires: mingw32-filesystem >= 95
BuildRequires: mingw64-filesystem >= 95
BuildRequires: mingw32-gcc
BuildRequires: mingw64-gcc
%endif
%if %defined wasm_targets
BuildRequires: clang BuildRequires: clang
# brp-strip-static-archive breaks the archive index for wasm # brp-strip-static-archive breaks the archive index for wasm
%global __os_install_post \ %global __os_install_post \
@ -286,36 +303,67 @@ This package includes the Rust compiler and documentation generator.
%package std-static %package std-static
Summary: Standard library for Rust Summary: Standard library for Rust
Requires: %{name} = %{version}-%{release}
Requires: glibc-devel%{?_isa} >= 2.11
%description std-static %description std-static
This package includes the standard libraries for building applications This package includes the standard libraries for building applications
written in Rust. written in Rust.
%if %defined cross_targets %if %defined mingw_targets
%{lua: do %{lua: do
for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do
local subs = { local subs = {
triple = triple, 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([[
%package std-static-{{triple}}
Summary: Standard library for Rust {{triple}}
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}
%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}"), verrel = rpm.expand("%{version}-%{release}"),
wasm = string.sub(triple, 1, 4) == "wasm" and 1 or 0,
wasi = string.find(triple, "-wasi") and 1 or 0, wasi = string.find(triple, "-wasi") and 1 or 0,
} }
local s = string.gsub([[ local s = string.gsub([[
%package std-static-{{triple}} %package std-static-{{triple}}
Summary: Standard library for Rust Summary: Standard library for Rust {{triple}}
BuildArch: noarch BuildArch: noarch
Requires: rust = {{verrel}} Requires: {{name}} = {{verrel}}
%if {{wasm}}
Requires: lld >= 8.0 Requires: lld >= 8.0
%endif
%if {{wasi}} %if {{wasi}}
Provides: bundled(wasi-libc) Provides: bundled(wasi-libc)
%endif %endif
%description std-static-{{triple}} %description std-static-{{triple}}
This package includes the standard libraries for building applications This package includes the standard libraries for building applications
written in Rust for the {{triple}} target. written in Rust for the WebAssembly target {{triple}}.
]], "{{(%w+)}}", subs) ]], "{{(%w+)}}", subs)
print(s) print(s)
@ -349,7 +397,7 @@ programs.
Summary: LLDB pretty printers for Rust Summary: LLDB pretty printers for Rust
BuildArch: noarch BuildArch: noarch
Requires: lldb Requires: lldb
Requires: %{python}-lldb Requires: python3-lldb
Requires: %{name}-debugger-common = %{version}-%{release} Requires: %{name}-debugger-common = %{version}-%{release}
%description lldb %description lldb
@ -374,12 +422,12 @@ its standard library.
%package -n cargo %package -n cargo
Summary: Rust's package manager and build tool Summary: Rust's package manager and build tool
%if %with bundled_libgit2 %if %with bundled_libgit2
Provides: bundled(libgit2) = 1.1.0 Provides: bundled(libgit2) = %{bundled_libgit2_version}
%endif %endif
# For tests: # For tests:
BuildRequires: git BuildRequires: git-core
# Cargo is not much use without Rust # Cargo is not much use without Rust
Requires: rust Requires: %{name}
# "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and # "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and
# Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too # Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too
@ -396,7 +444,7 @@ Summary: Documentation for Cargo
BuildArch: noarch BuildArch: noarch
# Cargo no longer builds its own documentation # Cargo no longer builds its own documentation
# https://github.com/rust-lang/cargo/pull/4904 # https://github.com/rust-lang/cargo/pull/4904
Requires: rust-doc = %{version}-%{release} Requires: %{name}-doc = %{version}-%{release}
%description -n cargo-doc %description -n cargo-doc
This package includes HTML documentation for Cargo. This package includes HTML documentation for Cargo.
@ -417,9 +465,9 @@ A tool for formatting Rust code according to style guidelines.
%package -n rls %package -n rls
Summary: Rust Language Server for IDE integration Summary: Rust Language Server for IDE integration
%if %with bundled_libgit2 %if %with bundled_libgit2
Provides: bundled(libgit2) = 1.1.0 Provides: bundled(libgit2) = %{bundled_libgit2_version}
%endif %endif
Requires: rust-analysis Requires: %{name}-analysis
# /usr/bin/rls is dynamically linked against internal rustc libs # /usr/bin/rls is dynamically linked against internal rustc libs
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
@ -477,18 +525,13 @@ test -f '%{local_rust_root}/bin/cargo'
test -f '%{local_rust_root}/bin/rustc' test -f '%{local_rust_root}/bin/rustc'
%endif %endif
%if %defined cross_targets %if %defined wasm_targets
%forgesetup -z 1 %setup -q -n %{wasi_libc_name} -T -b 1
%endif %endif
%setup -q -n %{rustc_package} %setup -q -n %{rustc_package}
%if 0%{?fedora} == 33
# revert only for LLVM 11
%patch1 -p1 %patch1 -p1
%endif
%patch2 -p1
%if %with disabled_libssh2 %if %with disabled_libssh2
%patch100 -p1 %patch100 -p1
@ -503,10 +546,8 @@ rm -rf vendor/libnghttp2-sys/
%patch102 -p1 %patch102 -p1
%endif %endif
%if "%{python}" != "python3" # Use our explicit python3 first
# Use our preferred python first sed -i.try-python -e '/^try python3 /i try "%{__python3}" "$@"' ./configure
sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure
%endif
%if %without bundled_llvm %if %without bundled_llvm
rm -rf src/llvm-project/ rm -rf src/llvm-project/
@ -557,22 +598,19 @@ find vendor -name .cargo-checksum.json \
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
# Set up shared environment variables for build/install/check # Set up shared environment variables for build/install/check
%global rust_env RUSTFLAGS="%{rustflags}" %global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"}
%if 0%{?cmake_path:1} %if 0%{?cmake_path:1}
%global rust_env %{rust_env} PATH="%{cmake_path}:$PATH" %global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH"
%endif
%if %without bundled_libgit2
# convince libgit2-sys to use the distro libgit2
%global rust_env %{rust_env} LIBGIT2_SYS_USE_PKG_CONFIG=1
%endif %endif
%if %without disabled_libssh2 %if %without disabled_libssh2
# convince libssh2-sys to use the distro libssh2 # convince libssh2-sys to use the distro libssh2
%global rust_env %{rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1 %global rust_env %{?rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1
%endif %endif
%global export_rust_env %{?rust_env:export %{rust_env}}
%build %build
export %{rust_env} %{export_rust_env}
%ifarch %{arm} %{ix86} s390x %ifarch %{arm} %{ix86} s390x
# full debuginfo is exhausting memory; just do libstd for now # full debuginfo is exhausting memory; just do libstd for now
@ -596,29 +634,55 @@ if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then
ncpus="$max_cpus" ncpus="$max_cpus"
fi fi
%if %defined cross_targets %define target_config %{shrink:
%make_build -C %{wasi_libc_dir} --set target.%{rust_triple}.linker=%{__cc}
--set target.%{rust_triple}.cc=%{__cc}
--set target.%{rust_triple}.cxx=%{__cxx}
--set target.%{rust_triple}.ar=%{__ar}
--set target.%{rust_triple}.ranlib=%{__ranlib}
}
%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([[%{shrink:
--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
rpm.define("mingw_target_config " .. cfg)
end}
%endif
%if %defined wasm_targets
%make_build --quiet -C %{wasi_libc_dir}
%{lua: do %{lua: do
local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot" local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot"
local set_wasi_root = "" local cfg = ""
for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do
if string.find(triple, "-wasi") then if string.find(triple, "-wasi") then
set_wasi_root = set_wasi_root .. " --set target." .. triple .. ".wasi-root=" .. wasi_root cfg = cfg .. " --set target." .. triple .. ".wasi-root=" .. wasi_root
end end
end end
if wasi_root ~= "" then rpm.define("wasm_target_config "..cfg)
rpm.define("set_wasi_root "..set_wasi_root)
end
end} end}
%endif %endif
%configure --disable-option-checking \ %configure --disable-option-checking \
--libdir=%{common_libdir} \ --libdir=%{common_libdir} \
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
--set target.%{rust_triple}.linker=%{__cc} \ %{target_config} \
--set target.%{rust_triple}.cc=%{__cc} \ %{?mingw_target_config} \
--set target.%{rust_triple}.cxx=%{__cxx} \ %{?wasm_target_config} \
--python=%{python} \ --python=%{__python3} \
--local-rust-root=%{local_rust_root} \ --local-rust-root=%{local_rust_root} \
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
%{!?llvm_has_filecheck: --disable-codegen-tests} \ %{!?llvm_has_filecheck: --disable-codegen-tests} \
@ -630,30 +694,25 @@ end}
--tools=analysis,cargo,clippy,rls,rustfmt,src \ --tools=analysis,cargo,clippy,rls,rustfmt,src \
--enable-vendor \ --enable-vendor \
--enable-verbose-tests \ --enable-verbose-tests \
%{?set_wasi_root} \
--dist-compression-formats=gz \ --dist-compression-formats=gz \
--release-channel=%{channel} \ --release-channel=%{channel} \
--release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}" --release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}"
%{python} ./x.py build -j "$ncpus" --stage 2 %{__python3} ./x.py build -j "$ncpus" --stage 2
%{python} ./x.py doc --stage 2 %{__python3} ./x.py doc --stage 2
%if %defined cross_targets for triple in %{?mingw_targets} %{?wasm_targets}; do
for triple in %{cross_targets}; do %{__python3} ./x.py build --stage 2 --target=$triple std
%{python} ./x.py build --stage 2 --target=$triple std
done done
%endif
%install %install
export %{rust_env} %{export_rust_env}
DESTDIR=%{buildroot} %{python} ./x.py install DESTDIR=%{buildroot} %{__python3} ./x.py install
%if %defined cross_targets for triple in %{?mingw_targets} %{?wasm_targets}; do
for triple in %{cross_targets}; do DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std
DESTDIR=%{buildroot} %{python} ./x.py install --target=$triple std
done done
%endif
# These are transient files used by x.py dist and install # These are transient files used by x.py dist and install
rm -rf ./build/dist/ ./build/tmp/ rm -rf ./build/dist/ ./build/tmp/
@ -726,7 +785,7 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll*
%check %check
export %{rust_env} %{export_rust_env}
# Sanity-check the installed binaries, debuginfo-stripped and all. # Sanity-check the installed binaries, debuginfo-stripped and all.
%{buildroot}%{_bindir}/cargo new build/hello-world %{buildroot}%{_bindir}/cargo new build/hello-world
@ -736,18 +795,18 @@ env RUSTC=%{buildroot}%{_bindir}/rustc \
# The results are not stable on koji, so mask errors and just log it. # 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. # Some of the larger test artifacts are manually cleaned to save space.
%{python} ./x.py test --no-fail-fast --stage 2 || : %{__python3} ./x.py test --no-fail-fast --stage 2 || :
rm -rf "./build/%{rust_triple}/test/" rm -rf "./build/%{rust_triple}/test/"
%{python} ./x.py test --no-fail-fast --stage 2 cargo || : %{__python3} ./x.py test --no-fail-fast --stage 2 cargo || :
rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{python} ./x.py test --no-fail-fast --stage 2 clippy || : %{__python3} ./x.py test --no-fail-fast --stage 2 clippy || :
env RLS_TEST_WAIT_FOR_AGES=1 \ env RLS_TEST_WAIT_FOR_AGES=1 \
%{python} ./x.py test --no-fail-fast --stage 2 rls || : %{__python3} ./x.py test --no-fail-fast --stage 2 rls || :
%{python} ./x.py test --no-fail-fast --stage 2 rustfmt || : %{__python3} ./x.py test --no-fail-fast --stage 2 rustfmt || :
%ldconfig_scriptlets %ldconfig_scriptlets
@ -774,9 +833,35 @@ env RLS_TEST_WAIT_FOR_AGES=1 \
%{rustlibdir}/%{rust_triple}/lib/*.rlib %{rustlibdir}/%{rust_triple}/lib/*.rlib
%if %defined cross_targets %if %defined mingw_targets
%{lua: do %{lua: do
for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") 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}
%endif
%if %defined wasm_targets
%{lua: do
for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do
local subs = { local subs = {
triple = triple, triple = triple,
rustlibdir = rpm.expand("%{rustlibdir}"), rustlibdir = rpm.expand("%{rustlibdir}"),
@ -792,6 +877,7 @@ env RLS_TEST_WAIT_FOR_AGES=1 \
%if {{wasi}} %if {{wasi}}
%dir {{rustlibdir}}/{{triple}}/lib/self-contained %dir {{rustlibdir}}/{{triple}}/lib/self-contained
{{rustlibdir}}/{{triple}}/lib/self-contained/crt*.o {{rustlibdir}}/{{triple}}/lib/self-contained/crt*.o
{{rustlibdir}}/{{triple}}/lib/self-contained/libc.a
%endif %endif
]], "{{(%w+)}}", subs) ]], "{{(%w+)}}", subs)
@ -884,6 +970,12 @@ end}
%changelog %changelog
* Thu Jan 13 2022 Josh Stone <jistone@redhat.com> - 1.58.0-1
- Update to 1.58.0.
* Wed Dec 15 2021 Josh Stone <jistone@redhat.com> - 1.57.0-1
- Update to 1.57.0.
* Wed Dec 01 2021 Josh Stone <jistone@redhat.com> - 1.56.1-2 * Wed Dec 01 2021 Josh Stone <jistone@redhat.com> - 1.56.1-2
- Add rust-std-static-wasm32-wasi - Add rust-std-static-wasm32-wasi
Resolves: rhbz#1980082 Resolves: rhbz#1980082