about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorJames McGregor <james.mcgregor2@arm.com>2021-07-13 12:14:26 +0100
committerJamie Cunliffe <Jamie.Cunliffe@arm.com>2021-12-01 12:24:30 +0000
commit837cc1687f7c0d35a4e90a2f6bee377b5a2ecfd5 (patch)
tree8ce2820cee2ce31a9b54e93791dd8a7b48241039 /src/doc
parent2446a215954a99f9d33019fad7d415ef9c083502 (diff)
downloadrust-837cc1687f7c0d35a4e90a2f6bee377b5a2ecfd5.tar.gz
rust-837cc1687f7c0d35a4e90a2f6bee377b5a2ecfd5.zip
Add codegen option for branch protection and pointer authentication on AArch64
The branch-protection codegen option enables the use of hint-space pointer
authentication code for AArch64 targets
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/rustc/src/codegen-options/index.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md
index 0201b88417a..484242d86fe 100644
--- a/src/doc/rustc/src/codegen-options/index.md
+++ b/src/doc/rustc/src/codegen-options/index.md
@@ -7,6 +7,29 @@ a version of this list for your exact compiler by running `rustc -C help`.
 
 This option is deprecated and does nothing.
 
+## branch-protection
+
+This option lets you enable branch authentication instructions on AArch64.
+This option is ignored for non-AArch64 architectures.
+It takes some combination of the following values, separated by a `+`.
+
+- `pac-ret` - Enable pointer authentication for non-leaf functions.
+- `leaf` - Enable pointer authentication for all functions, including leaf functions.
+- `b-key` - Sign return addresses with key B, instead of the default key A.
+- `bti` - Enable branch target identification.
+
+`leaf` and `b-key` are only valid if `pac-ret` was previously specified.
+For example, `-C branch-protection=bti+pac-ret+leaf` is valid, but
+`-C branch-protection=bti+leaf+pac-ret` is not.
+
+Repeated values are ignored.
+For example, `-C branch-protection=pac-ret+leaf+pac-ret` is equivalent to
+`-C branch-protection=pac-ret+leaf`.
+
+Rust's standard library does not ship with BTI or pointer authentication enabled by default. \
+In Cargo projects the standard library can be recompiled with pointer authentication using the nightly
+[build-std](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std) feature.
+
 ## code-model
 
 This option lets you choose which code model to use. \