summaryrefslogtreecommitdiff
path: root/devel/rust/system.diff
blob: 0fb21ceff58565bf69d3c2a1cad7a93bb42ee837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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,