Skip to content

Commit 8cab2c7

Browse files
committedJul 6, 2017
Auto merge of #42899 - alexcrichton:compiler-builtins, r=nikomatsakis
Switch to rust-lang-nursery/compiler-builtins This commit migrates the in-tree `libcompiler_builtins` to the upstream version at https://github.com/rust-lang-nursery/compiler-builtins. The upstream version has a number of intrinsics written in Rust and serves as an in-progress rewrite of compiler-rt into Rust. Additionally it also contains all the existing intrinsics defined in `libcompiler_builtins` for 128-bit integers. It's been the intention since the beginning to make this transition but previously it just lacked the manpower to get done. As this PR likely shows it wasn't a trivial integration! Some highlight changes are: * The PR rust-lang/compiler-builtins#166 contains a number of fixes across platforms and also some refactorings to make the intrinsics easier to read. The additional testing added there also fixed a number of integration issues when pulling the repository into this tree. * LTO with the compiler-builtins crate was fixed to link in the entire crate after the LTO process as these intrinsics are excluded from LTO. * Treatment of hidden symbols was updated as previously the `#![compiler_builtins]` crate would mark all symbol *imports* as hidden whereas it was only intended to mark *exports* as hidden.
2 parents 1685c92 + 7e6c9f3 commit 8cab2c7

File tree

23 files changed

+103
-1236
lines changed

23 files changed

+103
-1236
lines changed
 

‎.gitmodules

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
path = src/llvm
33
url = https://github.com/rust-lang/llvm.git
44
branch = master
5-
[submodule "src/compiler-rt"]
6-
path = src/compiler-rt
7-
url = https://github.com/rust-lang/compiler-rt.git
85
[submodule "src/rt/hoedown"]
96
path = src/rt/hoedown
107
url = https://github.com/rust-lang/hoedown.git
@@ -33,3 +30,6 @@
3330
[submodule "src/tools/rls"]
3431
path = src/tools/rls
3532
url = https://github.com/rust-lang-nursery/rls.git
33+
[submodule "src/libcompiler_builtins"]
34+
path = src/libcompiler_builtins
35+
url = https://github.com/rust-lang-nursery/compiler-builtins

‎src/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/bootstrap/bin/rustc.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ fn main() {
137137
}
138138
}
139139

140+
let crate_name = args.windows(2)
141+
.find(|a| &*a[0] == "--crate-name")
142+
.unwrap();
143+
let crate_name = &*crate_name[1];
144+
140145
// If we're compiling specifically the `panic_abort` crate then we pass
141146
// the `-C panic=abort` option. Note that we do not do this for any
142147
// other crate intentionally as this is the only crate for now that we
@@ -145,9 +150,7 @@ fn main() {
145150
// This... is a bit of a hack how we detect this. Ideally this
146151
// information should be encoded in the crate I guess? Would likely
147152
// require an RFC amendment to RFC 1513, however.
148-
let is_panic_abort = args.windows(2)
149-
.any(|a| &*a[0] == "--crate-name" && &*a[1] == "panic_abort");
150-
if is_panic_abort {
153+
if crate_name == "panic_abort" {
151154
cmd.arg("-C").arg("panic=abort");
152155
}
153156

@@ -162,7 +165,15 @@ fn main() {
162165
Ok(s) => if s == "true" { "y" } else { "n" },
163166
Err(..) => "n",
164167
};
165-
cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions));
168+
169+
// The compiler builtins are pretty sensitive to symbols referenced in
170+
// libcore and such, so we never compile them with debug assertions.
171+
if crate_name == "compiler_builtins" {
172+
cmd.arg("-C").arg("debug-assertions=no");
173+
} else {
174+
cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions));
175+
}
176+
166177
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
167178
cmd.arg("-C").arg(format!("codegen-units={}", s));
168179
}

‎src/bootstrap/bootstrap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ def update_submodules(self):
583583
(self.get_toml('jemalloc') or
584584
self.get_mk('CFG_JEMALLOC_ROOT'))))]
585585
run(["git", "submodule", "update",
586-
"--init"] + submodules,
586+
"--init", "--recursive"] + submodules,
587587
cwd=self.rust_root, verbose=self.verbose)
588588
run(["git", "submodule", "-q", "foreach", "git",
589589
"reset", "-q", "--hard"],

‎src/bootstrap/dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,10 +553,10 @@ pub fn rust_src(build: &Build) {
553553
"src/libstd",
554554
"src/libstd_unicode",
555555
"src/libunwind",
556+
"src/rustc/compiler_builtins_shim",
556557
"src/rustc/libc_shim",
557558
"src/libtest",
558559
"src/libterm",
559-
"src/compiler-rt",
560560
"src/jemalloc",
561561
"src/libprofiler_builtins",
562562
];

‎src/build_helper/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,10 @@ pub fn sanitizer_lib_boilerplate(sanitizer_name: &str) -> Result<NativeLibBoiler
239239
),
240240
_ => return Err(()),
241241
};
242-
native_lib_boilerplate("compiler-rt", sanitizer_name, &link_name, search_path)
242+
native_lib_boilerplate("libcompiler_builtins/compiler-rt",
243+
sanitizer_name,
244+
&link_name,
245+
search_path)
243246
}
244247

245248
fn dir_up_to_date(src: &Path, threshold: &FileTime) -> bool {

‎src/ci/init_repo.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ for module in $modules; do
6767
mv "src/llvm-$commit" src/llvm
6868
continue
6969
fi
70-
if [ ! -d "$cache_src_dir/$module" ]; then
70+
if [ ! -e "$cache_src_dir/$module/.git" ]; then
7171
echo "WARNING: $module not found in pristine repo"
72-
retry sh -c "git submodule deinit -f $module && git submodule update --init $module"
72+
retry sh -c "git submodule deinit -f $module && \
73+
git submodule update --init --recursive $module"
7374
continue
7475
fi
7576
retry sh -c "git submodule deinit -f $module && \
76-
git submodule update --init --reference $cache_src_dir/$module $module"
77+
git submodule update --init --recursive --reference $cache_src_dir/$module $module"
7778
done
7879

7980
travis_fold end update_submodules

‎src/compiler-rt

-1
This file was deleted.

‎src/doc/unstable-book/src/library-features/compiler-builtins-lib.md

-35
This file was deleted.

‎src/libcompiler_builtins

Submodule libcompiler_builtins added at 238647a

‎src/libcompiler_builtins/Cargo.toml

-19
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.