mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	minicore makes it much easier to add new language items to all of the existing `no_core` tests.
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
// Test that the correct module flags are emitted with different branch protection flags.
 | 
						|
 | 
						|
//@ add-core-stubs
 | 
						|
//@ revisions: BTI PACRET LEAF BKEY NONE
 | 
						|
//@ needs-llvm-components: aarch64
 | 
						|
//@ [BTI] compile-flags: -Z branch-protection=bti
 | 
						|
//@ [PACRET] compile-flags: -Z branch-protection=pac-ret
 | 
						|
//@ [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf
 | 
						|
//@ [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key
 | 
						|
//@ compile-flags: --target aarch64-unknown-linux-gnu
 | 
						|
//@ max-llvm-major-version: 18
 | 
						|
 | 
						|
#![crate_type = "lib"]
 | 
						|
#![feature(no_core, lang_items)]
 | 
						|
#![no_core]
 | 
						|
 | 
						|
extern crate minicore;
 | 
						|
use minicore::*;
 | 
						|
 | 
						|
// A basic test function.
 | 
						|
pub fn test() {}
 | 
						|
 | 
						|
// BTI: !"branch-target-enforcement", i32 1
 | 
						|
// BTI: !"sign-return-address", i32 0
 | 
						|
// BTI: !"sign-return-address-all", i32 0
 | 
						|
// BTI: !"sign-return-address-with-bkey", i32 0
 | 
						|
 | 
						|
// PACRET: !"branch-target-enforcement", i32 0
 | 
						|
// PACRET: !"sign-return-address", i32 1
 | 
						|
// PACRET: !"sign-return-address-all", i32 0
 | 
						|
// PACRET: !"sign-return-address-with-bkey", i32 0
 | 
						|
 | 
						|
// LEAF: !"branch-target-enforcement", i32 0
 | 
						|
// LEAF: !"sign-return-address", i32 1
 | 
						|
// LEAF: !"sign-return-address-all", i32 1
 | 
						|
// LEAF: !"sign-return-address-with-bkey", i32 0
 | 
						|
 | 
						|
// BKEY: !"branch-target-enforcement", i32 0
 | 
						|
// BKEY: !"sign-return-address", i32 1
 | 
						|
// BKEY: !"sign-return-address-all", i32 0
 | 
						|
// BKEY: !"sign-return-address-with-bkey", i32 1
 | 
						|
 | 
						|
// NONE-NOT: branch-target-enforcement
 | 
						|
// NONE-NOT: sign-return-address
 | 
						|
// NONE-NOT: sign-return-address-all
 | 
						|
// NONE-NOT: sign-return-address-with-bkey
 |