about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/attributes.rs
diff options
context:
space:
mode:
authorReuben Cruise <reuben.cruise@arm.com>2025-09-01 16:53:50 +0100
committerReuben Cruise <reuben.cruise@arm.com>2025-09-17 14:16:31 +0100
commit6f813e887af44d74e9bcfdb207ecab407037a939 (patch)
tree73791884e5f61983e200be3b173f58d71a090f41 /compiler/rustc_codegen_llvm/src/attributes.rs
parent2ebb1263e3506412889410b567fa813ca3cb5c63 (diff)
downloadrust-6f813e887af44d74e9bcfdb207ecab407037a939.tar.gz
rust-6f813e887af44d74e9bcfdb207ecab407037a939.zip
Adds AArch64 GCS support
- Adds option to rustc config to enable GCS
- Passes `guarded-control-stack` flag to llvm if enabled
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/attributes.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/attributes.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs
index 573c51a9539..dcf6b945497 100644
--- a/compiler/rustc_codegen_llvm/src/attributes.rs
+++ b/compiler/rustc_codegen_llvm/src/attributes.rs
@@ -407,13 +407,16 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
         to_add.extend(sanitize_attrs(cx, codegen_fn_attrs.no_sanitize));
 
         // For non-naked functions, set branch protection attributes on aarch64.
-        if let Some(BranchProtection { bti, pac_ret }) =
+        if let Some(BranchProtection { bti, pac_ret, gcs }) =
             cx.sess().opts.unstable_opts.branch_protection
         {
             assert!(cx.sess().target.arch == "aarch64");
             if bti {
                 to_add.push(llvm::CreateAttrString(cx.llcx, "branch-target-enforcement"));
             }
+            if gcs {
+                to_add.push(llvm::CreateAttrString(cx.llcx, "guarded-control-stack"));
+            }
             if let Some(PacRet { leaf, pc, key }) = pac_ret {
                 if pc {
                     to_add.push(llvm::CreateAttrString(cx.llcx, "branch-protection-pauth-lr"));