Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #65587

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
23d3ff1
Fix zero-size uninitialized boxes
SimonSapin Oct 6, 2019
90d0baf
Upgrade GCC to 8.3.0, glibc to 1.17.0 and crosstool-ng to 1.24.0 for …
msizanoen1 Oct 11, 2019
4f97e5d
Remove reference to Ubuntu 15.10 ARM toolchain
msizanoen1 Oct 11, 2019
e2ce082
Revert "Remove reference to Ubuntu 15.10 ARM toolchain"
msizanoen1 Oct 11, 2019
88ea4ff
Add crosstool-ng 1.24.0 unzip dependency
msizanoen1 Oct 12, 2019
e58ad8d
Fix path to crosstool-ng.sh
msizanoen1 Oct 13, 2019
9d5208a
Remove sanitizer runtime crates
tmiasko Oct 6, 2019
c1b5249
Remove sanitizer_runtime attribute
tmiasko Oct 7, 2019
87c3eed
Link sanitizer runtimes instead of injecting crate dependencies
tmiasko Oct 6, 2019
ac3cf6b
Compile main executable with rustc in staticlib test
tmiasko Oct 7, 2019
7864cb4
Enable sanitizer-leak test case
tmiasko Oct 8, 2019
01008e4
Update libc to 0.2.64
mati865 Oct 16, 2019
870ea52
Mirror crosstool-ng on rust-lang-ci-mirrors
msizanoen1 Oct 16, 2019
c2c290e
Document sanitizers in unstable-book
tmiasko Oct 16, 2019
ca1cfda
Uninitialized boxes: check for zero-size allocation based on Layout::…
SimonSapin Oct 16, 2019
dd4d6a9
Verify that sanitizer runtime is not part of staticlib
tmiasko Oct 17, 2019
75f4dac
Add regression test for #65394
ecstatic-morse Oct 17, 2019
22a0856
Enable `drain_filter`
ecstatic-morse Oct 17, 2019
af691de
Suppress validation mismatch ICE in the presence of mut borrows
ecstatic-morse Oct 17, 2019
6de4924
Update emscripten functions declarations
mati865 Oct 17, 2019
1101101
Refer to "associated functions" instead of "static methods"
estebank Oct 18, 2019
d8fca9e
Use `with` in `Symbol` trait methods.
nnethercote Oct 17, 2019
3532863
Change how `Symbol::Debug` works.
nnethercote Oct 17, 2019
f65a492
Point at enclosing function without `self` receiver
estebank Oct 18, 2019
0879f63
Remove `Copy` and `Clone` impls for `LocalInternedString`.
nnethercote Oct 18, 2019
d343ee8
Remove `Hash` impls for `DefPath`, `DisambiguatedDefPathData`, and `D…
nnethercote Oct 18, 2019
865c4bc
review comments: help wording
estebank Oct 18, 2019
bd813bf
review comment: span bug label
estebank Oct 18, 2019
2b76c8b
review comments
estebank Oct 18, 2019
227db40
Uninitialized boxes: add test for zero-size allocations
SimonSapin Oct 16, 2019
fbd078a
Rollup merge of #65174 - SimonSapin:zero-box, r=alexcrichton
Centril Oct 19, 2019
d5a5c32
Rollup merge of #65241 - tmiasko:no-std-san, r=nikomatsakis
Centril Oct 19, 2019
6ebf23e
Rollup merge of #65302 - msizanoen1:fix-armv7-segfault, r=alexcrichton
Centril Oct 19, 2019
0ace8e0
Rollup merge of #65469 - mati865:libc, r=alexcrichton
Centril Oct 19, 2019
6d6681a
Rollup merge of #65485 - ecstatic-morse:const-validation-mismatch-ugl…
Centril Oct 19, 2019
45a5dab
Rollup merge of #65542 - estebank:kill-static-methods, r=Centril
Centril Oct 19, 2019
c21c919
Rollup merge of #65545 - nnethercote:more-symbol-cleanups, r=petroche…
Centril Oct 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 2 additions & 50 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1713,9 +1713,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"

[[package]]
name = "libc"
version = "0.2.62"
version = "0.2.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
checksum = "74dfca3d9957906e8d1e6a0b641dc9a59848e793f1da2165889fd4f62d10d79c"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down Expand Up @@ -3388,17 +3388,6 @@ dependencies = [
"smallvec",
]

[[package]]
name = "rustc_asan"
version = "0.0.0"
dependencies = [
"alloc",
"build_helper",
"cmake",
"compiler_builtins",
"core",
]

[[package]]
name = "rustc_codegen_llvm"
version = "0.0.0"
Expand Down Expand Up @@ -3595,17 +3584,6 @@ dependencies = [
"cc",
]

[[package]]
name = "rustc_lsan"
version = "0.0.0"
dependencies = [
"alloc",
"build_helper",
"cmake",
"compiler_builtins",
"core",
]

[[package]]
name = "rustc_macros"
version = "0.1.0"
Expand Down Expand Up @@ -3660,17 +3638,6 @@ dependencies = [
"syntax_pos",
]

[[package]]
name = "rustc_msan"
version = "0.0.0"
dependencies = [
"alloc",
"build_helper",
"cmake",
"compiler_builtins",
"core",
]

[[package]]
name = "rustc_passes"
version = "0.0.0"
Expand Down Expand Up @@ -3785,17 +3752,6 @@ dependencies = [
"syntax_pos",
]

[[package]]
name = "rustc_tsan"
version = "0.0.0"
dependencies = [
"alloc",
"build_helper",
"cmake",
"compiler_builtins",
"core",
]

[[package]]
name = "rustc_typeck"
version = "0.0.0"
Expand Down Expand Up @@ -4150,10 +4106,6 @@ dependencies = [
"panic_unwind",
"profiler_builtins",
"rand 0.7.0",
"rustc_asan",
"rustc_lsan",
"rustc_msan",
"rustc_tsan",
"unwind",
"wasi",
]
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Step for Std {
let compiler = builder.compiler(0, builder.config.build);

let mut cargo = builder.cargo(compiler, Mode::Std, target, cargo_subcommand(builder.kind));
std_cargo(builder, &compiler, target, &mut cargo);
std_cargo(builder, target, &mut cargo);

builder.info(&format!("Checking std artifacts ({} -> {})", &compiler.host, target));
run_cargo(builder,
Expand Down
122 changes: 85 additions & 37 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl Step for Std {
copy_third_party_objects(builder, &compiler, target);

let mut cargo = builder.cargo(compiler, Mode::Std, target, "build");
std_cargo(builder, &compiler, target, &mut cargo);
std_cargo(builder, target, &mut cargo);

builder.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
&compiler.host, target));
Expand Down Expand Up @@ -155,7 +155,6 @@ fn copy_third_party_objects(builder: &Builder<'_>, compiler: &Compiler, target:
/// Configure cargo to compile the standard library, adding appropriate env vars
/// and such.
pub fn std_cargo(builder: &Builder<'_>,
compiler: &Compiler,
target: Interned<String>,
cargo: &mut Cargo) {
if let Some(target) = env::var_os("MACOSX_STD_DEPLOYMENT_TARGET") {
Expand Down Expand Up @@ -200,22 +199,6 @@ pub fn std_cargo(builder: &Builder<'_>,
let mut features = builder.std_features();
features.push_str(&compiler_builtins_c_feature);

if compiler.stage != 0 && builder.config.sanitizers {
// This variable is used by the sanitizer runtime crates, e.g.
// rustc_lsan, to build the sanitizer runtime from C code
// When this variable is missing, those crates won't compile the C code,
// so we don't set this variable during stage0 where llvm-config is
// missing
// We also only build the runtimes when --enable-sanitizers (or its
// config.toml equivalent) is used
let llvm_config = builder.ensure(native::Llvm {
target: builder.config.build,
emscripten: false,
});
cargo.env("LLVM_CONFIG", llvm_config);
cargo.env("RUSTC_BUILD_SANITIZERS", "1");
}

cargo.arg("--features").arg(features)
.arg("--manifest-path")
.arg(builder.src.join("src/libtest/Cargo.toml"));
Expand Down Expand Up @@ -274,30 +257,95 @@ impl Step for StdLink {
let hostdir = builder.sysroot_libdir(target_compiler, compiler.host);
add_to_sysroot(builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target));

if builder.config.sanitizers && compiler.stage != 0 && target == "x86_64-apple-darwin" {
// The sanitizers are only built in stage1 or above, so the dylibs will
// be missing in stage0 and causes panic. See the `std()` function above
// for reason why the sanitizers are not built in stage0.
copy_apple_sanitizer_dylibs(builder, &builder.native_dir(target), "osx", &libdir);
if builder.config.sanitizers && target_compiler.stage != 0 {
// The sanitizers are only copied in stage1 or above,
// to avoid creating dependency on LLVM.
copy_sanitizers(builder, &target_compiler, target);
}
}
}

fn copy_apple_sanitizer_dylibs(
builder: &Builder<'_>,
native_dir: &Path,
platform: &str,
into: &Path,
) {
for &sanitizer in &["asan", "tsan"] {
let filename = format!("lib__rustc__clang_rt.{}_{}_dynamic.dylib", sanitizer, platform);
let mut src_path = native_dir.join(sanitizer);
src_path.push("build");
src_path.push("lib");
src_path.push("darwin");
src_path.push(&filename);
builder.copy(&src_path, &into.join(filename));
/// Copies sanitizer runtime libraries into target libdir.
fn copy_sanitizers(builder: &Builder<'_>, compiler: &Compiler, target: Interned<String>) {
let llvm_config = builder.ensure(native::Llvm {
target,
emscripten: false,
});

let llvm_version = output(Command::new(&llvm_config).arg("--version"));
let llvm_version = llvm_version.trim();

// The compiler-rt uses CLANG_VERSION as a part of COMPILER_RT_INSTALL_PATH.
// The CLANG_VERSION is based on LLVM_VERSION but it does not not include
// LLVM_VERSION_SUFFIX. On the other hand value returned from llvm-config
// --version does include it, so lets strip it to obtain CLANG_VERSION.
let mut non_digits = 0;
let mut third_non_digit = llvm_version.len();
for (i, c) in llvm_version.char_indices() {
if !c.is_digit(10) {
non_digits += 1;
if non_digits == 3 {
third_non_digit = i;
break;
}
}
}
let llvm_version = &llvm_version[..third_non_digit];

let llvm_libdir = output(Command::new(&llvm_config).arg("--libdir"));
let llvm_libdir = PathBuf::from(llvm_libdir.trim());

let clang_resourcedir = llvm_libdir.join("clang").join(&llvm_version);
let sanitizers = supported_sanitizers(&clang_resourcedir, target);
let libdir = builder.sysroot_libdir(*compiler, target);

for (src, name) in &sanitizers {
let dst = libdir.join(name);
if !src.exists() {
println!("Ignoring missing runtime: {}", src.display());
continue;
}
builder.copy(&src, &dst);

if target == "x86_64-apple-darwin" {
// Update the library install name reflect the fact it has been renamed.
let status = Command::new("install_name_tool")
.arg("-id")
.arg(format!("@rpath/{}", name))
.arg(&dst)
.status()
.expect("failed to execute `install_name_tool`");
assert!(status.success());
}
}
}

/// Returns a list of paths to sanitizer libraries supported on given target,
/// and corresponding names we plan to give them when placed in target libdir.
fn supported_sanitizers(resourcedir: &Path, target: Interned<String>) -> Vec<(PathBuf, String)> {
let sanitizers = &["asan", "lsan", "msan", "tsan"];
let mut result = Vec::new();
match &*target {
"x86_64-apple-darwin" => {
let srcdir = resourcedir.join("lib/darwin");
for s in sanitizers {
let src = format!("libclang_rt.{}_osx_dynamic.dylib", s);
let dst = format!("librustc_rt.{}.dylib", s);
result.push((srcdir.join(src), dst));
}

}
"x86_64-unknown-linux-gnu" => {
let srcdir = resourcedir.join("lib/linux");
for s in sanitizers {
let src = format!("libclang_rt.{}-x86_64.a", s);
let dst = format!("librustc_rt.{}.a", s);
result.push((srcdir.join(src), dst));
}
}
_ => {}
}
result
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -901,10 +901,6 @@ impl Step for Src {
"src/libcore",
"src/libpanic_abort",
"src/libpanic_unwind",
"src/librustc_asan",
"src/librustc_lsan",
"src/librustc_msan",
"src/librustc_tsan",
"src/libstd",
"src/libunwind",
"src/libtest",
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl Step for Std {

let run_cargo_rustdoc_for = |package: &str| {
let mut cargo = builder.cargo(compiler, Mode::Std, target, "rustdoc");
compile::std_cargo(builder, &compiler, target, &mut cargo);
compile::std_cargo(builder, target, &mut cargo);

// Keep a whitelist so we do not build internal stdlib crates, these will be
// build by the rustc step later if enabled.
Expand Down
7 changes: 7 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ impl Step for Llvm {
enabled_llvm_projects.push("compiler-rt");
}

if builder.config.sanitizers {
enabled_llvm_projects.push("compiler-rt");
cfg.define("COMPILER_RT_BUILD_SANITIZERS", "ON");
// Avoids building instrumented version of libcxx.
cfg.define("COMPILER_RT_USE_LIBCXX", "OFF");
}

if want_lldb {
enabled_llvm_projects.push("clang");
enabled_llvm_projects.push("lldb");
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@ impl Step for Crate {
let mut cargo = builder.cargo(compiler, mode, target, test_kind.subcommand());
match mode {
Mode::Std => {
compile::std_cargo(builder, &compiler, target, &mut cargo);
compile::std_cargo(builder, target, &mut cargo);
}
Mode::Rustc => {
builder.ensure(compile::Rustc { compiler, target });
Expand Down
Loading