Skip to content

Commit 4ee01c4

Browse files
committed
Add target_feature = "gc" for Wasm
1 parent b889870 commit 4ee01c4

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
266266
"leoncasa" => Some(LLVMFeature::new("hasleoncasa")),
267267
s => Some(LLVMFeature::new(s)),
268268
},
269+
Arch::Wasm32 | Arch::Wasm64 => match s {
270+
"gc" if major < 22 => None,
271+
s => Some(LLVMFeature::new(s)),
272+
},
269273
Arch::X86 | Arch::X86_64 => {
270274
match s {
271275
"sse4.2" => Some(LLVMFeature::with_dependencies(

compiler/rustc_target/src/target_features.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ static WASM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
745745
("bulk-memory", Stable, &[]),
746746
("exception-handling", Unstable(sym::wasm_target_feature), &[]),
747747
("extended-const", Stable, &[]),
748+
("gc", Unstable(sym::wasm_target_feature), &["reference-types"]),
748749
("multivalue", Stable, &[]),
749750
("mutable-globals", Stable, &[]),
750751
("nontrapping-fptoint", Stable, &[]),

tests/ui/check-cfg/target_feature.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
121121
`frecipe`
122122
`frintts`
123123
`fxsr`
124+
`gc`
124125
`gfni`
125126
`guarded-storage`
126127
`hard-float`

0 commit comments

Comments
 (0)