rust: Add BTI/PAC for supported targets.
This mirrors the support provided for cc modules.
Bug: 181027427
Test: m rust
Change-Id: I1354b37ec8c47132f143400adba6d42cf2081df5
diff --git a/rust/config/arm64_device.go b/rust/config/arm64_device.go
index ae783e8..08ac2ef 100644
--- a/rust/config/arm64_device.go
+++ b/rust/config/arm64_device.go
@@ -26,11 +26,18 @@
Arm64LinkFlags = []string{}
Arm64ArchVariantRustFlags = map[string][]string{
- "armv8-a": []string{},
- "armv8-a-branchprot": []string{},
- "armv8-2a": []string{},
- "armv8-2a-dotprod": []string{},
- "armv9-a": []string{},
+ "armv8-a": []string{},
+ "armv8-a-branchprot": []string{
+ // branch-protection=bti,pac-ret is equivalent to Clang's mbranch-protection=standard
+ "-Z branch-protection=bti,pac-ret",
+ },
+ "armv8-2a": []string{},
+ "armv8-2a-dotprod": []string{},
+ "armv9-a": []string{
+ // branch-protection=bti,pac-ret is equivalent to Clang's mbranch-protection=standard
+ "-Z branch-protection=bti,pac-ret",
+ "-Z stack-protector=none",
+ },
}
)