Remove handling for previously dropped LLVM version

This commit is contained in:
beetrees 2024-03-08 04:12:04 +00:00
parent 9823f17315
commit 0b6006e45e
No known key found for this signature in database
GPG Key ID: 8791BD754191EBD6

View File

@ -260,35 +260,29 @@ pub unsafe fn create_module<'ll>(
} }
if let Some(BranchProtection { bti, pac_ret }) = sess.opts.unstable_opts.branch_protection { if let Some(BranchProtection { bti, pac_ret }) = sess.opts.unstable_opts.branch_protection {
let behavior = if llvm_version >= (15, 0, 0) {
llvm::LLVMModFlagBehavior::Min
} else {
llvm::LLVMModFlagBehavior::Error
};
if sess.target.arch == "aarch64" { if sess.target.arch == "aarch64" {
llvm::LLVMRustAddModuleFlag( llvm::LLVMRustAddModuleFlag(
llmod, llmod,
behavior, llvm::LLVMModFlagBehavior::Min,
c"branch-target-enforcement".as_ptr().cast(), c"branch-target-enforcement".as_ptr().cast(),
bti.into(), bti.into(),
); );
llvm::LLVMRustAddModuleFlag( llvm::LLVMRustAddModuleFlag(
llmod, llmod,
behavior, llvm::LLVMModFlagBehavior::Min,
c"sign-return-address".as_ptr().cast(), c"sign-return-address".as_ptr().cast(),
pac_ret.is_some().into(), pac_ret.is_some().into(),
); );
let pac_opts = pac_ret.unwrap_or(PacRet { leaf: false, key: PAuthKey::A }); let pac_opts = pac_ret.unwrap_or(PacRet { leaf: false, key: PAuthKey::A });
llvm::LLVMRustAddModuleFlag( llvm::LLVMRustAddModuleFlag(
llmod, llmod,
behavior, llvm::LLVMModFlagBehavior::Min,
c"sign-return-address-all".as_ptr().cast(), c"sign-return-address-all".as_ptr().cast(),
pac_opts.leaf.into(), pac_opts.leaf.into(),
); );
llvm::LLVMRustAddModuleFlag( llvm::LLVMRustAddModuleFlag(
llmod, llmod,
behavior, llvm::LLVMModFlagBehavior::Min,
c"sign-return-address-with-bkey".as_ptr().cast(), c"sign-return-address-with-bkey".as_ptr().cast(),
u32::from(pac_opts.key == PAuthKey::B), u32::from(pac_opts.key == PAuthKey::B),
); );