Skip to content

Commit fd2f8a4

Browse files
committed
Auto merge of #39677 - frewsxcv:rollup, r=frewsxcv
Rollup of 9 pull requests - Successful merges: #37928, #38699, #39589, #39598, #39599, #39641, #39649, #39653, #39671 - Failed merges:
2 parents 29dece1 + 1e3e904 commit fd2f8a4

File tree

60 files changed

+928
-46
lines changed

Some content is hidden

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

60 files changed

+928
-46
lines changed

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ opt codegen-tests 1 "run the src/test/codegen tests"
649649
opt option-checking 1 "complain about unrecognized options in this configure script"
650650
opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)"
651651
opt vendor 0 "enable usage of vendored Rust crates"
652+
opt sanitizers 0 "build the sanitizer runtimes (asan, lsan, msan, tsan)"
652653

653654
# Optimization and debugging options. These may be overridden by the release channel, etc.
654655
opt_nosave optimize 1 "build optimized rust code"

mk/cfg/aarch64-unknown-freebsd.mk

Lines changed: 0 additions & 1 deletion
This file was deleted.

mk/cfg/i686-unknown-netbsd.mk

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Cargo.lock

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/check.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ pub fn compiletest(build: &Build,
242242
cmd.env("RUSTC_BOOTSTRAP", "1");
243243
build.add_rust_test_threads(&mut cmd);
244244

245+
if build.config.sanitizers {
246+
cmd.env("SANITIZER_SUPPORT", "1");
247+
}
248+
245249
cmd.arg("--adb-path").arg("adb");
246250
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
247251
if target.contains("android") {

src/bootstrap/compile.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) {
5151
if compiler.stage == 0 && build.local_rebuild && !build.config.use_jemalloc {
5252
features.push_str(" force_alloc_system");
5353
}
54+
55+
if compiler.stage != 0 && build.config.sanitizers {
56+
// This variable is used by the sanitizer runtime crates, e.g.
57+
// rustc_lsan, to build the sanitizer runtime from C code
58+
// When this variable is missing, those crates won't compile the C code,
59+
// so we don't set this variable during stage0 where llvm-config is
60+
// missing
61+
// We also only build the runtimes when --enable-sanitizers (or its
62+
// config.toml equivalent) is used
63+
cargo.env("LLVM_CONFIG", build.llvm_config(target));
64+
}
5465
cargo.arg("--features").arg(features)
5566
.arg("--manifest-path")
5667
.arg(build.src.join("src/rustc/std_shim/Cargo.toml"));

src/bootstrap/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub struct Config {
4848
pub target_config: HashMap<String, Target>,
4949
pub full_bootstrap: bool,
5050
pub extended: bool,
51+
pub sanitizers: bool,
5152

5253
// llvm codegen options
5354
pub llvm_assertions: bool,
@@ -149,6 +150,7 @@ struct Build {
149150
python: Option<String>,
150151
full_bootstrap: Option<bool>,
151152
extended: Option<bool>,
153+
sanitizers: Option<bool>,
152154
}
153155

154156
/// TOML representation of various global install decisions.
@@ -294,6 +296,7 @@ impl Config {
294296
set(&mut config.vendor, build.vendor);
295297
set(&mut config.full_bootstrap, build.full_bootstrap);
296298
set(&mut config.extended, build.extended);
299+
set(&mut config.sanitizers, build.sanitizers);
297300

298301
if let Some(ref install) = toml.install {
299302
config.prefix = install.prefix.clone().map(PathBuf::from);
@@ -438,6 +441,7 @@ impl Config {
438441
("VENDOR", self.vendor),
439442
("FULL_BOOTSTRAP", self.full_bootstrap),
440443
("EXTENDED", self.extended),
444+
("SANITIZERS", self.sanitizers),
441445
}
442446

443447
match key {

src/bootstrap/config.toml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124
# disabled by default.
125125
#extended = false
126126

127+
# Build the sanitizer runtimes
128+
#sanitizers = false
129+
127130
# =============================================================================
128131
# General install configuration options
129132
# =============================================================================

src/bootstrap/dist.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
515515

516516
let branch = match &build.config.channel[..] {
517517
"stable" |
518-
"beta" => {
519-
build.release.split(".").take(2).collect::<Vec<_>>().join(".")
520-
}
518+
"beta" => format!("rust-{}", build.release_num),
521519
_ => "master".to_string(),
522520
};
523521

src/bootstrap/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ impl Build {
599599
/// Get the space-separated set of activated features for the standard
600600
/// library.
601601
fn std_features(&self) -> String {
602-
let mut features = "panic-unwind".to_string();
602+
let mut features = "panic-unwind asan lsan msan tsan".to_string();
603+
603604
if self.config.debug_jemalloc {
604605
features.push_str(" debug-jemalloc");
605606
}

0 commit comments

Comments
 (0)