BPF: fix #[target_feature(enable = "alu32")]

This commit is contained in:
Alessandro Decina 2021-05-29 22:17:02 +10:00
parent ec0382e404
commit 9cf2170a79
3 changed files with 14 additions and 0 deletions

View file

@ -250,6 +250,7 @@ declare_features! (
(active, f16c_target_feature, "1.36.0", Some(44839), None),
(active, riscv_target_feature, "1.45.0", Some(44839), None),
(active, ermsb_target_feature, "1.49.0", Some(44839), None),
(active, bpf_target_feature, "1.53.0", Some(44839), None),
// -------------------------------------------------------------------------
// feature-group-end: actual feature gates (target features)

View file

@ -2597,6 +2597,7 @@ fn from_target_feature(
Some(sym::rtm_target_feature) => rust_features.rtm_target_feature,
Some(sym::f16c_target_feature) => rust_features.f16c_target_feature,
Some(sym::ermsb_target_feature) => rust_features.ermsb_target_feature,
Some(sym::bpf_target_feature) => rust_features.bpf_target_feature,
Some(name) => bug!("unknown target feature gate {}", name),
None => true,
};

View file

@ -0,0 +1,12 @@
// compile-flags: --emit=asm --target bpfel-unknown-none
// only-bpf
#![crate_type = "lib"]
#![feature(bpf_target_feature)]
#![no_std]
#[no_mangle]
#[target_feature(enable = "alu32")]
// CHECK: define i8 @foo(i8 returned %arg) unnamed_addr #0 {
pub unsafe fn foo(arg: u8) -> u8 {
arg
}