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

Compile rustc crates with the initial-exec TLS model #78201

Merged
merged 1 commit into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,14 @@ impl<'a> Builder<'a> {
}
}

// Compile everything except libraries and proc macros with the more
// efficient initial-exec TLS model. This doesn't work with `dlopen`,
// so we can't use it by default in general, but we can use it for tools
// and our own internal libraries.
if !mode.must_support_dlopen() {
rustflags.arg("-Ztls-model=initial-exec");
}

if self.config.incremental {
cargo.env("CARGO_INCREMENTAL", "1");
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ impl Mode {
pub fn is_tool(&self) -> bool {
matches!(self, Mode::ToolBootstrap | Mode::ToolRustc | Mode::ToolStd)
}

pub fn must_support_dlopen(&self) -> bool {
matches!(self, Mode::Std | Mode::Codegen)
}
}

impl Build {
Expand Down