about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-11-05 22:43:15 +0000
committerbors <bors@rust-lang.org>2024-11-05 22:43:15 +0000
commit4a91ff6bb5f36a94d8ebebd9cad1f5f831abbe7a (patch)
tree3f21f719ace70c608c3e150ef29e87c734424d0e /compiler/rustc_codegen_llvm/src
parentbc5cf994db9fb46712cefd89f78ad7fc51f184a2 (diff)
parent4346249c8876c250bdb923beade469c580eb7297 (diff)
downloadrust-4a91ff6bb5f36a94d8ebebd9cad1f5f831abbe7a.tar.gz
rust-4a91ff6bb5f36a94d8ebebd9cad1f5f831abbe7a.zip
Auto merge of #132661 - matthiaskrgr:rollup-npytbl6, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #132259 (rustc_codegen_llvm: Add a new 'pc' option to branch-protection)
 - #132409 (CI: switch 7 linux jobs to free runners)
 - #132498 (Suggest fixing typos and let bindings at the same time)
 - #132524 (chore(style): sync submodule exclusion list between tidy and rustfmt)
 - #132567 (Properly suggest `E::assoc` when we encounter `E::Variant::assoc`)
 - #132571 (add const_eval_select macro to reduce redundancy)
 - #132637 (Do not filter empty lint passes & re-do CTFE pass)
 - #132642 (Add documentation on `ast::Attribute`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/attributes.rs5
-rw-r--r--compiler/rustc_codegen_llvm/src/context.rs8
2 files changed, 11 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs
index 64bb22e8cb2..cb958c1d4d7 100644
--- a/compiler/rustc_codegen_llvm/src/attributes.rs
+++ b/compiler/rustc_codegen_llvm/src/attributes.rs
@@ -419,7 +419,10 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
                 if bti {
                     to_add.push(llvm::CreateAttrString(cx.llcx, "branch-target-enforcement"));
                 }
-                if let Some(PacRet { leaf, key }) = pac_ret {
+                if let Some(PacRet { leaf, pc, key }) = pac_ret {
+                    if pc {
+                        to_add.push(llvm::CreateAttrString(cx.llcx, "branch-protection-pauth-lr"));
+                    }
                     to_add.push(llvm::CreateAttrStringValue(
                         cx.llcx,
                         "sign-return-address",
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs
index 6838a6f9779..b7ab5d6d5f0 100644
--- a/compiler/rustc_codegen_llvm/src/context.rs
+++ b/compiler/rustc_codegen_llvm/src/context.rs
@@ -308,7 +308,13 @@ pub(crate) unsafe fn create_module<'ll>(
                 "sign-return-address",
                 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, pc: false, key: PAuthKey::A });
+            llvm::add_module_flag_u32(
+                llmod,
+                llvm::ModuleFlagMergeBehavior::Min,
+                "branch-protection-pauth-lr",
+                pac_opts.pc.into(),
+            );
             llvm::add_module_flag_u32(
                 llmod,
                 llvm::ModuleFlagMergeBehavior::Min,