diff options
| author | Nikita Popov <npopov@redhat.com> | 2022-02-15 15:22:13 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2022-02-16 21:15:31 +0100 |
| commit | 0605a4122f519364d67d3ef5ff1726c5faae32cc (patch) | |
| tree | 96caa9fc5dea2155a7a90cbf863af95b0885ee9e /compiler/rustc_codegen_llvm/src | |
| parent | 200aa5c713c7dd4ada2d136fcb72b8d60f92dc9d (diff) | |
| download | rust-0605a4122f519364d67d3ef5ff1726c5faae32cc.tar.gz rust-0605a4122f519364d67d3ef5ff1726c5faae32cc.zip | |
Expose unstable llvm14-builtins-abi target feature for cfg use
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 727d079d83d..b1c14c7e44b 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -217,24 +217,32 @@ pub fn check_tied_features( pub fn target_features(sess: &Session) -> Vec<Symbol> { let target_machine = create_informational_target_machine(sess); - supported_target_features(sess) - .iter() - .filter_map( - |&(feature, gate)| { + let mut features: Vec<Symbol> = + supported_target_features(sess) + .iter() + .filter_map(|&(feature, gate)| { if sess.is_nightly_build() || gate.is_none() { Some(feature) } else { None } - }, - ) - .filter(|feature| { - for llvm_feature in to_llvm_feature(sess, feature) { - let cstr = CString::new(llvm_feature).unwrap(); - if unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) } { - return true; + }) + .filter(|feature| { + for llvm_feature in to_llvm_feature(sess, feature) { + let cstr = CString::new(llvm_feature).unwrap(); + if unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) } { + return true; + } } - } - false - }) - .map(|feature| Symbol::intern(feature)) - .collect() + false + }) + .map(|feature| Symbol::intern(feature)) + .collect(); + + // LLVM 14 changed the ABI for i128 arguments to __float/__fix builtins on Win64 + // (see https://reviews.llvm.org/D110413). This unstable target feature is intended for use + // by compiler-builtins, to export the builtins with the expected, LLVM-version-dependent ABI. + // The target feature can be dropped once we no longer support older LLVM versions. + if sess.is_nightly_build() && get_version() >= (14, 0, 0) { + features.push(Symbol::intern("llvm14-builtins-abi")); + } + features } pub fn print_version() { |
