diff options
| author | Augie Fackler <augie@google.com> | 2021-09-15 10:18:10 -0400 |
|---|---|---|
| committer | Augie Fackler <augie@google.com> | 2021-09-20 11:31:55 -0400 |
| commit | 4185b76dc3d3b22292033125487c07ce52276b11 (patch) | |
| tree | ef72cc6fb54001c5fe3c125b155b65c303aed043 /compiler/rustc_codegen_llvm/src/attributes.rs | |
| parent | db1fb85cff63ad5fffe435e17128f99f9e1d970c (diff) | |
| download | rust-4185b76dc3d3b22292033125487c07ce52276b11.tar.gz rust-4185b76dc3d3b22292033125487c07ce52276b11.zip | |
rustc_codegen_llvm: make sse4.2 imply crc32 for LLVM 14
This fixes compiling things like the `snap` crate after https://reviews.llvm.org/D105462. I added a test that verifies the additional attribute gets specified, and confirmed that I can build cargo with both LLVM 13 and 14 with this change applied.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/attributes.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 56b93f83466..51c70f0868f 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -305,9 +305,12 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty:: let mut function_features = codegen_fn_attrs .target_features .iter() - .map(|f| { + .flat_map(|f| { let feature = &f.as_str(); - format!("+{}", llvm_util::to_llvm_feature(cx.tcx.sess, feature)) + llvm_util::to_llvm_feature(cx.tcx.sess, feature) + .into_iter() + .map(|f| format!("+{}", f)) + .collect::<Vec<String>>() }) .chain(codegen_fn_attrs.instruction_set.iter().map(|x| match x { InstructionSetAttr::ArmA32 => "-thumb-mode".to_string(), |
