Skip to content

Commit 9d5208a

Browse files
committed
Remove sanitizer runtime crates
1 parent e369d87 commit 9d5208a

File tree

16 files changed

+0
-411
lines changed

16 files changed

+0
-411
lines changed

Cargo.lock

-48
Original file line numberDiff line numberDiff line change
@@ -3387,17 +3387,6 @@ dependencies = [
33873387
"smallvec",
33883388
]
33893389

3390-
[[package]]
3391-
name = "rustc_asan"
3392-
version = "0.0.0"
3393-
dependencies = [
3394-
"alloc",
3395-
"build_helper",
3396-
"cmake",
3397-
"compiler_builtins",
3398-
"core",
3399-
]
3400-
34013390
[[package]]
34023391
name = "rustc_codegen_llvm"
34033392
version = "0.0.0"
@@ -3592,17 +3581,6 @@ dependencies = [
35923581
"cc",
35933582
]
35943583

3595-
[[package]]
3596-
name = "rustc_lsan"
3597-
version = "0.0.0"
3598-
dependencies = [
3599-
"alloc",
3600-
"build_helper",
3601-
"cmake",
3602-
"compiler_builtins",
3603-
"core",
3604-
]
3605-
36063584
[[package]]
36073585
name = "rustc_macros"
36083586
version = "0.1.0"
@@ -3656,17 +3634,6 @@ dependencies = [
36563634
"syntax_pos",
36573635
]
36583636

3659-
[[package]]
3660-
name = "rustc_msan"
3661-
version = "0.0.0"
3662-
dependencies = [
3663-
"alloc",
3664-
"build_helper",
3665-
"cmake",
3666-
"compiler_builtins",
3667-
"core",
3668-
]
3669-
36703637
[[package]]
36713638
name = "rustc_passes"
36723639
version = "0.0.0"
@@ -3778,17 +3745,6 @@ dependencies = [
37783745
"syntax_pos",
37793746
]
37803747

3781-
[[package]]
3782-
name = "rustc_tsan"
3783-
version = "0.0.0"
3784-
dependencies = [
3785-
"alloc",
3786-
"build_helper",
3787-
"cmake",
3788-
"compiler_builtins",
3789-
"core",
3790-
]
3791-
37923748
[[package]]
37933749
name = "rustc_typeck"
37943750
version = "0.0.0"
@@ -4143,10 +4099,6 @@ dependencies = [
41434099
"panic_unwind",
41444100
"profiler_builtins",
41454101
"rand 0.7.0",
4146-
"rustc_asan",
4147-
"rustc_lsan",
4148-
"rustc_msan",
4149-
"rustc_tsan",
41504102
"unwind",
41514103
"wasi",
41524104
]

src/bootstrap/dist.rs

-4
Original file line numberDiff line numberDiff line change
@@ -901,10 +901,6 @@ impl Step for Src {
901901
"src/libcore",
902902
"src/libpanic_abort",
903903
"src/libpanic_unwind",
904-
"src/librustc_asan",
905-
"src/librustc_lsan",
906-
"src/librustc_msan",
907-
"src/librustc_tsan",
908904
"src/libstd",
909905
"src/libunwind",
910906
"src/libtest",

src/build_helper/lib.rs

-119
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
use std::fs::File;
21
use std::path::{Path, PathBuf};
32
use std::process::{Command, Stdio};
43
use std::time::{SystemTime, UNIX_EPOCH};
54
use std::{env, fs};
6-
use std::thread;
75

86
/// A helper macro to `unwrap` a result except also print out details like:
97
///
@@ -182,123 +180,6 @@ pub fn up_to_date(src: &Path, dst: &Path) -> bool {
182180
}
183181
}
184182

185-
#[must_use]
186-
pub struct NativeLibBoilerplate {
187-
pub src_dir: PathBuf,
188-
pub out_dir: PathBuf,
189-
}
190-
191-
impl NativeLibBoilerplate {
192-
/// On macOS we don't want to ship the exact filename that compiler-rt builds.
193-
/// This conflicts with the system and ours is likely a wildly different
194-
/// version, so they can't be substituted.
195-
///
196-
/// As a result, we rename it here but we need to also use
197-
/// `install_name_tool` on macOS to rename the commands listed inside of it to
198-
/// ensure it's linked against correctly.
199-
pub fn fixup_sanitizer_lib_name(&self, sanitizer_name: &str) {
200-
if env::var("TARGET").unwrap() != "x86_64-apple-darwin" {
201-
return
202-
}
203-
204-
let dir = self.out_dir.join("build/lib/darwin");
205-
let name = format!("clang_rt.{}_osx_dynamic", sanitizer_name);
206-
let src = dir.join(&format!("lib{}.dylib", name));
207-
let new_name = format!("lib__rustc__{}.dylib", name);
208-
let dst = dir.join(&new_name);
209-
210-
println!("{} => {}", src.display(), dst.display());
211-
fs::rename(&src, &dst).unwrap();
212-
let status = Command::new("install_name_tool")
213-
.arg("-id")
214-
.arg(format!("@rpath/{}", new_name))
215-
.arg(&dst)
216-
.status()
217-
.expect("failed to execute `install_name_tool`");
218-
assert!(status.success());
219-
}
220-
}
221-
222-
impl Drop for NativeLibBoilerplate {
223-
fn drop(&mut self) {
224-
if !thread::panicking() {
225-
t!(File::create(self.out_dir.join("rustbuild.timestamp")));
226-
}
227-
}
228-
}
229-
230-
// Perform standard preparations for native libraries that are build only once for all stages.
231-
// Emit rerun-if-changed and linking attributes for Cargo, check if any source files are
232-
// updated, calculate paths used later in actual build with CMake/make or C/C++ compiler.
233-
// If Err is returned, then everything is up-to-date and further build actions can be skipped.
234-
// Timestamps are created automatically when the result of `native_lib_boilerplate` goes out
235-
// of scope, so all the build actions should be completed until then.
236-
pub fn native_lib_boilerplate(
237-
src_dir: &Path,
238-
out_name: &str,
239-
link_name: &str,
240-
search_subdir: &str,
241-
) -> Result<NativeLibBoilerplate, ()> {
242-
rerun_if_changed_anything_in_dir(src_dir);
243-
244-
let out_dir = env::var_os("RUSTBUILD_NATIVE_DIR").unwrap_or_else(||
245-
env::var_os("OUT_DIR").unwrap());
246-
let out_dir = PathBuf::from(out_dir).join(out_name);
247-
t!(fs::create_dir_all(&out_dir));
248-
if link_name.contains('=') {
249-
println!("cargo:rustc-link-lib={}", link_name);
250-
} else {
251-
println!("cargo:rustc-link-lib=static={}", link_name);
252-
}
253-
println!(
254-
"cargo:rustc-link-search=native={}",
255-
out_dir.join(search_subdir).display()
256-
);
257-
258-
let timestamp = out_dir.join("rustbuild.timestamp");
259-
if !up_to_date(Path::new("build.rs"), &timestamp) || !up_to_date(src_dir, &timestamp) {
260-
Ok(NativeLibBoilerplate {
261-
src_dir: src_dir.to_path_buf(),
262-
out_dir,
263-
})
264-
} else {
265-
Err(())
266-
}
267-
}
268-
269-
pub fn sanitizer_lib_boilerplate(sanitizer_name: &str)
270-
-> Result<(NativeLibBoilerplate, String), ()>
271-
{
272-
let (link_name, search_path, apple) = match &*env::var("TARGET").unwrap() {
273-
"x86_64-unknown-linux-gnu" => (
274-
format!("clang_rt.{}-x86_64", sanitizer_name),
275-
"build/lib/linux",
276-
false,
277-
),
278-
"x86_64-apple-darwin" => (
279-
format!("clang_rt.{}_osx_dynamic", sanitizer_name),
280-
"build/lib/darwin",
281-
true,
282-
),
283-
_ => return Err(()),
284-
};
285-
let to_link = if apple {
286-
format!("dylib=__rustc__{}", link_name)
287-
} else {
288-
format!("static={}", link_name)
289-
};
290-
// This env var is provided by rustbuild to tell us where `compiler-rt`
291-
// lives.
292-
let dir = env::var_os("RUST_COMPILER_RT_ROOT").unwrap();
293-
let lib = native_lib_boilerplate(
294-
dir.as_ref(),
295-
sanitizer_name,
296-
&to_link,
297-
search_path,
298-
)?;
299-
Ok((lib, link_name))
300-
}
301-
302183
fn dir_up_to_date(src: &Path, threshold: SystemTime) -> bool {
303184
t!(fs::read_dir(src)).map(|e| t!(e)).all(|e| {
304185
let meta = t!(e.metadata());

src/librustc_asan/Cargo.toml

-20
This file was deleted.

src/librustc_asan/build.rs

-30
This file was deleted.

src/librustc_asan/lib.rs

-8
This file was deleted.

src/librustc_lsan/Cargo.toml

-20
This file was deleted.

src/librustc_lsan/build.rs

-29
This file was deleted.

src/librustc_lsan/lib.rs

-8
This file was deleted.

src/librustc_msan/Cargo.toml

-20
This file was deleted.

src/librustc_msan/build.rs

-29
This file was deleted.

0 commit comments

Comments
 (0)