summaryrefslogtreecommitdiff
path: root/devel/rust/system.diff
diff options
context:
space:
mode:
Diffstat (limited to 'devel/rust/system.diff')
-rw-r--r--devel/rust/system.diff119
1 files changed, 119 insertions, 0 deletions
diff --git a/devel/rust/system.diff b/devel/rust/system.diff
new file mode 100644
index 0000000..0fb21ce
--- /dev/null
+++ b/devel/rust/system.diff
@@ -0,0 +1,119 @@
+diff --git a/compiler/rustc_target/src/spec/crt_objects.rs b/compiler/rustc_target/src/spec/crt_objects.rs
+index 2d84e78f..0f4d75ea 100644
+--- a/compiler/rustc_target/src/spec/crt_objects.rs
++++ b/compiler/rustc_target/src/spec/crt_objects.rs
+@@ -62,6 +62,7 @@ pub(super) fn all(obj: &'static str) -> CrtObjects {
+ ])
+ }
+
++#[allow(dead_code)]
+ pub(super) fn pre_musl_self_contained() -> CrtObjects {
+ new(&[
+ (LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]),
+@@ -73,6 +74,7 @@ pub(super) fn pre_musl_self_contained() -> CrtObjects {
+ ])
+ }
+
++#[allow(dead_code)]
+ pub(super) fn post_musl_self_contained() -> CrtObjects {
+ new(&[
+ (LinkOutputKind::DynamicNoPicExe, &["crtend.o", "crtn.o"]),
+diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
+index 02940a80..d5a6de33 100644
+--- a/src/bootstrap/src/core/build_steps/compile.rs
++++ b/src/bootstrap/src/core/build_steps/compile.rs
+@@ -375,54 +375,7 @@ fn copy_self_contained_objects(
+ t!(fs::create_dir_all(&libdir_self_contained));
+ let mut target_deps = vec![];
+
+- // Copies the libc and CRT objects.
+- //
+- // rustc historically provides a more self-contained installation for musl targets
+- // not requiring the presence of a native musl toolchain. For example, it can fall back
+- // to using gcc from a glibc-targeting toolchain for linking.
+- // To do that we have to distribute musl startup objects as a part of Rust toolchain
+- // and link with them manually in the self-contained mode.
+- if target.needs_crt_begin_end() {
+- let srcdir = builder.musl_libdir(target).unwrap_or_else(|| {
+- panic!("Target {:?} does not have a \"musl-libdir\" key", target.triple)
+- });
+- if !target.starts_with("wasm32") {
+- for &obj in &["libc.a", "crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] {
+- copy_and_stamp(
+- builder,
+- &libdir_self_contained,
+- &srcdir,
+- obj,
+- &mut target_deps,
+- DependencyType::TargetSelfContained,
+- );
+- }
+- let crt_path = builder.ensure(llvm::CrtBeginEnd { target });
+- for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] {
+- let src = crt_path.join(obj);
+- let target = libdir_self_contained.join(obj);
+- builder.copy_link(&src, &target, FileType::NativeLibrary);
+- target_deps.push((target, DependencyType::TargetSelfContained));
+- }
+- } else {
+- // For wasm32 targets, we need to copy the libc.a and crt1-command.o files from the
+- // musl-libdir, but we don't need the other files.
+- for &obj in &["libc.a", "crt1-command.o"] {
+- copy_and_stamp(
+- builder,
+- &libdir_self_contained,
+- &srcdir,
+- obj,
+- &mut target_deps,
+- DependencyType::TargetSelfContained,
+- );
+- }
+- }
+- if !target.starts_with("s390x") {
+- let libunwind_path = copy_llvm_libunwind(builder, target, &libdir_self_contained);
+- target_deps.push((libunwind_path, DependencyType::TargetSelfContained));
+- }
+- } else if target.contains("-wasi") {
++ if target.contains("-wasi") {
+ let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| {
+ panic!(
+ "Target {:?} does not have a \"wasi-root\" key in bootstrap.toml \
+diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
+index 50d81540..3818e081 100644
+--- a/src/bootstrap/src/core/sanity.rs
++++ b/src/bootstrap/src/core/sanity.rs
+@@ -367,22 +367,6 @@ than building it.
+ continue;
+ }
+
+- // Make sure musl-root is valid.
+- if target.contains("musl") && !target.contains("unikraft") {
+- match build.musl_libdir(*target) {
+- Some(libdir) => {
+- if fs::metadata(libdir.join("libc.a")).is_err() {
+- panic!("couldn't find libc.a in musl libdir: {}", libdir.display());
+- }
+- }
+- None => panic!(
+- "when targeting MUSL either the rust.musl-root \
+- option or the target.$TARGET.musl-root option must \
+- be specified in bootstrap.toml"
+- ),
+- }
+- }
+-
+ if need_cmake && target.is_msvc() {
+ // There are three builds of cmake on windows: MSVC, MinGW, and
+ // Cygwin. The Cygwin build does not have generators for Visual
+diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
+index a31eb0c1..b941b0b1 100644
+--- a/src/bootstrap/src/lib.rs
++++ b/src/bootstrap/src/lib.rs
+@@ -261,6 +261,7 @@ pub struct Build {
+ step_graph: std::cell::RefCell<crate::utils::step_graph::StepGraph>,
+ }
+
++#[allow(dead_code)]
+ #[derive(Debug, Clone)]
+ struct Crate {
+ name: String,