Skip to content

Commit ddcd157

Browse files
authored
Merge branch 'master' into rusty-hermit
2 parents 8a11c61 + 57bfb80 commit ddcd157

File tree

230 files changed

+3542
-2746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+3542
-2746
lines changed

.gitignore

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# This file should only ignore things that are generated during a build,
2-
# generated by common IDEs, and optional files controlled by the user
3-
# that affect the build (such as config.toml).
1+
# This file should only ignore things that are generated during a `x.py` build,
2+
# generated by common IDEs, and optional files controlled by the user that
3+
# affect the build (such as config.toml).
4+
# In particular, things like `mir_dump` should not be listed here; they are only
5+
# created during manual debugging and many people like to clean up instead of
6+
# having git ignore such leftovers. You can use `.git/info/exclude` to
7+
# configure your local ignore list.
48
# FIXME: This needs cleanup.
59
*~
610
.#*
@@ -52,3 +56,4 @@ config.stamp
5256
Session.vim
5357
.cargo
5458
no_llvm_build
59+
# Before adding new lines, see the comment at the top.

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
[submodule "src/doc/rust-by-example"]
2929
path = src/doc/rust-by-example
3030
url = https://github.com/rust-lang/rust-by-example.git
31-
[submodule "src/llvm-emscripten"]
32-
path = src/llvm-emscripten
33-
url = https://github.com/rust-lang/llvm.git
3431
[submodule "src/stdarch"]
3532
path = src/stdarch
3633
url = https://github.com/rust-lang/stdarch.git

Cargo.lock

+3-2
Original file line numberDiff line numberDiff line change
@@ -1724,9 +1724,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
17241724

17251725
[[package]]
17261726
name = "libc"
1727-
version = "0.2.62"
1727+
version = "0.2.64"
17281728
source = "registry+https://github.com/rust-lang/crates.io-index"
1729-
checksum = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
1729+
checksum = "74dfca3d9957906e8d1e6a0b641dc9a59848e793f1da2165889fd4f62d10d79c"
17301730
dependencies = [
17311731
"rustc-std-workspace-core",
17321732
]
@@ -3567,6 +3567,7 @@ dependencies = [
35673567
"rustc_plugin_impl",
35683568
"rustc_privacy",
35693569
"rustc_resolve",
3570+
"rustc_target",
35703571
"rustc_traits",
35713572
"rustc_typeck",
35723573
"serialize",

config.toml.example

+1-4
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,7 @@
374374

375375
# This is an array of the codegen backends that will be compiled for the rustc
376376
# that's being compiled. The default is to only build the LLVM codegen backend,
377-
# but you can also optionally enable the "emscripten" backend for asm.js or
378-
# make this an empty array (but that probably won't get too far in the
379-
# bootstrap)
380-
# FIXME: remove the obsolete emscripten backend option.
377+
# and currently the only standard option supported is `"llvm"`
381378
#codegen-backends = ["llvm"]
382379

383380
# This is the name of the directory in which codegen backends will get installed

src/bootstrap/bootstrap.py

-4
Original file line numberDiff line numberDiff line change
@@ -734,10 +734,6 @@ def update_submodules(self):
734734
if module.endswith("llvm-project"):
735735
if self.get_toml('llvm-config') and self.get_toml('lld') != 'true':
736736
continue
737-
if module.endswith("llvm-emscripten"):
738-
backends = self.get_toml('codegen-backends')
739-
if backends is None or not 'emscripten' in backends:
740-
continue
741737
check = self.check_submodule(module, slow_submodules)
742738
filtered_submodules.append((module, check))
743739
submodules_names.append(module)

src/bootstrap/cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl Ord for Interned<String> {
161161
}
162162
}
163163

164-
struct TyIntern<T: Hash + Clone + Eq> {
164+
struct TyIntern<T: Clone + Eq> {
165165
items: Vec<T>,
166166
set: HashMap<T, Interned<T>>,
167167
}

src/bootstrap/compile.rs

+7-20
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ pub fn std_cargo(builder: &Builder<'_>,
210210
// config.toml equivalent) is used
211211
let llvm_config = builder.ensure(native::Llvm {
212212
target: builder.config.build,
213-
emscripten: false,
214213
});
215214
cargo.env("LLVM_CONFIG", llvm_config);
216215
cargo.env("RUSTC_BUILD_SANITIZERS", "1");
@@ -615,36 +614,27 @@ pub fn build_codegen_backend(builder: &Builder<'_>,
615614
compiler: &Compiler,
616615
target: Interned<String>,
617616
backend: Interned<String>) -> String {
618-
let mut features = String::new();
619-
620617
match &*backend {
621-
"llvm" | "emscripten" => {
618+
"llvm" => {
622619
// Build LLVM for our target. This will implicitly build the
623620
// host LLVM if necessary.
624621
let llvm_config = builder.ensure(native::Llvm {
625622
target,
626-
emscripten: backend == "emscripten",
627623
});
628624

629-
if backend == "emscripten" {
630-
features.push_str(" emscripten");
631-
}
632-
633625
builder.info(&format!("Building stage{} codegen artifacts ({} -> {}, {})",
634626
compiler.stage, &compiler.host, target, backend));
635627

636628
// Pass down configuration from the LLVM build into the build of
637629
// librustc_llvm and librustc_codegen_llvm.
638-
if builder.is_rust_llvm(target) && backend != "emscripten" {
630+
if builder.is_rust_llvm(target) {
639631
cargo.env("LLVM_RUSTLLVM", "1");
640632
}
641633

642634
cargo.env("LLVM_CONFIG", &llvm_config);
643-
if backend != "emscripten" {
644-
let target_config = builder.config.target_config.get(&target);
645-
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
646-
cargo.env("CFG_LLVM_ROOT", s);
647-
}
635+
let target_config = builder.config.target_config.get(&target);
636+
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
637+
cargo.env("CFG_LLVM_ROOT", s);
648638
}
649639
// Some LLVM linker flags (-L and -l) may be needed to link librustc_llvm.
650640
if let Some(ref s) = builder.config.llvm_ldflags {
@@ -662,9 +652,7 @@ pub fn build_codegen_backend(builder: &Builder<'_>,
662652
"libstdc++.a");
663653
cargo.env("LLVM_STATIC_STDCPP", file);
664654
}
665-
if builder.config.llvm_link_shared ||
666-
(builder.config.llvm_thin_lto && backend != "emscripten")
667-
{
655+
if builder.config.llvm_link_shared || builder.config.llvm_thin_lto {
668656
cargo.env("LLVM_LINK_SHARED", "1");
669657
}
670658
if builder.config.llvm_use_libcxx {
@@ -676,8 +664,7 @@ pub fn build_codegen_backend(builder: &Builder<'_>,
676664
}
677665
_ => panic!("unknown backend: {}", backend),
678666
}
679-
680-
features
667+
String::new()
681668
}
682669

683670
/// Creates the `codegen-backends` folder for a compiler that's about to be

src/bootstrap/config.rs

-1
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,6 @@ impl Config {
668668

669669
pub fn llvm_enabled(&self) -> bool {
670670
self.rust_codegen_backends.contains(&INTERNER.intern_str("llvm"))
671-
|| self.rust_codegen_backends.contains(&INTERNER.intern_str("emscripten"))
672671
}
673672
}
674673

src/bootstrap/configure.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def v(*args):
5555
o("dist-src", "rust.dist-src", "when building tarballs enables building a source tarball")
5656
o("cargo-native-static", "build.cargo-native-static", "static native libraries in cargo")
5757
o("profiler", "build.profiler", "build the profiler runtime")
58-
o("emscripten", None, "compile the emscripten backend as well as LLVM")
5958
o("full-tools", None, "enable all tools")
6059
o("lld", "rust.lld", "build lld")
6160
o("lldb", "rust.lldb", "build lldb")
@@ -335,10 +334,8 @@ def set(key, value):
335334
set('build.host', value.split(','))
336335
elif option.name == 'target':
337336
set('build.target', value.split(','))
338-
elif option.name == 'emscripten':
339-
set('rust.codegen-backends', ['llvm', 'emscripten'])
340337
elif option.name == 'full-tools':
341-
set('rust.codegen-backends', ['llvm', 'emscripten'])
338+
set('rust.codegen-backends', ['llvm'])
342339
set('rust.lld', True)
343340
set('rust.llvm-tools', True)
344341
set('build.extended', True)

src/bootstrap/dist.rs

-4
Original file line numberDiff line numberDiff line change
@@ -826,17 +826,13 @@ fn copy_src_dirs(builder: &Builder<'_>, src_dirs: &[&str], exclude_dirs: &[&str]
826826

827827
const LLVM_TEST: &[&str] = &[
828828
"llvm-project/llvm/test", "llvm-project\\llvm\\test",
829-
"llvm-emscripten/test", "llvm-emscripten\\test",
830829
];
831830
if LLVM_TEST.iter().any(|path| spath.contains(path)) &&
832831
(spath.ends_with(".ll") ||
833832
spath.ends_with(".td") ||
834833
spath.ends_with(".s")) {
835834
return false
836835
}
837-
if spath.contains("test/emscripten") || spath.contains("test\\emscripten") {
838-
return false
839-
}
840836

841837
let full_path = Path::new(dir).join(path);
842838
if exclude_dirs.iter().any(|excl| full_path == Path::new(excl)) {

src/bootstrap/lib.rs

-7
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ pub struct Build {
232232
miri_info: channel::GitInfo,
233233
rustfmt_info: channel::GitInfo,
234234
in_tree_llvm_info: channel::GitInfo,
235-
emscripten_llvm_info: channel::GitInfo,
236235
local_rebuild: bool,
237236
fail_fast: bool,
238237
doc_tests: DocTests,
@@ -351,7 +350,6 @@ impl Build {
351350

352351
// we always try to use git for LLVM builds
353352
let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project"));
354-
let emscripten_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-emscripten"));
355353

356354
let mut build = Build {
357355
initial_rustc: config.initial_rustc.clone(),
@@ -376,7 +374,6 @@ impl Build {
376374
miri_info,
377375
rustfmt_info,
378376
in_tree_llvm_info,
379-
emscripten_llvm_info,
380377
cc: HashMap::new(),
381378
cxx: HashMap::new(),
382379
ar: HashMap::new(),
@@ -553,10 +550,6 @@ impl Build {
553550
self.out.join(&*target).join("llvm")
554551
}
555552

556-
fn emscripten_llvm_out(&self, target: Interned<String>) -> PathBuf {
557-
self.out.join(&*target).join("llvm-emscripten")
558-
}
559-
560553
fn lld_out(&self, target: Interned<String>) -> PathBuf {
561554
self.out.join(&*target).join("lld")
562555
}

src/bootstrap/native.rs

+25-50
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use crate::GitRepo;
2828
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2929
pub struct Llvm {
3030
pub target: Interned<String>,
31-
pub emscripten: bool,
3231
}
3332

3433
impl Step for Llvm {
@@ -40,46 +39,35 @@ impl Step for Llvm {
4039
run.path("src/llvm-project")
4140
.path("src/llvm-project/llvm")
4241
.path("src/llvm")
43-
.path("src/llvm-emscripten")
4442
}
4543

4644
fn make_run(run: RunConfig<'_>) {
47-
let emscripten = run.path.ends_with("llvm-emscripten");
4845
run.builder.ensure(Llvm {
4946
target: run.target,
50-
emscripten,
5147
});
5248
}
5349

5450
/// Compile LLVM for `target`.
5551
fn run(self, builder: &Builder<'_>) -> PathBuf {
5652
let target = self.target;
57-
let emscripten = self.emscripten;
5853

5954
// If we're using a custom LLVM bail out here, but we can only use a
6055
// custom LLVM for the build triple.
61-
if !self.emscripten {
62-
if let Some(config) = builder.config.target_config.get(&target) {
63-
if let Some(ref s) = config.llvm_config {
64-
check_llvm_version(builder, s);
65-
return s.to_path_buf()
66-
}
56+
if let Some(config) = builder.config.target_config.get(&target) {
57+
if let Some(ref s) = config.llvm_config {
58+
check_llvm_version(builder, s);
59+
return s.to_path_buf()
6760
}
6861
}
6962

70-
let (llvm_info, root, out_dir, llvm_config_ret_dir) = if emscripten {
71-
let info = &builder.emscripten_llvm_info;
72-
let dir = builder.emscripten_llvm_out(target);
73-
let config_dir = dir.join("bin");
74-
(info, "src/llvm-emscripten", dir, config_dir)
75-
} else {
76-
let info = &builder.in_tree_llvm_info;
77-
let mut dir = builder.llvm_out(builder.config.build);
78-
if !builder.config.build.contains("msvc") || builder.config.ninja {
79-
dir.push("build");
80-
}
81-
(info, "src/llvm-project/llvm", builder.llvm_out(target), dir.join("bin"))
82-
};
63+
let llvm_info = &builder.in_tree_llvm_info;
64+
let root = "src/llvm-project/llvm";
65+
let out_dir = builder.llvm_out(target);
66+
let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);
67+
if !builder.config.build.contains("msvc") || builder.config.ninja {
68+
llvm_config_ret_dir.push("build");
69+
}
70+
llvm_config_ret_dir.push("bin");
8371

8472
let build_llvm_config = llvm_config_ret_dir
8573
.join(exe("llvm-config", &*builder.config.build));
@@ -107,8 +95,7 @@ impl Step for Llvm {
10795
}
10896
}
10997

110-
let descriptor = if emscripten { "Emscripten " } else { "" };
111-
builder.info(&format!("Building {}LLVM for {}", descriptor, target));
98+
builder.info(&format!("Building LLVM for {}", target));
11299
let _time = util::timeit(&builder);
113100
t!(fs::create_dir_all(&out_dir));
114101

@@ -123,23 +110,15 @@ impl Step for Llvm {
123110

124111
// NOTE: remember to also update `config.toml.example` when changing the
125112
// defaults!
126-
let llvm_targets = if self.emscripten {
127-
"JSBackend"
128-
} else {
129-
match builder.config.llvm_targets {
130-
Some(ref s) => s,
131-
None => "AArch64;ARM;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;\
132-
Sparc;SystemZ;WebAssembly;X86",
133-
}
113+
let llvm_targets = match &builder.config.llvm_targets {
114+
Some(s) => s,
115+
None => "AArch64;ARM;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;\
116+
Sparc;SystemZ;WebAssembly;X86",
134117
};
135118

136-
let llvm_exp_targets = if self.emscripten {
137-
""
138-
} else {
139-
match builder.config.llvm_experimental_targets {
140-
Some(ref s) => s,
141-
None => "",
142-
}
119+
let llvm_exp_targets = match builder.config.llvm_experimental_targets {
120+
Some(ref s) => s,
121+
None => "",
143122
};
144123

145124
let assertions = if builder.config.llvm_assertions {"ON"} else {"OFF"};
@@ -163,25 +142,23 @@ impl Step for Llvm {
163142
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
164143
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
165144

166-
if builder.config.llvm_thin_lto && !emscripten {
145+
if builder.config.llvm_thin_lto {
167146
cfg.define("LLVM_ENABLE_LTO", "Thin");
168147
if !target.contains("apple") {
169148
cfg.define("LLVM_ENABLE_LLD", "ON");
170149
}
171150
}
172151

173-
let want_lldb = builder.config.lldb_enabled && !self.emscripten;
174-
175152
// This setting makes the LLVM tools link to the dynamic LLVM library,
176153
// which saves both memory during parallel links and overall disk space
177154
// for the tools. We don't do this on every platform as it doesn't work
178155
// equally well everywhere.
179-
if builder.llvm_link_tools_dynamically(target) && !emscripten {
156+
if builder.llvm_link_tools_dynamically(target) {
180157
cfg.define("LLVM_LINK_LLVM_DYLIB", "ON");
181158
}
182159

183160
// For distribution we want the LLVM tools to be *statically* linked to libstdc++
184-
if builder.config.llvm_tools_enabled || want_lldb {
161+
if builder.config.llvm_tools_enabled || builder.config.lldb_enabled {
185162
if !target.contains("windows") {
186163
if target.contains("apple") {
187164
cfg.define("CMAKE_EXE_LINKER_FLAGS", "-static-libstdc++");
@@ -209,7 +186,7 @@ impl Step for Llvm {
209186
enabled_llvm_projects.push("compiler-rt");
210187
}
211188

212-
if want_lldb {
189+
if builder.config.lldb_enabled {
213190
enabled_llvm_projects.push("clang");
214191
enabled_llvm_projects.push("lldb");
215192
// For the time being, disable code signing.
@@ -234,10 +211,9 @@ impl Step for Llvm {
234211
}
235212

236213
// http://llvm.org/docs/HowToCrossCompileLLVM.html
237-
if target != builder.config.build && !emscripten {
214+
if target != builder.config.build {
238215
builder.ensure(Llvm {
239216
target: builder.config.build,
240-
emscripten: false,
241217
});
242218
// FIXME: if the llvm root for the build triple is overridden then we
243219
// should use llvm-tblgen from there, also should verify that it
@@ -481,7 +457,6 @@ impl Step for Lld {
481457

482458
let llvm_config = builder.ensure(Llvm {
483459
target: self.target,
484-
emscripten: false,
485460
});
486461

487462
let out_dir = builder.lld_out(target);

0 commit comments

Comments
 (0)