From 984ca4689dbceea29bbfcf54c4743b45fccf7ad1 Mon Sep 17 00:00:00 2001 From: Jamie Cunliffe Date: Wed, 1 Dec 2021 15:56:59 +0000 Subject: Review comments - Changed the separator from '+' to ','. - Moved the branch protection options from -C to -Z. - Additional test for incorrect branch-protection option. - Remove LLVM < 12 code. - Style fixes. Co-authored-by: James McGregor --- src/doc/rustc/src/codegen-options/index.md | 23 ---------------------- .../src/compiler-flags/branch-protection.md | 18 +++++++++++++++++ 2 files changed, 18 insertions(+), 23 deletions(-) create mode 100644 src/doc/unstable-book/src/compiler-flags/branch-protection.md (limited to 'src/doc') diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index 484242d86fe..0201b88417a 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -7,29 +7,6 @@ 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. \ diff --git a/src/doc/unstable-book/src/compiler-flags/branch-protection.md b/src/doc/unstable-book/src/compiler-flags/branch-protection.md new file mode 100644 index 00000000000..85403748e1d --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/branch-protection.md @@ -0,0 +1,18 @@ +# `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, `-Z branch-protection=bti,pac-ret,leaf` is valid, but +`-Z branch-protection=bti,leaf,pac-ret` is not. + +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. -- cgit 1.4.1-3-g733a5