diff --git a/config.toml.example b/config.toml.example index f24f8e81a7944..193a9020a55bd 100644 --- a/config.toml.example +++ b/config.toml.example @@ -148,6 +148,9 @@ changelog-seen = 2 # The value specified here will be passed as `-DLLVM_USE_LINKER` to CMake. #use-linker = <none> (path) +# Whether or not to specify `-DLLVM_ENABLE_RTTI=YES` +#enable-rtti = false + # Whether or not to specify `-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=YES` #allow-old-toolchain = false diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 683cfc630e771..f73d445469a0d 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -105,6 +105,7 @@ pub struct Config { pub llvm_version_suffix: Option<String>, pub llvm_use_linker: Option<String>, pub llvm_allow_old_toolchain: bool, + pub llvm_enable_rtti: bool, pub llvm_polly: bool, pub llvm_clang: bool, pub llvm_from_ci: bool, @@ -474,6 +475,7 @@ derive_merge! { use_libcxx: Option<bool>, use_linker: Option<String>, allow_old_toolchain: Option<bool>, + enable_rtti: Option<bool>, polly: Option<bool>, clang: Option<bool>, download_ci_llvm: Option<StringOrBool>, @@ -805,6 +807,7 @@ impl Config { set(&mut config.llvm_use_libcxx, llvm.use_libcxx); config.llvm_use_linker = llvm.use_linker.clone(); config.llvm_allow_old_toolchain = llvm.allow_old_toolchain.unwrap_or(false); + config.llvm_enable_rtti = llvm.enable_rtti.unwrap_or(false); config.llvm_polly = llvm.polly.unwrap_or(false); config.llvm_clang = llvm.clang.unwrap_or(false); config.llvm_from_ci = match llvm.download_ci_llvm { @@ -874,6 +877,7 @@ impl Config { check_ci_llvm!(llvm.use_libcxx); check_ci_llvm!(llvm.use_linker); check_ci_llvm!(llvm.allow_old_toolchain); + check_ci_llvm!(llvm.enable_rtti); check_ci_llvm!(llvm.polly); check_ci_llvm!(llvm.clang); check_ci_llvm!(llvm.plugins); diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 94424cb4548fa..0385cb94a6786 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -73,6 +73,7 @@ def v(*args): o("optimize", "rust.optimize", "build optimized rust code") o("optimize-llvm", "llvm.optimize", "build optimized LLVM") o("llvm-assertions", "llvm.assertions", "build LLVM with assertions") +o("llvm-enable-rtti", "llvm.enable-rtti", "build LLVM with using C++’s built in RTTI") o("llvm-plugins", "llvm.plugins", "build LLVM with plugin interface") o("debug-assertions", "rust.debug-assertions", "build with debugging assertions") o("debug-assertions-std", "rust.debug-assertions-std", "build the standard library with debugging assertions") diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 4a754e6da1209..ed802c74794dd 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -351,6 +351,10 @@ impl Step for Llvm { cfg.define("LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN", "YES"); } + if builder.config.llvm_enable_rtti { + cfg.define("LLVM_ENABLE_RTTI", "YES"); + } + configure_cmake(builder, target, &mut cfg, true); // FIXME: we don't actually need to build all LLVM tools and all LLVM