mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
![]() Always include global target features in function attributes This ensures that information about target features configured with `-C target-feature=...` or detected with `-C target-cpu=native` is retained for subsequent consumers of LLVM bitcode. This is crucial for linker plugin LTO, since this information is not conveyed to the plugin otherwise. <details><summary>Additional test case demonstrating the issue</summary> ```rust extern crate core; #[inline] #[target_feature(enable = "aes")] unsafe fn f(a: u128, b: u128) -> u128 { use core::arch::x86_64::*; use core::mem::transmute; transmute(_mm_aesenc_si128(transmute(a), transmute(b))) } pub fn g(a: u128, b: u128) -> u128 { unsafe { f(a, b) } } fn main() { let mut args = std::env::args(); let _ = args.next().unwrap(); let a: u128 = args.next().unwrap().parse().unwrap(); let b: u128 = args.next().unwrap().parse().unwrap(); println!("{}", g(a, b)); } ``` ```console $ rustc --edition=2021 a.rs -Clinker-plugin-lto -Clink-arg=-fuse-ld=lld -Ctarget-feature=+aes -O ... = note: LLVM ERROR: Cannot select: intrinsic %llvm.x86.aesni.aesenc ``` </details> r? `@nagisa` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |