10edeea4b4
Add a new 'pc' option to -Z branch-protection for aarch64 that enables the use of PC as a diversifier in PAC branch protection code. When the pauth-lr target feature is enabled in combination with -Z branch-protection=pac-ret,pc, the new 9.5-a instructions (pacibsppc, retaasppc, etc) will be generated.
31 lines
810 B
Rust
31 lines
810 B
Rust
// Test that PAC instructions are emitted when branch-protection is specified.
|
|
|
|
//@ revisions: PACRET PAUTHLR_NOP PAUTHLR
|
|
//@ assembly-output: emit-asm
|
|
//@ needs-llvm-components: aarch64
|
|
//@ compile-flags: --target aarch64-unknown-linux-gnu
|
|
//@ [PACRET] compile-flags: -Z branch-protection=pac-ret,leaf
|
|
//@ [PAUTHLR_NOP] compile-flags: -Z branch-protection=pac-ret,pc,leaf
|
|
//@ [PAUTHLR] compile-flags: -C target-feature=+pauth-lr -Z branch-protection=pac-ret,pc,leaf
|
|
//@ min-llvm-version: 19
|
|
|
|
#![feature(no_core, lang_items)]
|
|
#![no_std]
|
|
#![no_core]
|
|
#![crate_type = "lib"]
|
|
|
|
#[lang = "sized"]
|
|
trait Sized {}
|
|
|
|
// PACRET: hint #25
|
|
// PACRET: hint #29
|
|
// PAUTHLR_NOP: hint #25
|
|
// PAUTHLR_NOP: hint #39
|
|
// PAUTHLR_NOP: hint #29
|
|
// PAUTHLR: paciasppc
|
|
// PAUTHLR: autiasppc
|
|
#[no_mangle]
|
|
pub fn test() -> u8 {
|
|
42
|
|
}
|