diff options
| author | Alessandro Decina <alessandro.d@gmail.com> | 2021-05-29 22:17:02 +1000 |
|---|---|---|
| committer | Alessandro Decina <alessandro.d@gmail.com> | 2021-05-29 22:23:32 +1000 |
| commit | 9cf2170a79c73f32e1442120242729dc3af992f0 (patch) | |
| tree | d7e8a31062a161f07600b3bfb9fc72ac2b7c7d07 | |
| parent | ec0382e40437b5cd69678e96de950590ef7196ef (diff) | |
| download | rust-9cf2170a79c73f32e1442120242729dc3af992f0.tar.gz rust-9cf2170a79c73f32e1442120242729dc3af992f0.zip | |
BPF: fix #[target_feature(enable = "alu32")]
| -rw-r--r-- | compiler/rustc_feature/src/active.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/collect.rs | 1 | ||||
| -rw-r--r-- | src/test/codegen/bpf-alu32.rs | 12 |
3 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 62d81304134..221cb96ba87 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -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) diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index 0528f8812f9..8b9cd1de3e1 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -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, }; diff --git a/src/test/codegen/bpf-alu32.rs b/src/test/codegen/bpf-alu32.rs new file mode 100644 index 00000000000..30ad9747520 --- /dev/null +++ b/src/test/codegen/bpf-alu32.rs @@ -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 +} |
