Update to 1.73.0.

Also, use emmalloc instead of CC0 dlmalloc when bundling wasi-libc.

Resolves: RHEL-12965
This commit is contained in:
Josh Stone 2023-10-16 16:19:16 -07:00
parent b3e231bdd7
commit 46e57ff1eb
15 changed files with 458 additions and 812 deletions

2
.gitignore vendored
View File

@ -406,3 +406,5 @@
/rustc-1.72.0-src.tar.xz
/wasi-libc-7018e24d8fe248596819d2e884761676f3542a04.tar.gz
/rustc-1.72.1-src.tar.xz
/wasi-libc-bd950eb128bff337153de217b11270f948d04bb4.tar.gz
/rustc-1.73.0-src.tar.xz

View File

@ -1,142 +0,0 @@
From e276ae1cb702fa830be126cccce4bb9e8676f9fb Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
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<PathBuf>,
pub ndk: Option<PathBuf>,
pub sanitizers: Option<bool>,
- pub profiler: Option<bool>,
+ pub profiler: Option<StringOrBool>,
pub rpath: Option<bool>,
pub crt_static: Option<bool>,
pub musl_root: Option<PathBuf>,
@@ -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<String> = "llvm-libunwind",
android_ndk: Option<String> = "android-ndk",
sanitizers: Option<bool> = "sanitizers",
- profiler: Option<bool> = "profiler",
+ profiler: Option<StringOrBool> = "profiler",
rpath: Option<bool> = "rpath",
crt_static: Option<bool> = "crt-static",
musl_root: Option<String> = "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

View File

@ -1,201 +0,0 @@
From 98336f8f6e701ea99275f32d6e2127a621041994 Mon Sep 17 00:00:00 2001
From: Guillaume Gomez <guillaume.gomez@huawei.com>
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

View File

@ -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 <jistone@redhat.com>
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

View File

@ -1,26 +0,0 @@
From 37cb177eb53145103ae72b67562884782dde01c3 Mon Sep 17 00:00:00 2001
From: Ivan Mironov <mironov.ivan@gmail.com>
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

View File

@ -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

View File

@ -0,0 +1,102 @@
From 19c37083cdae94105f6429350dd0b6617e3c2d56 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
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 = <platform-specific> (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 = <platform-specific> (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<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
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<String> = "wasi-root",
qemu_rootfs: Option<String> = "qemu-rootfs",
no_std: Option<bool> = "no-std",
+ self_contained: Option<bool> = "self-contained",
}
}
@@ -1524,6 +1529,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
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<bool> {
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<bool> {
+ 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

View File

@ -1,54 +0,0 @@
From 6fce2a3e054185fb85d5a55a9e5a35d41a2c492e Mon Sep 17 00:00:00 2001
From: Krasimir Georgiev <krasimir@google.com>
Date: Wed, 12 Jul 2023 09:30:31 +0000
Subject: [PATCH 1/2] llvm-wrapper: adapt for LLVM API change
Adapts the wrapper for LLVM commit
https://github.com/llvm/llvm-project/commit/546ec641b4b1bbbf9e66a53983b635fe85d365e6.
Found by the experimental rust + LLVM @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/20723#01894922-ed5d-4830-81f6-a27fb82ec8c7/210-645
(cherry picked from commit 71958da4854176c50a8b12470b956d5c7ed11817)
---
compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index c43a02724773..eb3d67e720f2 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -667,6 +667,7 @@ LLVMRustOptimize(
assert(!PGOUsePath && !PGOSampleUsePath);
PGOOpt = PGOOptions(PGOGenPath, "", "",
#if LLVM_VERSION_GE(17, 0)
+ "",
FS,
#endif
PGOOptions::IRInstr, PGOOptions::NoCSAction,
@@ -675,6 +676,7 @@ LLVMRustOptimize(
assert(!PGOSampleUsePath);
PGOOpt = PGOOptions(PGOUsePath, "", "",
#if LLVM_VERSION_GE(17, 0)
+ "",
FS,
#endif
PGOOptions::IRUse, PGOOptions::NoCSAction,
@@ -682,6 +684,7 @@ LLVMRustOptimize(
} else if (PGOSampleUsePath) {
PGOOpt = PGOOptions(PGOSampleUsePath, "", "",
#if LLVM_VERSION_GE(17, 0)
+ "",
FS,
#endif
PGOOptions::SampleUse, PGOOptions::NoCSAction,
@@ -689,6 +692,7 @@ LLVMRustOptimize(
} else if (DebugInfoForProfiling) {
PGOOpt = PGOOptions("", "", "",
#if LLVM_VERSION_GE(17, 0)
+ "",
FS,
#endif
PGOOptions::NoAction, PGOOptions::NoCSAction,
--
2.41.0

View File

@ -0,0 +1,33 @@
From 1c6d867d78475fd8c6274e2b64ebb27735b6cabf Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
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

View File

@ -1,32 +0,0 @@
From 00b2ba45d6631b2e0d80bf187ddd4e8bd75d3aee Mon Sep 17 00:00:00 2001
From: Krasimir Georgiev <krasimir@google.com>
Date: Fri, 14 Jul 2023 12:10:29 +0000
Subject: [PATCH 2/2] llvm-wrapper: update for LLVM API change
No functional changes intended.
Adds an include for llvm::SmallString. Previously, this must have been
implicitly provided by some of the existing headers. With recent LLVM
changes, not anymore:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/20776#01895448-44a4-4a1e-8407-9d41d0186132/209-690
(cherry picked from commit 6ddf9128b2b55f9def80af57f7353d2521527c6a)
---
compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
index 0493d6b05d03..bf00d11edf6d 100644
--- a/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
@@ -7,6 +7,7 @@
// * https://github.com/llvm/llvm-project/blob/8ef3e895ad8ab1724e2b87cabad1dacdc7a397a3/llvm/include/llvm/Object/ArchiveWriter.h
// * https://github.com/llvm/llvm-project/blob/8ef3e895ad8ab1724e2b87cabad1dacdc7a397a3/llvm/lib/Object/ArchiveWriter.cpp
+#include "llvm/ADT/SmallString.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Object/ObjectFile.h"
--
2.41.0

View File

@ -0,0 +1,78 @@
From 3016b2b7052d8b01d50c3a3c6591aeb99d918ca3 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
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<StaticCow<str>>,
/// 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

431
rust.spec
View File

@ -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,28 +26,38 @@
%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
%if 0%{?fedora} || 0%{?rhel} >= 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
# (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
# 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.
@ -70,21 +80,8 @@
%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
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)
@ -101,8 +98,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
@ -111,23 +108,19 @@ 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
# 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
# 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
# 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
# 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
# Compatibility fixes for LLVM 17
# https://github.com/rust-lang/rust/pull/113615
# https://github.com/rust-lang/rust/pull/113688
Patch7: 0001-llvm-wrapper-adapt-for-LLVM-API-change.patch
Patch8: 0002-llvm-wrapper-update-for-LLVM-API-change.patch
# wasi: round up the size for aligned_alloc
# https://github.com/rust-lang/rust/pull/115254
Patch7: 0001-wasi-round-up-the-size-for-aligned_alloc.patch
### RHEL-specific patches below ###
@ -135,11 +128,7 @@ Patch8: 0002-llvm-wrapper-update-for-LLVM-API-change.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)
@ -157,14 +146,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.
@ -198,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
@ -242,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
%global llvm llvm16
%endif
%if %defined llvm
%global llvm_root %{_libdir}/%{llvm}
%else
@ -305,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}
@ -337,7 +308,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 \
@ -346,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
@ -372,65 +345,67 @@ 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
%if {{wasi}}
Provides: bundled(wasi-libc)
BuildArch: noarch
%target_description wasm32-unknown-unknown WebAssembly
%endif
%description std-static-{{triple}}
This package includes the standard libraries for building applications
written in Rust for the WebAssembly target {{triple}}.
%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
]], "{{(%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 %target_enabled x86_64-unknown-uefi
%target_package x86_64-unknown-uefi
Requires: lld
%target_description x86_64-unknown-uefi embedded
%endif
@ -453,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
@ -466,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
@ -511,6 +482,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}
@ -523,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.
@ -558,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
@ -598,8 +564,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}
@ -608,20 +575,16 @@ 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
%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
@ -684,7 +647,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 =
@ -693,11 +656,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
@ -713,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
@ -733,45 +690,40 @@ 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.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
%{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}
%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
# 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
%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)
%endif
test -r "%{profiler}"
%configure --disable-option-checking \
--libdir=%{common_libdir} \
@ -781,7 +733,7 @@ PROFILER=$(find %{_libdir}/clang -type f -name 'libclang_rt.profile-*.a')
--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} \
@ -809,7 +761,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 %{?all_targets} ; do
%{__python3} ./x.py build --target=$triple std
done
@ -821,7 +773,7 @@ done
DESTDIR=%{buildroot} %{__python3} ./x.py install
for triple in %{?mingw_targets} %{?wasm_targets}; do
for triple in %{?all_targets} ; do
DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std
done
@ -892,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*
@ -914,23 +861,28 @@ 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 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
# Sanity-check that code-coverage builds and runs
env RUSTFLAGS="-Cinstrument-coverage" %{buildroot}%{_bindir}/cargo run --verbose
test -r default_*.profraw
# 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.
# 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 || :
@ -967,58 +919,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
%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
%endif
]], "{{(%w+)}}", subs)
print(s)
end
end}
%if %target_enabled wasm32-unknown-unknown
%target_files wasm32-unknown-unknown
%endif
%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
%endif
%if %target_enabled x86_64-unknown-uefi
%target_files x86_64-unknown-uefi
%endif
@ -1034,11 +974,9 @@ end}
%exclude %{_bindir}/rust-gdbgui
%if %with lldb
%files lldb
%{_bindir}/rust-lldb
%{rustlibdir}/etc/lldb_*
%endif
%files doc
@ -1055,7 +993,6 @@ end}
%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
@ -1096,6 +1033,10 @@ end}
%changelog
* Tue Oct 17 2023 Josh Stone <jistone@redhat.com> - 1.73.0-1
- Update to 1.73.0.
- Use emmalloc instead of CC0 dlmalloc when bundling wasi-libc
* Thu Oct 12 2023 Josh Stone <jistone@redhat.com> - 1.72.1-1
- Update to 1.72.1.
- Migrated to SPDX license

View File

@ -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<PackageSet<'cfg>> {
- // 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);
}

View File

@ -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" ] }

View File

@ -1,2 +1,2 @@
SHA512 (rustc-1.72.1-src.tar.xz) = 08232b5bf36f82a995d67f3d03d5e35b7d8914d31fb4491d4c37b72a830bc438e9d18d9e138d398b1b6ae4aa09f7f8e1e9b68da6273ab74bdae4c6123586a21b
SHA512 (wasi-libc-7018e24d8fe248596819d2e884761676f3542a04.tar.gz) = a2a4a952c3d9795792be8f055387057befaebe0675ad2464a478cb1f2c45d65f233e0ee4c4dbcaa137bf9649882ff6c6acf2f2bec07b2ad89f63ff980d972e6b
SHA512 (rustc-1.73.0-src.tar.xz) = 75c59680a82cb9d076b9434744a1c65908524ef769293952f5d9c5779d9a9c6fa4d9aa0c7e7d6b7566a21a50a27cd6ae452b5283a4d4606b2fa1acc24dfd8e0c
SHA512 (wasi-libc-bd950eb128bff337153de217b11270f948d04bb4.tar.gz) = 01e5cc3ebdab239f57816ff80f939fd87a5491a28951daf74b3310b118b4820c098ac9417771c9c6af55ca91d2cabe6498975ab9db4914aba754d87067cd1066