Skip to content

Commit 9cf2170

Browse files
committed
BPF: fix #[target_feature(enable = "alu32")]
1 parent ec0382e commit 9cf2170

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

compiler/rustc_feature/src/active.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ declare_features! (
250250
(active, f16c_target_feature, "1.36.0", Some(44839), None),
251251
(active, riscv_target_feature, "1.45.0", Some(44839), None),
252252
(active, ermsb_target_feature, "1.49.0", Some(44839), None),
253+
(active, bpf_target_feature, "1.53.0", Some(44839), None),
253254

254255
// -------------------------------------------------------------------------
255256
// feature-group-end: actual feature gates (target features)

compiler/rustc_typeck/src/collect.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,6 +2597,7 @@ fn from_target_feature(
25972597
Some(sym::rtm_target_feature) => rust_features.rtm_target_feature,
25982598
Some(sym::f16c_target_feature) => rust_features.f16c_target_feature,
25992599
Some(sym::ermsb_target_feature) => rust_features.ermsb_target_feature,
2600+
Some(sym::bpf_target_feature) => rust_features.bpf_target_feature,
26002601
Some(name) => bug!("unknown target feature gate {}", name),
26012602
None => true,
26022603
};

src/test/codegen/bpf-alu32.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// compile-flags: --emit=asm --target bpfel-unknown-none
2+
// only-bpf
3+
#![crate_type = "lib"]
4+
#![feature(bpf_target_feature)]
5+
#![no_std]
6+
7+
#[no_mangle]
8+
#[target_feature(enable = "alu32")]
9+
// CHECK: define i8 @foo(i8 returned %arg) unnamed_addr #0 {
10+
pub unsafe fn foo(arg: u8) -> u8 {
11+
arg
12+
}

0 commit comments

Comments
 (0)