diff options
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/config.rs | 35 | ||||
| -rwxr-xr-x | src/bootstrap/configure.py | 2 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 8 |
3 files changed, 38 insertions, 7 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 3c1249f8de4..7698ff62880 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -10,6 +10,7 @@ use std::ffi::OsString; use std::fmt; use std::fs; use std::path::{Path, PathBuf}; +use std::str::FromStr; use crate::cache::{Interned, INTERNER}; use crate::flags::Flags; @@ -65,7 +66,7 @@ pub struct Config { pub rustc_error_format: Option<String>, pub json_output: bool, pub test_compare_mode: bool, - pub llvm_libunwind: bool, + pub llvm_libunwind: Option<LlvmLibunwind>, pub on_fail: Option<String>, pub stage: u32, @@ -177,6 +178,32 @@ pub struct Config { pub out: PathBuf, } +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum LlvmLibunwind { + No, + InTree, + System, +} + +impl Default for LlvmLibunwind { + fn default() -> Self { + Self::No + } +} + +impl FromStr for LlvmLibunwind { + type Err = String; + + fn from_str(value: &str) -> Result<Self, Self::Err> { + match value { + "no" => Ok(Self::No), + "in-tree" => Ok(Self::InTree), + "system" => Ok(Self::System), + invalid => Err(format!("Invalid value '{}' for rust.llvm-libunwind config.", invalid)), + } + } +} + #[derive(Debug, Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct TargetSelection { pub triple: Interned<String>, @@ -457,7 +484,7 @@ struct Rust { remap_debuginfo: Option<bool>, jemalloc: Option<bool>, test_compare_mode: Option<bool>, - llvm_libunwind: Option<bool>, + llvm_libunwind: Option<String>, control_flow_guard: Option<bool>, new_symbol_mangling: Option<bool>, } @@ -799,7 +826,9 @@ impl Config { set(&mut config.rust_rpath, rust.rpath); set(&mut config.jemalloc, rust.jemalloc); set(&mut config.test_compare_mode, rust.test_compare_mode); - set(&mut config.llvm_libunwind, rust.llvm_libunwind); + config.llvm_libunwind = rust + .llvm_libunwind + .map(|v| v.parse().expect("failed to parse rust.llvm-libunwind")); set(&mut config.backtrace, rust.backtrace); set(&mut config.channel, rust.channel); set(&mut config.rust_dist_src, rust.dist_src); diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 47673ce1e87..e156952d56f 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -65,7 +65,7 @@ v("llvm-cflags", "llvm.cflags", "build LLVM with these extra compiler flags") v("llvm-cxxflags", "llvm.cxxflags", "build LLVM with these extra compiler flags") v("llvm-ldflags", "llvm.ldflags", "build LLVM with these extra linker flags") -o("llvm-libunwind", "rust.llvm-libunwind", "use LLVM libunwind") +v("llvm-libunwind", "rust.llvm-libunwind", "use LLVM libunwind") # Optimization and debugging options. These may be overridden by the release # channel, etc. diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 6880f6e816a..593d1c4ae88 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -121,7 +121,7 @@ use std::os::windows::fs::symlink_file; use build_helper::{mtime, output, run, run_suppressed, t, try_run, try_run_suppressed}; use filetime::FileTime; -use crate::config::TargetSelection; +use crate::config::{LlvmLibunwind, TargetSelection}; use crate::util::{exe, libdir, CiEnv}; mod builder; @@ -540,8 +540,10 @@ impl Build { fn std_features(&self) -> String { let mut features = "panic-unwind".to_string(); - if self.config.llvm_libunwind { - features.push_str(" llvm-libunwind"); + match self.config.llvm_libunwind.unwrap_or_default() { + LlvmLibunwind::InTree => features.push_str(" llvm-libunwind"), + LlvmLibunwind::System => features.push_str(" system-llvm-libunwind"), + LlvmLibunwind::No => {} } if self.config.backtrace { features.push_str(" backtrace"); |
